From 926886e054edd1dd67e3195416c1c183f3850946 Mon Sep 17 00:00:00 2001 From: David Phillips Date: Thu, 9 Mar 2017 11:27:03 +1300 Subject: Add message/reason to part command --- saxrobot | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/saxrobot b/saxrobot index 05a4315..2928d19 100755 --- a/saxrobot +++ b/saxrobot @@ -102,11 +102,17 @@ sub irc_msg { } } if ($what =~ /^part\s/) { - my ($channel) = $what =~ /^part\s+(\S+)$/; + my $message; + my ($channel, $message) = $what =~ /^part\s+(\S+)(\s(.*))?$/; if ($channel) { - $irc->yield(part => $channel); + if (!$message) { + $message = "commanded by $nick"; + } else { + $message =~ s/^\s+//; + } + $irc->yield(part => $channel => $message); } else { - $irc->yield(privmsg => $nick => "Syntax: part "); + $irc->yield(privmsg => $nick => "Syntax: part [partmsg]"); } } if ($what =~ /^join\s/) { -- cgit v1.1