diff options
| author | Maria Lisina <sekoohaka.sarisan@gmail.com> | 2025-05-19 18:01:39 +0500 |
|---|---|---|
| committer | Maria Lisina <sekoohaka.sarisan@gmail.com> | 2025-05-19 18:01:39 +0500 |
| commit | 03a7c5b049ff7ba50330c77452575133f84e386e (patch) | |
| tree | f79ff366d099de59631e9936ee58f01a482f08e6 /units/ib_common.zsh | |
| parent | 0ff0b7f0e6b99aedc52c031e476ec85cb6702c97 (diff) | |
bot: Begin porting to Z Shell
Signed-off-by: Maria Lisina <sekoohaka.sarisan@gmail.com>
Diffstat (limited to 'units/ib_common.zsh')
| -rw-r--r-- | units/ib_common.zsh | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/units/ib_common.zsh b/units/ib_common.zsh new file mode 100644 index 0000000..9ee1b09 --- /dev/null +++ b/units/ib_common.zsh @@ -0,0 +1,54 @@ +# Copyright (C) 2024-2025 Maria Lisina +# Copyright (C) 2024-2025 Danil Lisin +# SPDX-License-Identifier: Apache-2.0 + +if [[ -n "${1}" ]] +then + ib_board="${1}" + ib_mode="p" + + . "${units}/ib_config.zsh" + . "${units}/ib_authconfig.zsh" + + if [[ -z "${ib_data_url}" ]] + then + output_title="Invalid arguments" + output_text="Unsupported image board" + notification_text="${output_text}" + + return 0 + fi + + shift +else + output_title="Invalid arguments" + output_text="You must specify the image board" + notification_text="${output_text}" + + return 0 +fi + +if [[ -n "${1}" ]] +then + ib_post_id="${1}" + shift +else + output_title="Invalid arguments" + output_text="You must specify the post ID or the MD5 h.zsh" + notification_text="${output_text}" + + return 0 +fi + +if [[ ${#ib_post_id} -eq 32 ]] +then + ib_query="md5:${ib_post_id}" +elif [[ "${ib_name}" = "Idol Complex" ]] +then + ib_query="id_range:${ib_post_id}" +else + ib_query="id:${ib_post_id}" +fi + +ib_hash="$(printf "%s%s%s" "${user_id}" "${ib_board}" "${ib_post_id}" | enhash)" +. "${units}/ib_file.zsh" |
