aboutsummaryrefslogtreecommitdiff
path: root/operators
diff options
context:
space:
mode:
Diffstat (limited to 'operators')
-rw-r--r--operators/callback_help.zsh47
-rw-r--r--operators/command_donate.zsh10
-rw-r--r--operators/command_help.zsh3
-rw-r--r--operators/inline_donate.zsh22
-rw-r--r--operators/inline_help.zsh14
5 files changed, 62 insertions, 34 deletions
diff --git a/operators/callback_help.zsh b/operators/callback_help.zsh
new file mode 100644
index 0000000..e1a3cce
--- /dev/null
+++ b/operators/callback_help.zsh
@@ -0,0 +1,47 @@
+# Copyright (C) 2024-2026 Maria Lisina
+# Copyright (C) 2024-2026 Danil Lisin
+# SPDX-License-Identifier: Apache-2.0
+
+if [[ -n "${1}" ]]
+then
+ data_name="${1}"
+ check_table=(${help_table[@]})
+ shift
+fi
+
+while [[ ${#check_table} -ge 3 ]]
+do
+ if [[ "${data_name}" == "${check_table[1]}" ]]
+ then
+ break
+ elif [[ "${check_table[1]}" == "${check_table[-3]}" ]]
+ then
+ notification_text="No requested topic found"
+ return
+ fi
+
+ shift 3 check_table
+done
+
+link_preview_options="$(
+ jq --null-input --compact-output \
+ '{"is_disabled": true}'
+)"
+
+if [[ -n "${data_name}" ]]
+then
+ output_text="${check_table[3]}"
+
+ keyboard_text1="Back"
+ keyboard_data1="help"
+
+ reply_markup="$(
+ jq --null-input --compact-output \
+ --arg text1 "${keyboard_text1}" \
+ --arg data1 "${keyboard_data1}" \
+ '{"inline_keyboard": [[{"text": $text1, "callback_data": $data1}]]}'
+ )"
+else
+ output_text="${help_general}"
+ . "${units}/help.zsh"
+fi
diff --git a/operators/command_donate.zsh b/operators/command_donate.zsh
deleted file mode 100644
index fa7518c..0000000
--- a/operators/command_donate.zsh
+++ /dev/null
@@ -1,10 +0,0 @@
-# Copyright (C) 2024-2026 Maria Lisina
-# Copyright (C) 2024-2026 Danil Lisin
-# SPDX-License-Identifier: Apache-2.0
-
-if [[ -n "${nocommand_donate}" ]]
-then
- exit 0
-fi
-
-output_text="${donate_content}"
diff --git a/operators/command_help.zsh b/operators/command_help.zsh
index 2d86678..ec298bc 100644
--- a/operators/command_help.zsh
+++ b/operators/command_help.zsh
@@ -2,7 +2,8 @@
# Copyright (C) 2024-2026 Danil Lisin
# SPDX-License-Identifier: Apache-2.0
-output_text="${help_content}"
+output_text="${help_general}"
+. "${units}/help.zsh"
link_preview_options="$(
jq --null-input --compact-output \
diff --git a/operators/inline_donate.zsh b/operators/inline_donate.zsh
deleted file mode 100644
index a823311..0000000
--- a/operators/inline_donate.zsh
+++ /dev/null
@@ -1,22 +0,0 @@
-# Copyright (C) 2024-2026 Maria Lisina
-# Copyright (C) 2024-2026 Danil Lisin
-# SPDX-License-Identifier: Apache-2.0
-
-if [[ -n "${nocommand_donate}" ]]
-then
- source "${operators}/inline_help.zsh"
- return
-fi
-
-output_title="Donate"
-output_text="${donate_content}"
-output_description="Click to send details"
-
-results="$(
- jq --null-input --compact-output \
- --arg id "${query_id}" \
- --arg title "${output_title}" \
- --arg text "${output_text}" \
- --arg description "${output_description}" \
- '[{"type": "article", "id": $id, "title": $title, "input_message_content": {"message_text": $text, "parse_mode": "HTML"}, "description": $description}]'
-)"
diff --git a/operators/inline_help.zsh b/operators/inline_help.zsh
index 2ac9455..a115de4 100644
--- a/operators/inline_help.zsh
+++ b/operators/inline_help.zsh
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: Apache-2.0
output_title="Sekoohaka Bot"
-output_text="${help_content}"
+output_text="${help_general}"
output_description="Click to send help message"
results="$(
@@ -14,3 +14,15 @@ results="$(
--arg description "${output_description}" \
'[{"type": "article", "id": $id, "title": $title, "input_message_content": {"message_text": $text, "parse_mode": "HTML", "link_preview_options": {"is_disabled": true}}, "description": $description}]'
)"
+
+. "${units}/help.zsh"
+
+if [[ -n "${reply_markup}" ]]
+then
+ results="$(
+ jq --compact-output \
+ --argjson reply_markup "${reply_markup}" \
+ '.[0] += {"reply_markup": $reply_markup}' \
+ <<< "${results}"
+ )"
+fi