Initialize unresolved states

This commit is contained in:
Nick Chambers 2021-11-20 01:48:27 -06:00
parent 549b863493
commit 9705b59226
1 changed files with 5 additions and 5 deletions

10
rowbot
View File

@ -334,10 +334,10 @@ state_resolve() {
fi
fi
if [[ -v config["$1"] ]]; then
ns_config["$1"]=${config["$1"]}
if [[ -v config[$1] ]]; then
ns_config[$1]=${config[$1]}
elif [[ -v DEFAULT ]]; then
ns_config["$1"]=$DEFAULT
ns_config[$1]=$DEFAULT
else
return 1
fi
@ -345,10 +345,11 @@ state_resolve() {
state_put() {
local ns=${NS-global}
declare -gA __rowbot_state_store_"$ns"
# The `ns_config` variable is a reference to an array
# shellcheck disable=SC2178
declare -n ns_config=__rowbot_state_store_"$ns"
ns_config["$1"]=$2
ns_config[$1]=$2
}
state_get() {
@ -743,7 +744,6 @@ on_msg_354_privmagic() {
}
on_msg_396_privmagic() {
config[host]=${msg_args[1]}
NS=irc state_put host "${msg_args[1]}"
}