aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorZoffix Znet <cpan@zoffix.com>2016-06-04 23:20:01 -0400
committerZoffix Znet <cpan@zoffix.com>2016-06-04 23:20:01 -0400
commitc56f8b4359f2730bb9e8bccd40bf2c9fa840f433 (patch)
tree24d2021ab2794647aad2f44d802be160edfc485d /examples
parent5a2196b2c8f2ac2eacb3ddaf40b3e75b9c38bb62 (diff)
First working rewrite
Diffstat (limited to 'examples')
-rw-r--r--examples/bot.pl618
1 files changed, 13 insertions, 5 deletions
diff --git a/examples/bot.pl6 b/examples/bot.pl6
index 4fd1a26..70dbaa3 100644
--- a/examples/bot.pl6
+++ b/examples/bot.pl6
@@ -1,11 +1,19 @@
-use v6;
use lib 'lib';
use IRC::Client;
+use IRC::Client::Plugin;
+
+class MyPlug does IRC::Client::Plugin {
+ method irc-privmsg-channel ($msg) {
+ return $.IRC_NOT_HANDLED unless $msg.text ~~ /^'say' \s+ $<cmd>=(.+)/;
+ $msg.reply: "How about: $<cmd>.uc()";
+ }
+}
my $irc = IRC::Client.new(
:nick('IRCBot' ~ now.Int)
- :debug
- :channels<#zofbot>
- :host<irc.freenode.net>
- #:port<5667>
+ :debug<1>
+ # :channels<#zofbot>
+ # :host<irc.freenode.net>
+ :port<5667>
+ :plugins(MyPlug.new)
).run;