#!/usr/bin/env raku use v6.d; use IRC::Client; use IRC::Client::Plugin; use Log; use Log::Level; use Number::Denominate; sub MAIN() { # Configure Log $Log::instance = (require ::($*ENV // 'Log::Colored')).new; $Log::instance.add-output($*OUT, %*ENV // Log::Level::Debug); # Start the IRC client my $bot = IRC::Client.new( #host => 'chat.freenode.net', #port => 6697, #ssl => True, host => '127.0.0.1', port => 6667, ssl => False, nicks => , channels => <##t #test>, plugins => [ class _ is IRC::Client::Plugin { multi method irc-to-me ($ where * eq 'uptime') { denominate now - INIT now; } multi method irc-to-me ($event where { $_.nickname eq 'tyil' && $_ eq 'prefix' }) { $event.irc.prefix; } multi method irc-to-me ($event where { $_.nickname eq 'tyil' && $_ eq 'chanlist' }) { $event.irc.channels.join(', ') } multi method irc-to-me ($event where { $_.nickname eq 'tyil' && $_.words[0] eq 'join'}) { my $channel = $event.words[1]; $event.reply("Joining $channel"); $event.irc.join($channel); } multi method irc-to-me ($event where { $_.nickname eq 'tyil' && $_.words[0] eq 'part'}) { my $channel = $event.words[1]; $event.reply("Parting $channel"); $event.irc.part($channel); } multi method irc-mentioned ($) { "Don't take my name in your filthy mouth, peasant" } multi method http-get(%payload) { dd %payload; %payload.privmsg('#test', 'hello there'); } multi method http-post(%payload) { %payload.privmsg('#test', %payload); } }, ], ); $bot.start; }