aboutsummaryrefslogtreecommitdiff
path: root/lib/IRC/Client/Message.pm6
diff options
context:
space:
mode:
authorZoffix Znet <cpan@zoffix.com>2016-07-24 16:20:12 -0400
committerZoffix Znet <cpan@zoffix.com>2016-07-24 16:20:12 -0400
commit18615cc9bb33801fbde2716513071e7b32af2ab2 (patch)
tree167784d2089a4e05cfb114e5a3520efc28bf9ecb /lib/IRC/Client/Message.pm6
parenteffaced84ec8df42e60b89426f5fc644cb907285 (diff)
moar work
Diffstat (limited to 'lib/IRC/Client/Message.pm6')
-rw-r--r--lib/IRC/Client/Message.pm635
1 files changed, 28 insertions, 7 deletions
diff --git a/lib/IRC/Client/Message.pm6 b/lib/IRC/Client/Message.pm6
index 74261c9..84eba2c 100644
--- a/lib/IRC/Client/Message.pm6
+++ b/lib/IRC/Client/Message.pm6
@@ -16,9 +16,6 @@ role IRC::Client::Message {
constant M = IRC::Client::Message;
role Join does M { has $.channel; }
-role Notice does M { has $.text; }
-role Notice::Channel does Notice { has $.channel; }
-role Notice::Me does Notice { }
role Mode does M { has @.modes; }
role Mode::Channel does Mode { has $.channel; }
role Mode::Me does Mode { }
@@ -34,16 +31,40 @@ role Ping does M {
method reply { $.irc.send-cmd: 'PONG', $.args, :$.server; }
}
-role Privmsg does M { has $.text; }
+role Privmsg does M {
+ has $.text is rw;
+ has Bool $.replied is rw = False;
+ method Str { $.text }
+}
role Privmsg::Channel does Privmsg {
has $.channel;
method reply ($text, :$where) {
- $.irc.send-cmd: 'PRIVMSG', $where // $.channel, $text, :$.server;
+ $.irc.send-cmd: 'PRIVMSG', $where // $.channel, "$.nick, $text",
+ :$.server;
}
}
role Privmsg::Me does Privmsg {
method reply ($text, :$where) {
- $where //= $.nick;
- $.irc.send-cmd: 'PRIVMSG', $where, $text, :$.server;
+ $.irc.send-cmd: 'PRIVMSG', $where // $.nick, $text, :$.server;
+ }
+}
+
+role Notice does M {
+ has $.text is rw;
+ has Bool $.replied is rw = False;
+ method Str { $.text }
+}
+role Notice::Channel does Notice {
+ has $.channel;
+ method reply ($text, :$where) {
+ $.irc.send-cmd: 'NOTICE', $where // $.channel, "$.nick, $text",
+ :$.server;
+ $.replied = True;
+ }
+}
+role Notice::Me does Notice {
+ method reply ($text, :$where) {
+ $.irc.send-cmd: 'NOTICE', $where // $.nick, $text, :$.server;
+ $.replied = True;
}
}