From 797bc62a9b31ab7d063ced4d3285fde1c50fea05 Mon Sep 17 00:00:00 2001 From: Uko Kokņevičs Date: Sat, 18 Oct 2025 07:16:59 +0300 Subject: Add com.dieggsy.f-string, replace simple formats with #f"strings" --- src/inline-bots.lisp | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) (limited to 'src/inline-bots.lisp') diff --git a/src/inline-bots.lisp b/src/inline-bots.lisp index 94ed478..6001cb2 100644 --- a/src/inline-bots.lisp +++ b/src/inline-bots.lisp @@ -1,7 +1,9 @@ ;; SPDX-License-Identifier: EUPL-1.2 ;; SPDX-FileCopyrightText: 2025 Uko Kokņevičs (defpackage :ukkoclot/inline-bots + (:documentation "This package deals with removing unwanted inline bot usage") (:use :c2cl :ukkoclot/config :ukkoclot/tg) + (:import-from :com.dieggsy.f-string :enable-f-strings) (:import-from :log) (:import-from :ukkoclot/tg :send-message :try-delete-message) (:import-from :ukkoclot/state :bot-config :bot-db) @@ -9,10 +11,18 @@ (:export :blacklist-inline-bot :on-inline-bot :whitelist-inline-bot)) (in-package :ukkoclot/inline-bots) +(enable-f-strings) + (defun blacklist-inline-bot (bot inline-bot-id) + "Blacklist the given bot. + +No more messages about deleting its messages will be sent." (db:set-inline-bot-type (bot-db bot) inline-bot-id :blacklisted)) (defun whitelist-inline-bot (bot inline-bot-id) + "Whitelist the given bot. + +Its messages will no longer be deleted." (db:set-inline-bot-type (bot-db bot) inline-bot-id :whitelisted)) (defun on-inline-bot (bot msg via) @@ -26,17 +36,16 @@ (unless (eql ty :blacklisted) ;; Not explicitly blacklisted, notify dev group (let ((whitelist (make-inline-keyboard-button :text "Whitelist" - :callback-data (format nil "bwl:~A" (user-id via)))) + :callback-data #f"bwl:{(user-id via)}")) (blacklist (make-inline-keyboard-button :text "Blacklist" - :callback-data (format nil "bbl:~A" (user-id via))))) - (send-message bot - :chat-id (config-dev-group (bot-config bot)) - :text (format nil "Deleted a message sent via inline bot @~A ~A" - (user-username via) - (user-id via)) - :parse-mode html - :reply-markup (make-inline-keyboard-markup - :inline-keyboard - (make-array '(1 2) - :initial-contents - (list (list whitelist blacklist))))))))))) + :callback-data #f"bbl:{(user-id via)}"))) + (send-message + bot + :chat-id (config-dev-group (bot-config bot)) + :text #f"Deleted a message sent via inline bot @{(user-username via)} {(user-id via)}" + :parse-mode html + :reply-markup (make-inline-keyboard-markup + :inline-keyboard + (make-array '(1 2) + :initial-contents + (list (list whitelist blacklist))))))))))) -- cgit v1.2.3