From cce7ef88dc33877b7cefa12d0fdbccf4d40598e7 Mon Sep 17 00:00:00 2001 From: Kyle Date: Mon, 17 Aug 2020 19:51:38 -0400 Subject: [PATCH] New function and module to allow users in the allowList to change the bot's nick --- bot.sh | 2 ++ functions.sh | 7 +++++++ modules/nick/nick.sh | 8 ++++++++ 3 files changed, 17 insertions(+) create mode 100755 modules/nick/nick.sh diff --git a/bot.sh b/bot.sh index 298f6fb..02ba138 100755 --- a/bot.sh +++ b/bot.sh @@ -6,6 +6,8 @@ if [ "$(whoami)" = "root" ]; then fi [ -f functions.sh ] && source functions.sh [ -f bot.cfg ] && source bot.cfg +export allowList +export ignoreList input=".botinput" close_bot() { diff --git a/functions.sh b/functions.sh index fd87028..5c92f8f 100644 --- a/functions.sh +++ b/functions.sh @@ -11,6 +11,13 @@ shift echo -en "${msg}$@\r\n" | tee -a "$input" } +nick() +{ + local msg="NICK $1" +shift +echo -en "${msg}\r\n" | tee -a "$input" +} + reply() { shift diff --git a/modules/nick/nick.sh b/modules/nick/nick.sh new file mode 100755 index 0000000..79b3e9a --- /dev/null +++ b/modules/nick/nick.sh @@ -0,0 +1,8 @@ +[ -f functions.sh ] && source functions.sh + +user=$1 +shift +shift +if [[ "$user" =~ $allowList ]]; then + nick $1 +fi