From b6da79a0bc1289f2a6064a6b3ffcd0c2333f2c97 Mon Sep 17 00:00:00 2001 From: Patrick Spek Date: Wed, 5 May 2021 11:03:32 +0200 Subject: Initial commit --- bin/test | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 bin/test (limited to 'bin') diff --git a/bin/test b/bin/test new file mode 100644 index 0000000..421230f --- /dev/null +++ b/bin/test @@ -0,0 +1,72 @@ +#!/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; +} -- cgit v1.1