diff options
| author | 2025-10-10 12:30:46 +0300 | |
|---|---|---|
| committer | 2025-10-10 12:30:46 +0300 | |
| commit | b4c1f66e1631f40d8a7d0f80523470677a91381f (patch) | |
| tree | ef3aa478cfca05dc27e0777f9c42813d4268e54a /src/bot/advanced.lisp | |
| parent | Add a helper reply-message function (diff) | |
| download | ukkoclot-b4c1f66e1631f40d8a7d0f80523470677a91381f.tar.gz ukkoclot-b4c1f66e1631f40d8a7d0f80523470677a91381f.tar.xz ukkoclot-b4c1f66e1631f40d8a7d0f80523470677a91381f.zip | |
Bunch of changes
- Animations
- Rewrite of serialization deserialization
- Bunch of new TG types
Diffstat (limited to 'src/bot/advanced.lisp')
| -rw-r--r-- | src/bot/advanced.lisp | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/src/bot/advanced.lisp b/src/bot/advanced.lisp index a6ad9ba..241b04d 100644 --- a/src/bot/advanced.lisp +++ b/src/bot/advanced.lisp | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | ;; SPDX-FileCopyrightText: 2025 Uko Kokņevičs <perkontevs@gmail.com> | 2 | ;; SPDX-FileCopyrightText: 2025 Uko Kokņevičs <perkontevs@gmail.com> |
| 3 | (defpackage :ukkoclot/bot/advanced | 3 | (defpackage :ukkoclot/bot/advanced |
| 4 | (:use :c2cl :ukkoclot/bot/impl :ukkoclot/bot/methods :ukkoclot/tg-types) | 4 | (:use :c2cl :ukkoclot/bot/impl :ukkoclot/bot/methods :ukkoclot/tg-types) |
| 5 | (:export :bot-id :bot-username :reply-message)) | 5 | (:export :bot-id :bot-username :reply-animation :reply-message :try-delete-message)) |
| 6 | (in-package :ukkoclot/bot/advanced) | 6 | (in-package :ukkoclot/bot/advanced) |
| 7 | 7 | ||
| 8 | (defun bot-id (bot) | 8 | (defun bot-id (bot) |
| @@ -17,6 +17,20 @@ | |||
| 17 | (get-me bot) | 17 | (get-me bot) |
| 18 | (bot-username% bot)))) | 18 | (bot-username% bot)))) |
| 19 | 19 | ||
| 20 | ;; TODO: Some kind of caching for files? | ||
| 21 | (defun reply-animation (bot msg animation &key allow-sending-without-reply text parse-mode caption-above) | ||
| 22 | (send-animation bot | ||
| 23 | :chat-id (message-chat-id msg) | ||
| 24 | :animation animation | ||
| 25 | :caption text | ||
| 26 | :parse-mode parse-mode | ||
| 27 | :show-caption-above-media caption-above | ||
| 28 | :reply-parameters | ||
| 29 | (make-reply-parameters | ||
| 30 | :allow-sending-without-reply allow-sending-without-reply | ||
| 31 | :message-id (message-id msg) | ||
| 32 | :chat-id (message-chat-id msg)))) | ||
| 33 | |||
| 20 | (defun reply-message (bot msg text &key parse-mode allow-sending-without-reply) | 34 | (defun reply-message (bot msg text &key parse-mode allow-sending-without-reply) |
| 21 | (send-message bot | 35 | (send-message bot |
| 22 | :chat-id (message-chat-id msg) | 36 | :chat-id (message-chat-id msg) |
| @@ -27,3 +41,14 @@ | |||
| 27 | :allow-sending-without-reply allow-sending-without-reply | 41 | :allow-sending-without-reply allow-sending-without-reply |
| 28 | :message-id (message-id msg) | 42 | :message-id (message-id msg) |
| 29 | :chat-id (message-chat-id msg)))) | 43 | :chat-id (message-chat-id msg)))) |
| 44 | |||
| 45 | (defun try-delete-message (bot msg) | ||
| 46 | (handler-case | ||
| 47 | (delete-message bot | ||
| 48 | :chat-id (message-chat-id msg) | ||
| 49 | :message-id (message-id msg)) | ||
| 50 | (error () | ||
| 51 | (handler-case | ||
| 52 | (reply-animation bot msg #P"blob/do-not.mp4" | ||
| 53 | :allow-sending-without-reply nil) | ||
| 54 | (error () nil))))) | ||