From 1fa355a0a01751f5914c7cdcc3cac1eb470a10c2 Mon Sep 17 00:00:00 2001 From: David Phillips Date: Tue, 7 Mar 2017 15:02:34 +1300 Subject: Add simple join/part to remote control --- saxrobot | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'saxrobot') diff --git a/saxrobot b/saxrobot index da51f8f..ae7e4f3 100755 --- a/saxrobot +++ b/saxrobot @@ -92,6 +92,22 @@ sub irc_msg { $irc->yield(privmsg => $nick => "I am bot, go away"); return; } + if ($what =~ /^part\s/) { + my ($channel) = $what =~ /^part\s+(\S+)$/; + if ($channel) { + $irc->yield(part => $channel); + } else { + $irc->yield(privmsg => $nick => "Syntax: part "); + } + } + if ($what =~ /^join\s/) { + my ($channel) = $what =~ /^join\s+(\S+)$/; + if ($channel) { + $irc->yield(join => $channel); + } else { + $irc->yield(privmsg => $nick => "Syntax: join "); + } + } if ($what =~ /^say\s/) { my ($channel, $message) = $what =~ /^say\s+(\S+)\s(.*)$/; if ($channel and $message) { -- cgit v1.1 From 30d44a6b8e05a0e31dca073e0f8d9092e35c8d61 Mon Sep 17 00:00:00 2001 From: David Phillips Date: Tue, 7 Mar 2017 15:50:46 +1300 Subject: Add nick changing command --- saxrobot | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'saxrobot') diff --git a/saxrobot b/saxrobot index ae7e4f3..2e56e4b 100755 --- a/saxrobot +++ b/saxrobot @@ -92,6 +92,14 @@ sub irc_msg { $irc->yield(privmsg => $nick => "I am bot, go away"); return; } + if ($what =~ /^nick\s/) { + my ($channel) = $what =~ /^nick\s+(\S+)$/; + if ($channel) { + $irc->yield(nick => $channel); + } else { + $irc->yield(privmsg => $nick => "Syntax: nick "); + } + } if ($what =~ /^part\s/) { my ($channel) = $what =~ /^part\s+(\S+)$/; if ($channel) { -- cgit v1.1 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(-) (limited to 'saxrobot') 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 From a7c02881a10c6e61d37263cf1d423c27e37c6456 Mon Sep 17 00:00:00 2001 From: David Phillips Date: Thu, 9 Mar 2017 11:37:31 +1300 Subject: Implement rough multi-channel parts --- saxrobot | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'saxrobot') diff --git a/saxrobot b/saxrobot index 2928d19..f208284 100755 --- a/saxrobot +++ b/saxrobot @@ -103,14 +103,10 @@ sub irc_msg { } if ($what =~ /^part\s/) { my $message; - my ($channel, $message) = $what =~ /^part\s+(\S+)(\s(.*))?$/; - if ($channel) { - if (!$message) { - $message = "commanded by $nick"; - } else { - $message =~ s/^\s+//; - } - $irc->yield(part => $channel => $message); + if ($what =~ /^part(\s+(\S+))+$/m) { + my @args = split /\s+/, $what; + print for @args; + $irc->yield(part => @args); } else { $irc->yield(privmsg => $nick => "Syntax: part [partmsg]"); } -- cgit v1.1 From 3f2da46f575e19f62244263826bfcb29535d130d Mon Sep 17 00:00:00 2001 From: David Phillips Date: Thu, 9 Mar 2017 12:19:57 +1300 Subject: Parse part message with spaces in it --- saxrobot | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'saxrobot') diff --git a/saxrobot b/saxrobot index f208284..a1d27d5 100755 --- a/saxrobot +++ b/saxrobot @@ -104,9 +104,10 @@ sub irc_msg { if ($what =~ /^part\s/) { my $message; if ($what =~ /^part(\s+(\S+))+$/m) { - my @args = split /\s+/, $what; - print for @args; - $irc->yield(part => @args); + $what =~ s/^part\s+//; + my ($chan_str, $reason) = split /\s+(?!#)/, $what, 2; + my @channels = split /\s+/, $chan_str; + $irc->yield(part => @channels => $reason); } else { $irc->yield(privmsg => $nick => "Syntax: part [partmsg]"); } -- cgit v1.1 From 3684b7b78b3098b55a010a10668621cd26074685 Mon Sep 17 00:00:00 2001 From: David Phillips Date: Thu, 9 Mar 2017 12:39:51 +1300 Subject: Update help message for remote part command --- saxrobot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'saxrobot') diff --git a/saxrobot b/saxrobot index a1d27d5..5854bf5 100755 --- a/saxrobot +++ b/saxrobot @@ -109,7 +109,7 @@ sub irc_msg { my @channels = split /\s+/, $chan_str; $irc->yield(part => @channels => $reason); } else { - $irc->yield(privmsg => $nick => "Syntax: part [partmsg]"); + $irc->yield(privmsg => $nick => "Syntax: part [channel2 ...] [partmsg]"); } } if ($what =~ /^join\s/) { -- cgit v1.1 From 15bdb198c3736d9db6a6e2eec84296922789fd64 Mon Sep 17 00:00:00 2001 From: David Phillips Date: Thu, 9 Mar 2017 12:40:18 +1300 Subject: Add multi-channel join command --- saxrobot | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'saxrobot') diff --git a/saxrobot b/saxrobot index 5854bf5..2f8b08c 100755 --- a/saxrobot +++ b/saxrobot @@ -113,11 +113,12 @@ sub irc_msg { } } if ($what =~ /^join\s/) { - my ($channel) = $what =~ /^join\s+(\S+)$/; - if ($channel) { - $irc->yield(join => $channel); + if ($what =~ /^join(\s+(\S+))+$/) { + $what =~ s/^join\s+//; + my @channels = split /\s+/, $what; + $irc->yield(join => $_) for @channels; } else { - $irc->yield(privmsg => $nick => "Syntax: join "); + $irc->yield(privmsg => $nick => "Syntax: join [channel2 ...]"); } } if ($what =~ /^say\s/) { -- cgit v1.1