diff options
| author | 2025-10-10 07:13:19 +0300 | |
|---|---|---|
| committer | 2025-10-10 07:13:19 +0300 | |
| commit | 5e6b7a1248e175e8c550ce9feed7745292f17bfe (patch) | |
| tree | 90ad160fe8388a7568c78d2e2deb237b225b5e5e /src/bot/advanced.lisp | |
| parent | Initial commit (diff) | |
| download | ukkoclot-5e6b7a1248e175e8c550ce9feed7745292f17bfe.tar.gz ukkoclot-5e6b7a1248e175e8c550ce9feed7745292f17bfe.tar.xz ukkoclot-5e6b7a1248e175e8c550ce9feed7745292f17bfe.zip | |
Add a helper reply-message function
Diffstat (limited to 'src/bot/advanced.lisp')
| -rw-r--r-- | src/bot/advanced.lisp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/bot/advanced.lisp b/src/bot/advanced.lisp new file mode 100644 index 0000000..a6ad9ba --- /dev/null +++ b/src/bot/advanced.lisp | |||
| @@ -0,0 +1,29 @@ | |||
| 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/bot/impl :ukkoclot/bot/methods :ukkoclot/tg-types) | ||
| 5 | (:export :bot-id :bot-username :reply-message)) | ||
| 6 | (in-package :ukkoclot/bot/advanced) | ||
| 7 | |||
| 8 | (defun bot-id (bot) | ||
| 9 | (or (bot-id% bot) | ||
| 10 | (progn | ||
| 11 | (get-me bot) | ||
| 12 | (bot-id% bot)))) | ||
| 13 | |||
| 14 | (defun bot-username (bot) | ||
| 15 | (or (bot-username% bot) | ||
| 16 | (progn | ||
| 17 | (get-me bot) | ||
| 18 | (bot-username% bot)))) | ||
| 19 | |||
| 20 | (defun reply-message (bot msg text &key parse-mode allow-sending-without-reply) | ||
| 21 | (send-message bot | ||
| 22 | :chat-id (message-chat-id msg) | ||
| 23 | :text text | ||
| 24 | :parse-mode parse-mode | ||
| 25 | :reply-parameters | ||
| 26 | (make-reply-parameters | ||
| 27 | :allow-sending-without-reply allow-sending-without-reply | ||
| 28 | :message-id (message-id msg) | ||
| 29 | :chat-id (message-chat-id msg)))) | ||