diff options
| author | Maria Lisina <sekoohaka.sarisan@gmail.com> | 2025-09-22 17:54:30 +0500 |
|---|---|---|
| committer | Maria Lisina <sekoohaka.sarisan@gmail.com> | 2025-09-22 17:54:30 +0500 |
| commit | de0726856974b26813a13203f055f6cbd98b8039 (patch) | |
| tree | cfc7b83ac3359fb4e1886a7ce4fe763b9adb95ea | |
| parent | 53714957d4bed97ecd95005643e7abbd22585df6 (diff) | |
bot: Preload help and donate content
Signed-off-by: Maria Lisina <sekoohaka.sarisan@gmail.com>
| -rwxr-xr-x | bot.zsh | 22 | ||||
| -rw-r--r-- | submodules/command_donate.zsh | 2 | ||||
| -rw-r--r-- | submodules/command_help.zsh | 2 | ||||
| -rw-r--r-- | submodules/inline_donate.zsh | 2 | ||||
| -rw-r--r-- | submodules/inline_help.zsh | 3 | ||||
| -rw-r--r-- | units/help.zsh | 15 |
6 files changed, 25 insertions, 21 deletions
@@ -754,9 +754,29 @@ then esac fi -log_text="Loading lists..." +log_text="Loading files..." . "${units}/log.zsh" +log_text="files/help.txt" +. "${units}/log.zsh" + +help_content="$(sed "s/{version}/${version}/" < "${files}/help.txt")" + +if [[ -n "${nocommand_donate}" ]] +then + help_content="$(sed -e '/^<code>donate.*$/d' -e '/^\/donate.*$/d' <<< "${help_content}")" +fi + +if [[ -n "${nocommand_source}" ]] +then + help_content="$(sed -e '/^\[snkey\].*$/d' -e '/^\/source.*$/d' <<< "${help_content}")" +fi + +log_text="files/donate.txt" +. "${units}/log.zsh" + +donate_content="$(< "${files}/donate.txt")" + log_text="files/aliases.txt" . "${units}/log.zsh" diff --git a/submodules/command_donate.zsh b/submodules/command_donate.zsh index d79c6e4..b79dcbd 100644 --- a/submodules/command_donate.zsh +++ b/submodules/command_donate.zsh @@ -7,4 +7,4 @@ then exit 0 fi -output_text="$(< "${files}/donate.txt")" +output_text="${donate_content}" diff --git a/submodules/command_help.zsh b/submodules/command_help.zsh index 883c553..03005f5 100644 --- a/submodules/command_help.zsh +++ b/submodules/command_help.zsh @@ -2,7 +2,7 @@ # Copyright (C) 2024-2025 Danil Lisin # SPDX-License-Identifier: Apache-2.0 -. "${units}/help.zsh" +output_text="${help_content}" link_preview_options="$( jq --null-input --compact-output \ diff --git a/submodules/inline_donate.zsh b/submodules/inline_donate.zsh index a21856a..7eb0396 100644 --- a/submodules/inline_donate.zsh +++ b/submodules/inline_donate.zsh @@ -9,7 +9,7 @@ then fi output_title="Donate" -output_text="$(< "${files}/donate.txt")" +output_text="${donate_content}" output_description="Click to send details" results="$( diff --git a/submodules/inline_help.zsh b/submodules/inline_help.zsh index 052e0b3..1901c72 100644 --- a/submodules/inline_help.zsh +++ b/submodules/inline_help.zsh @@ -2,9 +2,8 @@ # Copyright (C) 2024-2025 Danil Lisin # SPDX-License-Identifier: Apache-2.0 -. "${units}/help.zsh" - output_title="Sekoohaka Bot" +output_text="${help_content}" output_description="Click to send help message" results="$( diff --git a/units/help.zsh b/units/help.zsh deleted file mode 100644 index ea1e486..0000000 --- a/units/help.zsh +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright (C) 2024-2025 Maria Lisina -# Copyright (C) 2024-2025 Danil Lisin -# SPDX-License-Identifier: Apache-2.0 - -output_text="$(sed "s/{version}/${version}/" < "${files}/help.txt")" - -if [[ -n "${nocommand_donate}" ]] -then - output_text="$(sed -e '/^<code>donate.*$/d' -e '/^\/donate.*$/d' <<< "${output_text}")" -fi - -if [[ -n "${nocommand_source}" ]] -then - output_text="$(sed -e '/^\[snkey\].*$/d' -e '/^\/source.*$/d' <<< "${output_text}")" -fi |
