diff options
author | B. Watson <urchlay@slackware.uk> | 2025-01-09 15:47:23 -0500 |
---|---|---|
committer | B. Watson <urchlay@slackware.uk> | 2025-01-09 15:47:23 -0500 |
commit | e6924def82c4035f9ee520602654c5912184585f (patch) | |
tree | 3b328e86f3f2cc07441c4bbaf9471b7d0b5c47f1 | |
parent | 14a3ab25c9d4d404e544f3b44a4ad5e3bedf5ae6 (diff) | |
download | stupid-irssi-tricks-e6924def82c4035f9ee520602654c5912184585f.tar.gz |
calc.pl: print help for !calc !hex !bin with no args
-rw-r--r-- | calc.pl | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -136,7 +136,12 @@ sub on_public_msg { $prefix = ""; } - if($msg !~ /^!(calc|bin|hex)\s+(.+)/) { + if($msg !~ /^!(calc|bin|hex)(?:\s+(.+))?/) { + return; + } + + if((!defined $2) || (lc $2 eq 'help') || (lc $2 eq '--help')) { + $server->command("msg $target $helpmsg"); return; } @@ -146,11 +151,6 @@ sub on_public_msg { my $input = lc $2; utf8::decode($input); - if($input =~ /^-*h(?:elp)?/) { - $server->command("msg $target $helpmsg"); - return; - } - expand_vars($input, $target); my ($err, $result) = calc($input, $hex, $bin); |