blob: 16d1da963e1f3e63785388cfaa4b2dbe54d69087 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# 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
}
|