Skip to content

Instantly share code, notes, and snippets.

@niner
Created June 23, 2015 20:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save niner/564671ce4611556a9604 to your computer and use it in GitHub Desktop.
Save niner/564671ce4611556a9604 to your computer and use it in GitHub Desktop.
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