aboutsummaryrefslogtreecommitdiff
path: root/examples/bot.pl6
blob: d64e9b8276eff2d06c5703a624621711d4cf3eca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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<1>
    # :channels<#zofbot>
    # :host<irc.freenode.net>
    :servers(
        inspircd => { :port<6667> }
        mine     => { :port<5667> }
    )
    :plugins(MyPlug.new)
).run;