Created
June 23, 2015 20:03
-
-
Save niner/564671ce4611556a9604 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Bot::BasicBot:from<Perl5>; | |
class P6Bot is Bot::BasicBot { | |
method can($method) { | |
return 1; | |
} | |
method said(%statement) { | |
self.reply($%statement, "Hullo {%statement<who>}!") if %statement<body> eq 'Hi bot!'; | |
self.reply($%statement, "I'm the first Perl 6 bot based on Bot::BasicBot!") if %statement<body> eq 'bot who are you?'; | |
self.shutdown('leaving...') if %statement<body> eq 'bot quit'; | |
} | |
} | |
my $bot = P6Bot.new( | |
server => "irc.freenode.org", | |
port => "6667", | |
channels => ["#perl6bot"], | |
nick => "p6basicbot", | |
name => "Yet Another Bot", | |
); | |
$bot.run(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment