Skip to content

Instantly share code, notes, and snippets.

@zoffixznet
Created July 28, 2016 16:07
Show Gist options
  • Save zoffixznet/0d37221a1ae824bebce461c61091bf0d to your computer and use it in GitHub Desktop.
Save zoffixznet/0d37221a1ae824bebce461c61091bf0d to your computer and use it in GitHub Desktop.
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