Created
July 28, 2016 16:07
-
-
Save zoffixznet/0d37221a1ae824bebce461c61091bf0d 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 IRC::Client; | |
class Messenger does IRC::Client::Plugin { | |
method irc-privmsg-channel ($e) { | |
for $.irc.servers.values -> $s { | |
for $s.channels -> $channel { | |
next if $s.name eq $e.server and $channel eq $e.channel; | |
$.irc.send: :server($s), :where($channel), :text( | |
"Hey, everybody! $e.nick() over at $e.server()/$e.channel()" | |
~ " says $e.text()" | |
); | |
} | |
} | |
'Message forwarded'; | |
} | |
} | |
.run with IRC::Client.new: | |
:debug | |
:plugins[Messenger.new] | |
:nick<MahBot> | |
:channels<#zofbot> | |
:servers{ | |
freenode => %( | |
:channels<#zofbot #perl6>, | |
:host<irc.freenode.net>, | |
), | |
local => %( | |
:nick<P6Bot>, | |
:channels<#zofbot #perl6>, | |
:host(%*ENV<IRC_HOST> // 'localhost'), | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment