From b8f67601e0086d7a2403e4f47ca720e3df3c5365 Mon Sep 17 00:00:00 2001 From: Patrick Spek Date: Mon, 17 Dec 2018 06:22:24 +0100 Subject: Make auto-prefixing nicks optional This patch adds the :autoprefix option, which is True by default. When set to False, the .reply method should no longer prefix the message with the triggering user's nick. --- lib/IRC/Client/Message.pm6 | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'lib/IRC/Client/Message.pm6') diff --git a/lib/IRC/Client/Message.pm6 b/lib/IRC/Client/Message.pm6 index 79ef7d8..ff307ef 100644 --- a/lib/IRC/Client/Message.pm6 +++ b/lib/IRC/Client/Message.pm6 @@ -40,8 +40,10 @@ role Privmsg does M { role Privmsg::Channel does Privmsg { has $.channel; method reply ($text, :$where) { - $.irc.send-cmd: 'PRIVMSG', $where // $.channel, $text, - :$.server, :prefix("$.nick, "); + $.irc.autoprefix + ?? $.irc.send-cmd: 'PRIVMSG', $where // $.channel, $text, :$.server, :prefix("$.nick, ") + !! $.irc.send-cmd: 'PRIVMSG', $where // $.channel, $text, :$.server + ; } } role Privmsg::Me does Privmsg { @@ -60,8 +62,11 @@ role Notice does M { role Notice::Channel does Notice { has $.channel; method reply ($text, :$where) { - $.irc.send-cmd: 'NOTICE', $where // $.channel, $text, - :$.server, :prefix("$.nick, "); + $.irc.autoprefix + ?? $.irc.send-cmd: 'NOTICE', $where // $.channel, $text, :$.server, :prefix("$.nick, ") + !! $.irc.send-cmd: 'NOTICE', $where // $.channel, $text, :$.server + ; + $.replied = True; } } -- cgit v1.1