Allow the bot to keep trying for the desired nick
This commit is contained in:
parent
89068edf10
commit
0afef8ef68
1 changed files with 29 additions and 0 deletions
29
rowbot
29
rowbot
|
@ -274,6 +274,7 @@ on_001() {
|
||||||
|
|
||||||
ping_pid=$!
|
ping_pid=$!
|
||||||
nick=${params[0]}
|
nick=${params[0]}
|
||||||
|
registered=yes
|
||||||
who "$nick" %%uht,42
|
who "$nick" %%uht,42
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -375,6 +376,14 @@ on_376() {
|
||||||
debug %s "${params[1]}"
|
debug %s "${params[1]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
on_433() {
|
||||||
|
info "somebody is already using %s" "${params[1]}"
|
||||||
|
|
||||||
|
if [[ $registered = no ]]; then
|
||||||
|
nick "${nick}_"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
on_473() {
|
on_473() {
|
||||||
error "%s: %s" "${params[1]}" "${params[2]}"
|
error "%s: %s" "${params[1]}" "${params[2]}"
|
||||||
}
|
}
|
||||||
|
@ -469,6 +478,11 @@ who() {
|
||||||
|
|
||||||
ping-handler() {
|
ping-handler() {
|
||||||
ping "row your bot gently down the stream"
|
ping "row your bot gently down the stream"
|
||||||
|
|
||||||
|
if [[ $keep_trying = yes ]]; then
|
||||||
|
info "trying for %s again" "$desired_nick"
|
||||||
|
nick "$desired_nick"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
trap ping-handler ALRM
|
trap ping-handler ALRM
|
||||||
|
@ -664,6 +678,20 @@ hook_post_PRIVMSG_control_panel() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hook_post_433_alternick() {
|
||||||
|
if [[ -z $desired_nick && $registered = no ]]; then
|
||||||
|
desired_nick=${params[1]}
|
||||||
|
keep_trying=yes
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
hook_post_NICK_alternick() {
|
||||||
|
if [[ ${params[0]} = $desired_nick ]]; then
|
||||||
|
keep_trying=no
|
||||||
|
info "obtained nick %s" "$desired_nick"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
###
|
###
|
||||||
# driver
|
# driver
|
||||||
###
|
###
|
||||||
|
@ -673,6 +701,7 @@ trap ping-handler ALRM
|
||||||
if [[ $reload = yes ]]; then
|
if [[ $reload = yes ]]; then
|
||||||
privmsg "$RELOAD_TO" done.
|
privmsg "$RELOAD_TO" done.
|
||||||
else
|
else
|
||||||
|
registered=no
|
||||||
nick "$nick"
|
nick "$nick"
|
||||||
user "$ident" "$realname"
|
user "$ident" "$realname"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue