aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbot.zsh2
-rw-r--r--operators/command_hash.zsh2
-rw-r--r--units/ib_hash.zsh5
-rw-r--r--units/ib_name.zsh12
4 files changed, 8 insertions, 13 deletions
diff --git a/bot.zsh b/bot.zsh
index f31734a..55bae70 100755
--- a/bot.zsh
+++ b/bot.zsh
@@ -33,6 +33,8 @@ units="${dir}/units"
users="${dir}/users"
offset=-1
+board_table=(a d i s k y)
+
data_table=(
safebooru "Safebooru"
danbooru "Danbooru"
diff --git a/operators/command_hash.zsh b/operators/command_hash.zsh
index d8bb677..530fee7 100644
--- a/operators/command_hash.zsh
+++ b/operators/command_hash.zsh
@@ -28,7 +28,7 @@ do
done
done
-for ib_board in {a..z}
+for ib_board in ${board_table[@]}
do
source "${units}/ib_config.zsh"
source "${units}/ib_hash.zsh" &
diff --git a/units/ib_hash.zsh b/units/ib_hash.zsh
index aed087c..c53ffa0 100644
--- a/units/ib_hash.zsh
+++ b/units/ib_hash.zsh
@@ -8,11 +8,6 @@ ib_mode="p"
source "${units}/ib_config.zsh"
source "${units}/ib_authconfig.zsh"
-if [[ -z "${ib_data_url}" ]]
-then
- exit
-fi
-
ib_query="md5:${ib_post_md5}"
ib_hash="$(sha1sum <<< "${user_id}${ib_board}${ib_query}" | cut -d ' ' -f 1)"
diff --git a/units/ib_name.zsh b/units/ib_name.zsh
index 3a8346d..13d901f 100644
--- a/units/ib_name.zsh
+++ b/units/ib_name.zsh
@@ -22,22 +22,20 @@ fi
ib_reply_name="$(sed '1!d' <<< "${reply_text}")"
-for ib_board in {a..z} 0
+for ib_board in ${board_table[@]}
do
source "${units}/ib_config.zsh"
if [[ "${ib_reply_name}" == "${ib_name}" ]]
then
break
+ elif [[ "${ib_board}" == "${board_table[-1]}" ]]
+ then
+ output_text="Could not find Image Board in replied message"
+ return
fi
done
-if [[ "${ib_board}" == "0" ]]
-then
- output_text="Could not find Image Board in replied message"
- return
-fi
-
ib_post_id="$(sed '2!d' <<< "${reply_text}" | cut -d ' ' -f 2)"
if [[ -z "${ib_post_id}" ]]