summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbill-auger <mr.j.spam.me@gmail.com>2018-08-06 14:57:48 -0400
committerbill-auger <mr.j.spam.me@gmail.com>2018-09-06 13:35:20 +0000
commite67668805d384e8a2f515cddf4d1cff9fecb1e4d (patch)
tree33ef0aade6807fcdae179274849580bc583bb46a
parent7da6933f89f5980320c6409fe4f13f6b467c6156 (diff)
ask for op upon join
-rw-r--r--bot_settings.sh4
-rw-r--r--lib/channels.sh7
2 files changed, 10 insertions, 1 deletions
diff --git a/bot_settings.sh b/bot_settings.sh
index d823999..fdeba3d 100644
--- a/bot_settings.sh
+++ b/bot_settings.sh
@@ -179,6 +179,10 @@ config_transport_dir="transport"
# Non-Module Misc features #
############################
+# should we always ask to be channel op upon join
+readonly BECOME_OP_ON_JOIN=1
+# which channels are we allowed to be op
+readonly OP_CHANNELS='#parabola'
# nick to use for internally injected messages (e.g. redmine changes)
readonly INJECT_NICK='01234-PBOT-BCDEF%' # invalid IRC nick
diff --git a/lib/channels.sh b/lib/channels.sh
index 512cfcb..7fbcc3c 100644
--- a/lib/channels.sh
+++ b/lib/channels.sh
@@ -118,8 +118,13 @@ channels_handle_kick() {
#---------------------------------------------------------------------
channels_handle_join() {
local whojoined=
+ local channel=$2
parse_hostmask_nick "$1" 'whojoined'
if [[ $whojoined == $server_nick_current ]]; then
- channels_add "$2"
+ channels_add "$channel"
+
+ if (( $BECOME_OP_ON_JOIN )) && [[ " $OP_CHANNELS " =~ " $channel " ]]
+ then send_msg 'ChanServ' "OP $channel"
+ fi
fi
}