From fec434a4e2d0ff65510581e461d87a945d25759a Mon Sep 17 00:00:00 2001 From: Uko Kokņevičs Date: Thu, 23 Oct 2025 10:17:00 +0300 Subject: Use serapeum's -> & defsubst --- src/inline-bots.lisp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/inline-bots.lisp') diff --git a/src/inline-bots.lisp b/src/inline-bots.lisp index 4361adb..f4d8a8d 100644 --- a/src/inline-bots.lisp +++ b/src/inline-bots.lisp @@ -6,6 +6,7 @@ (:import-from :com.dieggsy.f-string :enable-f-strings) (:import-from :conf) (:import-from :log) + (:import-from :serapeum :->) (:import-from :state) (:local-nicknames (:db :ukkoclot/src/db)) (:export :blacklist-inline-bot :on-inline-bot :whitelist-inline-bot)) @@ -13,27 +14,30 @@ (enable-f-strings) +(-> blacklist-inline-bot (integer) (values &optional)) (defun blacklist-inline-bot (inline-bot-id) "Blacklist the given bot. No more messages about deleting its messages will be sent." - (db:set-inline-bot-type (state:db) inline-bot-id :blacklisted)) + (db:set-inline-bot-type (state:db) inline-bot-id db:blacklisted)) +(-> whitelist-inline-bot (integer) (values &optional)) (defun whitelist-inline-bot (inline-bot-id) "Whitelist the given bot. Its messages will no longer be deleted." - (db:set-inline-bot-type (state:db) inline-bot-id :whitelisted)) + (db:set-inline-bot-type (state:db) inline-bot-id db:whitelisted)) +(-> on-inline-bot (message user) boolean) (defun on-inline-bot (msg via) (let ((ty (db:get-inline-bot-type (state:db) (user-id via)))) - (or (eql ty :whitelisted) + (or (eql ty db:whitelisted) (prog1 nil (log:info "Deleting an unallowed inline bot message from ~A ~A" (user-username via) (user-id via)) (try-delete-message msg) - (unless (eql ty :blacklisted) + (unless (eql ty db:blacklisted) ;; Not explicitly blacklisted, notify dev group (let ((whitelist (make-inline-keyboard-button :text "Whitelist" :callback-data #f"bwl:{(user-id via)}")) -- cgit v1.2.3