diff options
| -rwxr-xr-x | bot.zsh | 9 | ||||
| -rw-r--r-- | operators/command_hash.zsh | 9 | ||||
| -rw-r--r-- | units/ib_hash.zsh | 2 | ||||
| -rw-r--r-- | units/ib_name.zsh | 11 |
4 files changed, 21 insertions, 10 deletions
@@ -33,7 +33,14 @@ units="${dir}/units" users="${dir}/users" offset=-1 -board_table=(a d i s k y) +board_table=( + a "Safebooru" + d "Danbooru" + i "Idol Complex" + s "Sankaku Channel" + k "Konachan" + y "Yandere" +) data_table=( safebooru "Safebooru" diff --git a/operators/command_hash.zsh b/operators/command_hash.zsh index 530fee7..3ced3c9 100644 --- a/operators/command_hash.zsh +++ b/operators/command_hash.zsh @@ -28,21 +28,21 @@ do done done -for ib_board in ${board_table[@]} +while [[ ${#board_table} -ge 2 ]] do - source "${units}/ib_config.zsh" source "${units}/ib_hash.zsh" & wait if ! [[ -f "${ib_post}" ]] then + shift 2 board_table continue fi ib_id="$(< "${ib_post}")" - keyboard_text1="${ib_name}" - keyboard_query1="post ${ib_board} ${ib_id}" + keyboard_text1="${board_table[2]}" + keyboard_query1="post ${board_table[1]} ${ib_id}" reply_markup="$( jq --compact-output \ @@ -54,6 +54,7 @@ do )" keyboard_offset=$((keyboard_offset + 0.5)) + shift 2 board_table done if [[ -f "${ib_sample}" ]] diff --git a/units/ib_hash.zsh b/units/ib_hash.zsh index a9b4ff6..3e14a19 100644 --- a/units/ib_hash.zsh +++ b/units/ib_hash.zsh @@ -3,6 +3,8 @@ # SPDX-License-Identifier: Apache-2.0 rm -f "${ib_post}" + +ib_board="${board_table[1]}" ib_mode="p" source "${units}/ib_config.zsh" diff --git a/units/ib_name.zsh b/units/ib_name.zsh index 808029f..5f780f2 100644 --- a/units/ib_name.zsh +++ b/units/ib_name.zsh @@ -22,18 +22,19 @@ fi ib_reply_name="$(sed '1!d' <<< "${reply_text}")" -for ib_board in ${board_table[@]} +while [[ ${#board_table} -ge 2 ]] do - source "${units}/ib_config.zsh" - - if [[ "${ib_reply_name}" == "${ib_name}" ]] + if [[ "${ib_reply_name}" == "${board_table[2]}" ]] then + ib_board="${board_table[1]}" break - elif [[ "${ib_board}" == "${board_table[-1]}" ]] + elif [[ "${board_table[1]}" == "${board_table[-2]}" ]] then output_text="Could not find Image Board in replied message" return fi + + shift 2 board_table done ib_post_id="$(sed '2!d' <<< "${reply_text}" | cut -F 2)" |
