diff --git a/rowbot b/rowbot index 94e528b..89cfb6a 100755 --- a/rowbot +++ b/rowbot @@ -188,6 +188,8 @@ fi if [[ $markov_seed ]]; then if [[ -f $markov_seed ]]; then + debug "loading markov seed file" + declare -A markov_chains enabled read -ra words < "$markov_seed" @@ -200,6 +202,8 @@ if [[ $markov_seed ]]; then markov_chains[$key]+=" ${words[$idx + 2]}" fi done + + debug "markov seeds: %s" "${!markov_chains[*]}" else die "seed file does not exist: %s" "$markov_seed" fi @@ -677,7 +681,7 @@ hook_pre_PRIVMSG_CTCP() { } hook_post_PRIVMSG_markov() { - if [[ ! ${markov_chains@A} ]]; then + if [[ ! -v markov_chains[@] ]]; then return 0 elif [[ ${to:0:1} = \# && ${enabled[$to]} != yes ]]; then return 0 @@ -701,7 +705,7 @@ hook_post_PRIVMSG_markov() { hook_cmd_markov() { local keys idx key str chains next vals val_idx - if [[ ! ${markov_chains@A} ]]; then + if [[ ! -v markov_chains[@] ]]; then if [[ $action = markov ]]; then privmsg "$to" "markov chains are not enabled" fi