# modules/inviteadmin.bash # # Lets a user control joins/parts if [ -z "$IRCBOT_MODULE" ]; then printf "error: %s is a module for ircbot.bash and should not be run separately\n" "$0" exit 1 fi if [ -z "$INVITEADMIN_ADMIN" ]; then printf "module %s requires a configured admin\n" "$0" exit 1 fi inviteadmin_nick="$(parse_source_nick "$INVITEADMIN_ADMIN")" # notify the admin about the invite on_self_invite() { # args: $1 - source, $2 - channel sendmsg PRIVMSG "$inviteadmin_nick" "invited to $2 by $1" } # join/part channels if the admin commands it on_dm() { # args: $1 - source, $2 - message if [[ $1 == "$INVITEADMIN_ADMIN" ]]; then read -r cmd chan <<< "$2" case "$cmd" in join) sendmsg JOIN "$chan" ;; part) sendmsg PART "$chan" ;; esac fi }