Skip to content

Commit

Permalink
Added dice rolls and updated readme.
Browse files Browse the repository at this point in the history
  • Loading branch information
LindseyB committed Jun 29, 2011
1 parent 5247100 commit 76fcd2b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
18 changes: 11 additions & 7 deletions README.rdoc
Expand Up @@ -4,22 +4,26 @@
XOmBot is a simple IRC bot written in perl meant to lurk in #xomb.
Right now XOmBot accepts the following commands:

* !wiki article name: will attempt to find a wiki article of that name and provide a definition
* !wiki [article name]: will attempt to find a XOmB wiki article of that name and provide a definition
* !latest: will provide information for the latest commit
* !commands: will list the commands XOmBot listens for and what they do
* !commands: will list the commands XOmBot listens for and what they do
* !google [phrase] for [nick]: Sends a lmgtfy.com link to nick
* !coinflip: flips a coin
* !santa: Asks Santa if the bot has been naught or nice
* !d[n]: rolls a die with n sides

XOmBot has the following behaviours:
XOmBot has the following behaviours in addition to the commands:

* announces an applied commit to the main XOmB repo
* informs the channel of the !commands command upon entering a channel
* says "brains..." when directly refered to (ie: XOmBot: message)
* displays the title of any valid http:// urls displayed in the channel


----

A note about the Net::IRC module:
Requires:

There may be a warning on line 141 of IRC.pm because of the do_one_loop. Simply replace this line with the following:
* Bot::BasicBot
* URI::Title
* URI::Find::Simple

<tt>return if defined($caller) and $caller eq 'Net::IRC::flush_output_queue';</tt>
6 changes: 6 additions & 0 deletions XOmBot.pl
Expand Up @@ -74,6 +74,7 @@ sub said {
$self->say(channel => $channel, body => "!google [phrase] for [nick] - answer questions. More bangs to shoot from the hip.");
$self->say(channel => $channel, body => "!coinflip - ...");
$self->say(channel => $channel, body => "!santa - ask Santa whether $mynick has been naughty or nice.");
$self->say(channel => $channel, body => "!d[n] - rolls die with n sides");
}

if ($body =~ m/^\!wiki\s*([\w*\s]*)/){
Expand Down Expand Up @@ -115,6 +116,11 @@ sub said {
$self->say(channel => $channel, body => "$outcome");
}

# dice roll
if($body =~ m/^\!d(\d*)/){
$self->say(channel => $channel, body => int(rand($1)) + 1);
}

if($body =~ m/^\!santa/){
if($good >= $bad){
$self->emote(channel => $channel, body => "has been a good little robotic zombie");
Expand Down

0 comments on commit 76fcd2b

Please sign in to comment.