diff options
Diffstat (limited to 'src/bot/advanced.lisp')
| -rw-r--r-- | src/bot/advanced.lisp | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/src/bot/advanced.lisp b/src/bot/advanced.lisp deleted file mode 100644 index 3763151..0000000 --- a/src/bot/advanced.lisp +++ /dev/null | |||
| @@ -1,55 +0,0 @@ | |||
| 1 | ;; SPDX-License-Identifier: EUPL-1.2 | ||
| 2 | ;; SPDX-FileCopyrightText: 2025 Uko Kokņevičs <perkontevs@gmail.com> | ||
| 3 | (defpackage :ukkoclot/bot/advanced | ||
| 4 | (:use :c2cl :ukkoclot/tg) | ||
| 5 | (:import-from :ukkoclot/state :bot-id% :bot-username%) | ||
| 6 | (:export :bot-id :bot-username :reply-animation :reply-message :try-delete-message)) | ||
| 7 | (in-package :ukkoclot/bot/advanced) | ||
| 8 | |||
| 9 | (defun bot-id (bot) | ||
| 10 | (or (bot-id% bot) | ||
| 11 | (progn | ||
| 12 | (get-me bot) | ||
| 13 | (bot-id% bot)))) | ||
| 14 | |||
| 15 | (defun bot-username (bot) | ||
| 16 | (or (bot-username% bot) | ||
| 17 | (progn | ||
| 18 | (get-me bot) | ||
| 19 | (bot-username% bot)))) | ||
| 20 | |||
| 21 | ;; TODO: Some kind of caching for files? | ||
| 22 | (defun reply-animation (bot msg animation &key allow-sending-without-reply text parse-mode caption-above) | ||
| 23 | (send-animation bot | ||
| 24 | :chat-id (message-chat-id msg) | ||
| 25 | :animation animation | ||
| 26 | :caption text | ||
| 27 | :parse-mode parse-mode | ||
| 28 | :show-caption-above-media caption-above | ||
| 29 | :reply-parameters | ||
| 30 | (make-reply-parameters | ||
| 31 | :allow-sending-without-reply allow-sending-without-reply | ||
| 32 | :message-id (message-id msg) | ||
| 33 | :chat-id (message-chat-id msg)))) | ||
| 34 | |||
| 35 | (defun reply-message (bot msg text &key parse-mode allow-sending-without-reply) | ||
| 36 | (send-message bot | ||
| 37 | :chat-id (message-chat-id msg) | ||
| 38 | :text text | ||
| 39 | :parse-mode parse-mode | ||
| 40 | :reply-parameters | ||
| 41 | (make-reply-parameters | ||
| 42 | :allow-sending-without-reply allow-sending-without-reply | ||
| 43 | :message-id (message-id msg) | ||
| 44 | :chat-id (message-chat-id msg)))) | ||
| 45 | |||
| 46 | (defun try-delete-message (bot msg) | ||
| 47 | (handler-case | ||
| 48 | (delete-message bot | ||
| 49 | :chat-id (message-chat-id msg) | ||
| 50 | :message-id (message-id msg)) | ||
| 51 | (error () | ||
| 52 | (handler-case | ||
| 53 | (reply-animation bot msg #P"blob/do-not.mp4" | ||
| 54 | :allow-sending-without-reply nil) | ||
| 55 | (error () nil))))) | ||