aboutsummaryrefslogtreecommitdiff
path: root/lib/IRC/Client.pm6
diff options
context:
space:
mode:
authorZoffix Znet <cpan@zoffix.com>2015-12-06 15:05:29 -0500
committerZoffix Znet <cpan@zoffix.com>2015-12-06 15:05:29 -0500
commitba793ec6d1d4c66300f40cbced25f9ffd23ec792 (patch)
treebc419699af8499c4b90026d605f72aa832325ef5 /lib/IRC/Client.pm6
parente0b2a598b9475edcfca40b7cb4faa7746232a30c (diff)
Debug
Diffstat (limited to 'lib/IRC/Client.pm6')
-rw-r--r--lib/IRC/Client.pm631
1 files changed, 18 insertions, 13 deletions
diff --git a/lib/IRC/Client.pm6 b/lib/IRC/Client.pm6
index 4635301..dcf0fcb 100644
--- a/lib/IRC/Client.pm6
+++ b/lib/IRC/Client.pm6
@@ -1,16 +1,18 @@
use v6;
+use IRC::Parser; # parse-irc
role IRC::Client::Plugin { ... }
class IRC::Client:ver<1.001001> {
- has Bool:D $.debug = False;
- has Str:D $.host = 'localhost';
- has Int:D $.port where 0 <= $_ <= 65535 = 6667;
- has Str:D $.nick = 'Perl6IRC';
- has Str:D $.username = 'Perl6IRC';
- has Str:D $.userhost = 'localhost';
- has Str:D $.userreal = 'Perl6 IRC Client';
- has Str:D @.channels = ['#perl6bot'];
- has IRC::Client::Plugin @.plugins = [];
+ has Bool:D $.debug = False;
+ has Str:D $.host = 'localhost';
+ has Int:D $.port where 0 <= $_ <= 65535 = 6667;
+ has Str:D $.nick = 'Perl6IRC';
+ has Str:D $.username = 'Perl6IRC';
+ has Str:D $.userhost = 'localhost';
+ has Str:D $.userreal = 'Perl6 IRC Client';
+ has Str:D @.channels = ['#perl6bot'];
has IO::Socket::Async $.sock;
+ has IRC::Client::Plugin @.plugins = [];
+ has IRC::Client::Plugin @.plugins-essential = [];
method run {
await IO::Socket::Async.connect( $!host, $!port ).then({
@@ -19,13 +21,16 @@ class IRC::Client:ver<1.001001> {
$.ssay("USER $!username $!userhost $!host :$!userreal\n");
$.ssay("JOIN $_\n") for @!channels;
- Supply.interval( .interval ).tap({ $OUTER::_.interval(self) })
- for @!plugins.grep(*.interval);
+ # Supply.interval( .interval ).tap({ $OUTER::_.interval(self) })
+ # for @!plugins.grep(*.interval);
react {
whenever $!sock.Supply -> $str is copy {
- "[$str]".perl.say;
- .msg(self, $str) for @!plugins.grep(so *.msg);
+ $!debug and $str.say;
+ # say parse-irc($str).WHAT;
+ my $x = parse-irc $str;
+ @!plugins[0].msg(self, $x);
+ .msg(self, $x) for @!plugins.grep(*.msg);
}
}