From b4c1f66e1631f40d8a7d0f80523470677a91381f Mon Sep 17 00:00:00 2001 From: Uko Kokņevičs Date: Fri, 10 Oct 2025 12:30:46 +0300 Subject: Bunch of changes - Animations - Rewrite of serialization deserialization - Bunch of new TG types --- src/bot/advanced.lisp | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'src/bot/advanced.lisp') 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 @@ ;; SPDX-FileCopyrightText: 2025 Uko Kokņevičs (defpackage :ukkoclot/bot/advanced (:use :c2cl :ukkoclot/bot/impl :ukkoclot/bot/methods :ukkoclot/tg-types) - (:export :bot-id :bot-username :reply-message)) + (:export :bot-id :bot-username :reply-animation :reply-message :try-delete-message)) (in-package :ukkoclot/bot/advanced) (defun bot-id (bot) @@ -17,6 +17,20 @@ (get-me bot) (bot-username% bot)))) +;; TODO: Some kind of caching for files? +(defun reply-animation (bot msg animation &key allow-sending-without-reply text parse-mode caption-above) + (send-animation bot + :chat-id (message-chat-id msg) + :animation animation + :caption text + :parse-mode parse-mode + :show-caption-above-media caption-above + :reply-parameters + (make-reply-parameters + :allow-sending-without-reply allow-sending-without-reply + :message-id (message-id msg) + :chat-id (message-chat-id msg)))) + (defun reply-message (bot msg text &key parse-mode allow-sending-without-reply) (send-message bot :chat-id (message-chat-id msg) @@ -27,3 +41,14 @@ :allow-sending-without-reply allow-sending-without-reply :message-id (message-id msg) :chat-id (message-chat-id msg)))) + +(defun try-delete-message (bot msg) + (handler-case + (delete-message bot + :chat-id (message-chat-id msg) + :message-id (message-id msg)) + (error () + (handler-case + (reply-animation bot msg #P"blob/do-not.mp4" + :allow-sending-without-reply nil) + (error () nil))))) -- cgit v1.2.3