Add alternick support #15
1 changed files with 40 additions and 0 deletions
40
rowbot
40
rowbot
|
@ -410,6 +410,7 @@ on_sys_exit_998_net() {
|
||||||
|
|
||||||
annoyatron900() {
|
annoyatron900() {
|
||||||
irc_ping "row your bot gently down the stream"
|
irc_ping "row your bot gently down the stream"
|
||||||
|
run_callbacks annoyatron900_
|
||||||
}
|
}
|
||||||
|
|
||||||
on_sys_before_999_annoyatron900() {
|
on_sys_before_999_annoyatron900() {
|
||||||
|
@ -884,6 +885,45 @@ on_init_sysfacts() {
|
||||||
plugin_reg sysfact get_sysfact
|
plugin_reg sysfact get_sysfact
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# alternick tracking
|
||||||
|
|
||||||
|
on_init_alternick() {
|
||||||
|
get_option registered no
|
||||||
|
}
|
||||||
|
|
||||||
|
on_register_alternick() {
|
||||||
|
config[registered]=yes
|
||||||
|
}
|
||||||
|
|
||||||
|
on_msg_433_alternick() {
|
||||||
|
if [[ ${config[registered]} = yes ]]; then
|
||||||
|
log_debug "somebody is already using ${config[nick/]}"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
on_late_msg_433_alternick() {
|
||||||
|
if [[ ${config[registered]} = no ]]; then
|
||||||
|
log_info "using nick ${config[nick]}_"
|
||||||
|
irc_nick "${config[nick]}_"
|
||||||
|
desired_nick=${config[nick]}
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
annoyatron900_alternick() {
|
||||||
|
if [[ $desired_nick ]]; then
|
||||||
|
irc_nick "$desired_nick"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
on_late_msg_NICK_alternick() {
|
||||||
|
if [[ ${msg[from]} = "${config[nick]}" ]]; then
|
||||||
|
desired_nick=
|
||||||
|
log_info "got desired nick!"
|
||||||
|
config[nick]=${msg_args[-1]}
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
###
|
###
|
||||||
# cleanup
|
# cleanup
|
||||||
###
|
###
|
||||||
|
|
Loading…
Reference in a new issue