the "~x" alias allows a bot operator to create and manage scripts from within IRC (dubbed "live scripts")
scripts created using this alias are stored in a bucket by the bot instead of a file
the handler uses php's eval to run live scripts
to prevent anyone from executing arbitrary commands on the bot host, a whois command is issued to verify that the NickServ account of the user of the ~x alias is the bot operator (by settling the userlist parameter of the alias definition line to "@")
the general form of the command is:
~x %action% [%param%] [%code%]
in a nutshell the possible actions and params are:
"global on|off" (enables or disables all live scripts)
"kill" (a shorcut for disabling all live scripts)
"enable %script-name%" (enables an individual live script)
"disable %script-name%" (disables an individual live script)
"delete-script %script-name%" (deletes a live script from memory)
"open %script-name%" (opens a live script for editing in the active channel)
"close" (closes the currently open live script in the active channel)
"code" (outputs a line-numbered code listing of the currently open live script in the active channel)
"list" (outputs a listing of available live scripts, and highlights enabled scripts)
"replace [L]%line-number% %old-code%|%new-code%" (replaces a line of code in the currently open live script)
"delete-line [L]%line-number%" (deletes a line of code in the currently open live script)
"insert [L]%line-number% %code%" (inserts a line of code in the currently open live script)
"add %code%" (adds a line of code to the currently open live script)
import and export (from/to file) actions are also proposed but not yet implemented.
live scripts have access to common lib functions used by other scripts, and also have direct access to $nick, $dest (channel), $trailing. the privmsg lib function doesn't work for live scripts as the live script handler is triggered internally by the bot using a registered privmsg event handler, so to privmsg the channel that the sender ($nick) is in you simply call pm($dest,"message) instead.
when a new live script is created, it must be enabled before it will run, but once enabled any changes will come into affect immediately.
whilst the code is currently limited to php, it could potentially be adapted to execute code in other languages using their command-line interpreters. it also doesn't have to be limited to code. it could potentially be used to collaborate on lines of non-executing text (such as for collaborative editing of SN submissions). with some tweaks it could be possible to collaborate on code as well, with other users being able to add/edit/delete lines but requiring the operator to re-enable the script for changes to come into effect.
ps: exec also now supports init: in-script directives, similar to startup: and exec: directives, which will increase self-containment of scripts further.
--
https://github.com/crutchy-/exec-irc-bot/blob/master/scripts/scripting.php
http://sylnt.us/exec
http://sylnt.us/execsrc
In every person's life, they have good times and not-so-good times. It's easy to take the good times for granted. When times are good, there is no reason to think why - it just is. Eventually, the pendilum will swing back in the other direction and that, my friends, is where I am today.
It's been a tough couple months for me. I'm 31, recently married, no kids. My wife and I lived together for over 10 years before getting married. Needless to say, we met rather young. She is an amazing woman -- beautiful, smart, and caring. She is the only woman I could imagine living my life with. As I mentioned, we met rather young, and because of that, I never had a chance to fool around with other women. I thought that I could live with that, but over the last 6 months or so (and talk of having a baby), the reality has hit home, and I don't think I want to life my entire life only being with 3 women. So what do you do? I have a wife that I love very much and want to spend my life with, but a burning need to experience the world.
***
I have a good job that allows me to live comfortably, but it is killing me. Most days I only do one or two hours of work, which sounds great until you actually have to live it for a couple months. It's really boring and unfufilling. I am by far the most technical and experienced person on the team, yet another person runs the team (It's complicated...). I don't get invited to meetings and because of that, mistakes get made and then I have to clean up the mess. I get no appreciation at all even though I pull rabbits out of my ass all the time - for what? It's just super stable... I can't imagine getting laid off or fired. That being said, my mood is getting the best of me and I've been really pissy and irritable lately. If it get's much worse, I might get fired.
***
How many of you are married? Women and men don't need sex in the same way. For a man, sex is very, very important. If I don't get sex, I get really depressed. It get's really old when I have to initate sex all the time. I get rejected often because she's 'too tired' or 'not in the mood'. It's humiliating and painful to be rejected so much, like a knife to the heart. It hardly seems worth even trying. I get 'intimate' with my computer more than my wife. I would guess I get sex about 5 times a month.
Last Tuesday, we had talked about sex in the evening, and then she took a bath (which usually means I'm getting lucky). When she crawled into bed, she says 'I'm so tired..." AKA 'No sex for you'. Ouch. Well another date with the computer then... The following day, I sent her a very well written article that explains how men need sex just like women need to talk. She understood the article and plans to do better. Last night she actually initated sex, it was amazing. I hope to get more of this...
***
I really do have an amazing wife, and we have a strong relationship. Over the summer I told her that I don't know if I can live my life without having sex with other women. I only get one life, and sex is so important to me. I'm not looking to screw anything with legs, but I'd like to bring my number from 3 to something like 10. I dropped this on her 3-4 months after we got married (Remember we have been living together for over 10 years, so it feels like we have been married for a long time...). I felt like a complete asshole, but I'm caught between a rock and a hard place. One one side I would never want to hurt my wife -- but on the other, I only get one chance at life, so I want to get everything out of it.
We talked about this a few more times over the next few months, and she agrees to allow me to date other women on the side. It felt like I had escaped from a trap. I try Tinder, and then gave up on that and opened an account on another dating website. I very stongly believe in honesty, so I put in my profile that I am married. I don't want to decieve anyone.
It's been a couple weeks now, and no good nibbles. I think I'm pretty good looking for a nerd (I'm thin, but tall) and I'm reasonably socialable. The lack of interest has really gotten be down even more though.
***
So, that's my life. Sometimes it helps just writing things down, so I hope this helps. I have a job that is unfufilling, an unfulfilling sex life (although my wife says she'll try now - which in itself is pretty sad), and constant rejection on dating sites. It's getting pretty tough to deal with. I hope things get better soon.
-- Snow
can now specify commands to run at startup inside scripts in a similar fashion to alias definitions
startup commands are read from one or more directives in the main exec file:
startup ./scripts
this uses the same (now more generalized) code as alias definitions; recursively searching files in the specified path for "startup:" directives (similar to "exec:" directives). like exec directives, startup directives must occur at the start of a line, so should be put in multi-line comment (below exec directive usually).
startup directives are stored until the bot identifies with NickServ, at which point the "<startup>" reserved alias is triggered followed by commands from startup directives run.
startup commands are like what you would type in IRC channels, but in this case they are intercepted by the bot and don't get transmitted to the IRC server. you can have any number of startup directive lines in a file.
example (php exec script):
/*
exec:~privmsg-internal|5|0|0|1||INTERNAL||0|php scripts/privmsg.php %%trailing%% %%nick%% %%dest%%
startup:~privmsg-internal register-events
*/
startup directives are good for triggering event registration handlers in the script, and pretty much makes a script self-contained (for now anyway).
--
http://sylnt.us/exec
http://sylnt.us/execsrc
commit for this feature: https://github.com/crutchy-/exec-irc-bot/commit/a3bb41c0d6eced1b6ec6e6573370f3db7129ccaa
added an include feature when loading/rehashing the main exec file (https://github.com/crutchy-/exec-irc-bot/blob/master/exec.txt).
syntax is:
include %filename%
%filename% can be a path, which will recurse to include any readable files contained.
it can also be a relative path (to the main bot script, irc.php):
include ./scripts
when including a file, the bot will read the contents of the file and look for any line beginning with "exec:" and will treat whatever follows as an alias definition (exec line).
to use this feature in a script (without borking the script) you just enclose the line in a comment. the exec directive must be on its own line, so it won't work as an EOL comment.
this means an alias definition (exec line) can be stored in individual scripts in any language that supports multi-line comments.
example (from https://github.com/crutchy-/exec-irc-bot/blob/master/scripts/irciv/irciv.php):
/*
exec:~civ|30|0|0|1||||0|php scripts/irciv/irciv.php %%nick%% %%trailing%% %%dest%% %%start%% %%alias%% %%cmd%%
*/
if you create a new script, you can either add an include directive in the main exec file and issue a ~rehash command in irc, or if you already have a directory in the main exec file you can just issue a ~rehash after you save your script.
the aim of this feature is to enable scripts to become more self-contained.
anyway, thanks for reading and have a great weekend.
Unless I missed it, it looks like neither SoylentNews nor Pipedot had a thread for the 2014 US Election. That's a shame, since it's the perfect type of thread, it would have both generated views and comments, while allowing those not interested to easily avoid it.
The old site did have two threads related to cannabis legalization and vote machine problems, but not one about the general election results.
A quick and dirty voting script has been developed for use in Soylent IRC.
Voting syntax for users identified with NickServ is:
~vote <poll_id> <option>
More info on how to use it can be found here:
http://sylnt.us/vote
There is now a feed set up in the #github channel on SoylentNews IRC for reporting push, pull and issue events for SoylentNews/slashcode, and push events for some other SN user and staff repos.
The feed works by querying GitHub API URLs every 15 minutes.
moved nick tracking inside bot process cos i was having all sorts of grief trying to make it work the way i wanted in a separate script. seems to work pretty smoothly now, and i don't need to worry about pausing/unpausing the socket reader.
starting fidgeting with irciv again now that i got some reliable generic authentication features. trying to consolidate all actions into a single alias and get player authentication back up.
event response is a bit more readily available to scripts with event handler registration. the bot keeps track of command/handler pairs in an encoded bucket, and on various events the register is queried and any handlers that exist are executed. this opens up possibility to have the bot trigger a script on an event without using the exec.txt file, and as the register is a bucket it can also be edited from within irc. will have to think about what sort of security risks this might pose, but ability to manually edit buckets is limited to privileged users so not overly worried. irciv will register event handlers on startup to manage player tracking, which was formerly done in cmd.php (eventually want to remove cmd.php, to be replaced with registered event handlers in startup.php). some templates are supported in event handlers; %%nick%%, %%trailing%%, %command%% and %%params%%, which are replaced with actual values when the handled event occurs
a little SN funding feed has been enabled. polls home page slashbox every 15 mins. message appears in #soylent if funding amount increases
comment feed has been changed to use simpler xml feed and only top 20 articles are scraped, as i found the latter 30 articles never got that many comments (assuming probably cos they fall off the SN front page). /join #comments
--
http://sylnt.us/exec
https://github.com/crutchy-/exec-irc-bot