commit c1d46d983f1f3f98d79a0437d2c3f8795a685c14
parent 05563ea5eef163af881458fc02b22343b261c48a
Author: mys <>
Date: Tue, 8 Jun 2021 20:36:44 +0200
Fix bug when rot message is empty
Diffstat:
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/botreply b/botreply
@@ -87,7 +87,7 @@ case "$1" in
# Display help message
*"PRIVMSG "*":$nick: help"|*"PRIVMSG "*":$nick, help")
channel=$(echo "$1" | awk '{print $3}')
- echo "PRIVMSG $channel :usage: $nick: [<input-lang>:<output-lang>] [<input-lang>:phoneme] [<input-lang>:ipa] [:morse] [:rot<n>] [:arot<n>] [:1337] <text>"
+ echo "PRIVMSG $channel :usage: $nick: [ <input-lang>:<output-lang> | <input-lang>:phoneme | <input-lang>:ipa | :morse | :rot<n> | :arot<n> | :1337 ] <text>"
;;
# Display ipa
@@ -113,9 +113,7 @@ case "$1" in
# Encode rot
*"PRIVMSG "*":$nick: :rot"*|*"PRIVMSG "*":$nick, :rot"*)
num=$(echo "$1" | sed "s/.*:$nick[,:] :rot\([-+]\{0,1\}[0-9]\{1,\}\).*/\1/")
- exp=$(echo "$1" | sed "s/.*:$nick[,:] :rot[-+]\{0,1\}[0-9]\{1,\} //")
- echo $num
- echo $exp
+ exp=$(echo "$1" | sed "s/.*:$nick[,:] :rot[-+]\{0,1\}[0-9]\{1,\}//")
ret=$(rot "$num" "$exp")
form_reply "$1" "$ret"
;;
@@ -123,7 +121,7 @@ case "$1" in
# Encode arot
*"PRIVMSG "*":$nick: :arot"*|*"PRIVMSG "*":$nick, :arot"*)
num=$(echo "$1" | sed "s/.*:$nick[,:] :arot\([-+]\{0,1\}[0-9]\{1,\}\).*/\1/")
- exp=$(echo "$1" | sed "s/.*:$nick[,:] :arot[-+]\{0,1\}[0-9]\{1,\} //")
+ exp=$(echo "$1" | sed "s/.*:$nick[,:] :arot[-+]\{0,1\}[0-9]\{1,\}//")
ret=$(arot "$num" "$exp")
form_reply "$1" "$ret"
;;