Stories
Slash Boxes
Comments

SoylentNews is people

Log In

Log In

Create Account  |  Retrieve Password


exec irc bot: script startup commands

Posted by crutchy on Tuesday November 11 2014, @01:39PM (#797)
0 Comments
Code

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

My words to the universe.

Posted by Subsentient on Tuesday November 11 2014, @12:13PM (#795)
6 Comments
/dev/random

Warning: if you suffer from depression, don't read this. It might mess with your head. Not kidding.

This is probably the first time I've written to you, universe. I may have prayed to God or others, but I doubt I've spoken to you before.

I need to drop on my knees, and sob out my thanks to god for Prozac 60mg. I've suffered more than I imagine near anyone else can comprehend. It's such a sick, bent agony laced with petrifying fear, covered in 'my-universe-is-broken' sauce. The OCD I was dealt in 2011 is the most indescribable hell I can imagine. I can laugh at the atrocities I see on the news because I would have traded places for something as simple and benign as physical pain, the pain of four broken limbs or having my skin peeled off with a steak knife. Instead I was given 24-hour terror equivalent to being eaten alive by a monster. I wanted to die so bad during this. I wanted to die so badly.
I was alive for my family but even their need was getting to not be enough to justify my living in this carnival from hell.

So as you know I ended up in a crisis center in September, right in time for 9/11, and was put on several medications, none of which worked, and one (Invega, the only antipsychotic they tried), actually made it far worse. Then they gave me the Prozac. I knew that SSRIs needed to be a high dose to help OCD, so I bothered them until they raised it to 60mg.
It took the month and a half to start working they said it would. A little longer.

We both know I was not given the hand-washing or germ phobias with my OCD, I was given the horrible obsessive existential stuff, the really horrible painful questions that I'd obsess over until every fiber of my being believed them to be true. The kind of stuff that can blacken your sky and make you feel like you're falling into an infinite pit of pitch black tar. The stuff that makes you want to die, but be too afraid of what nightmare would await you if you did. The one the sufferers called Pure-O. I suppose I deserve some positive reward for living through this at all, or perhaps just an absence of punishment for a while, since if I wasn't wanted by family and friends, I'd be two years dead by now.

I'm writing this because I want to tell you what I need now. I hope you'll give it to me. As you know, the last few months, during my recovery, I've stopped all work, all projects, all programming and just played Warzone 2100 all day. I've gotten as good as I was before. I'm happy for the first time in years. I plan to start my work again soon, but I need some guarantees from you before I do so.

The first thing is, as an example, my famous gerbil jokes, such as 'fear the gerbils', no longer appeal to me, because I've had enough fear. Horror movies are no longer something I watch, I don't enjoy Halloween anymore, and although you know that historically I've preferred sad music when sad, now, I find myself playing uplifting songs in an attempt to drown out the memories. Christmas is probably forever ruined for me because of the onset of the OCD that time in 2011. Kinda a PTSD thing going on there.
Whenever I hear a christmas song, instant trip down memory lane from hell.
Fourth of July is ruined too thanks to my relapse in July this year.

I want to be surrounded by joy, by kindness, by peace, by good things. I have seen enough of the other side of the spectrum for this lifetime.

I want to be loved, and to love others, I want to have a fulfilling and useful purpose and still have time for myself.
I want to be followed by a hundred billion times more light than I ever was darkness.

The tagline at the bottom of the site today says "Today is the first day of the rest of the mess.", but I vehemently disagree. Today is the first day of the rest of my life, and it's going to be good now, because I deserve it. I've paid my dues. I'd just like your blessing for the good plan I've laid out, and your help in making it come to pass.

Sincerely, SubsentientneitnesbuS.

exec irc bot: included alias definitions

Posted by crutchy on Saturday November 08 2014, @12:16AM (#787)
0 Comments
Code

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.

--
http://sylnt.us/exec
http://sylnt.us/execsrc

Soylent IRC voting system

Posted by crutchy on Sunday October 26 2014, @11:46AM (#757)
0 Comments
Code

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

--
http://sylnt.us/exec

github irc feed

Posted by crutchy on Saturday October 11 2014, @10:37PM (#722)
0 Comments
Code

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.

--
http://sylnt.us/exec

exec irc bot

Posted by crutchy on Tuesday September 30 2014, @02:50PM (#695)
0 Comments
Code

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

exec nick tracking

Posted by crutchy on Sunday September 07 2014, @02:02PM (#652)
0 Comments
Code

exec now has a basic nick tracking script that hooks the join, nick, quit, kick, part and 353 events. this feature is similar but nowhere near as complete as xchat's (or $insert_client_here's) user list.

it has lead to the addition of internal stdout commands for retrieving a space-delimited listing of bucket indexes, and commands for pausing and unpausing the processing of irc data, to prevent corruption of bucket data that might occur due to multiple processes triggered by irc events trying to read/write to the same bucket(s) simultaneously.

http://sylnt.us/exec#Buckets

nick tracking enables scripts to find out what nicks are in a given channel or what channels a given nick are in. currently only channels shared with the bot are tracked, but with additional event hooks (such as a whois 319 numeric) additional channel info can be tracked.

with proposed addition of whois account querying (330 numeric) by the user tracking script, other scripts will be able to authenticate instructions with a simple function call.

the irciv script was originally designed with player authentication using the 330 nickserv account numeric. however it was messy, with irciv-specific code sprinkled throughout the main event handling script (cmd.php). the generalized tracking system will give all scripts access to the same user data via a small set of lib functions.

--
http://sylnt.us/exec
https://github.com/crutchy-/exec-irc-bot

Bitcoin payments

Posted by The Mighty Buzzard on Friday September 05 2014, @05:09PM (#646)
1 Comment
Soylent

<OfficialDevHat>
So, I'd given an estimate of "by this weekend" for crypto-currency payment processing. I was pretty close for not even having looked at it or picked a payment processor yet. It's looking like I'll finish Monday unless I find another 3-4 hours of coding in my brain today. I can't really speak to when it will deployed to prod afterwards.

The skinny of it is I went through two other payment processors before settling on Bitpay. It would have been nice to accept litecoin and dodgecoin as well as bitcoin but some payment processor who shall remain nameless had a dev environment that did not mirror their prod environment and all the documentation for the API was for their dev environment, so I killed with fire all nine or ten hours of coding I'd done to process payments with them and went back to looking for another processor. Maybe one of these days they'll update and bring some sanity to their system and you lot will be able to use litecoin and dodgecoin here. Until then, bitcoin payments via Bitpay are currently working from my dev environment but in need of some finishing touches and testing before being deployed for you lot to use.
</OfficialDevHat>

<PrivateCitizenHat>
A quick word about Bitpay. If you ever want to receive USD when being sent BTC, I personally highly recommend using them. Aside from test.bitpay.com not being mentioned in the docs at the time, they were bloody brilliant to code against. As a random code monkey on the Internet, they have my resounding personal endorsement.
</PrivateCitizenHat>

aqu4bot, libcurl, and Windows.

Posted by Subsentient on Monday September 01 2014, @04:16PM (#633)
2 Comments
Code

For a few months now, aqu4bot's Windows support has been broken. Compilation would fail because nonblocking sockets were not properly doable in Windows the way it was intended. I was using the same network core I use on the IRC protocol to download HTTP.

It worked, except when it hung. This affected mainly the $title command. So I added the nonblocking, which was necessary, but this broke all Windows support. I was reluctant in using libcurl because although I love libcurl, I only had two commands for aqu4 that used HTTP. That was $ddg and $title.

The good news is libcurl is VERY portable and works well under Windows. So needless to say aqu4bot's Net_GetHTTP() function was removed in favor of a new CurlCore_GetHTTP().

There is now a hard dependency on libcurl, but that's fine I suppose, since I now have my precious and arguably useless Windows support once more.
To celebrate, I created a new icon for aqu4bot that is used as the icon for the Windows executable: http://universe2.us/collector/aqu4bot.png

There's still a small issue with $time, as Windows does not have zoneinfo so I can't set the timezone properly, but everything else appears to work!

irc comment feed

Posted by crutchy on Monday September 01 2014, @02:28PM (#630)
2 Comments
Soylent

if you're chatting away on soylent irc (irc.sylnt.us) check out #comments for a SoylentNews comment feed

the feed is based on the last 50 articles in the atom feed, and is updated every half hour

also highlights score 5 comments

examples:

<exec> *** new comment: Anonymous Coward (Score:0) "Microsoft Defies US Court Order, Will Not Give-up Emails" - http://soylentnews.org/comments.pl?sid=3678&cid=88065 (parent: http://soylentnews.org/comments.pl?sid=3678&cid=87969)

<exec> *** score 5 comment: Anonymous Coward for article "Microsoft Defies US Court Order, Will Not Give-up Emails" - http://soylentnews.org/comments.pl?sid=3678&cid=87971

proposed features include opt-in personalized feeds (to pm) with score threshold and other settings

suggestions/criticism/feedback/etc is always welcome

--
https://github.com/crutchy-/exec-irc-bot/blob/master/scripts/comment_feed.php