From 31a972d6825114b1a971e42cdc86e1bd7a9834c3 Mon Sep 17 00:00:00 2001 From: Uko Kokņevičs Date: Sun, 12 Oct 2025 22:14:39 +0300 Subject: Introduce enums and a pretty parse-mode type --- src/main.lisp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/main.lisp') diff --git a/src/main.lisp b/src/main.lisp index 96f73a0..4b05ee2 100644 --- a/src/main.lisp +++ b/src/main.lisp @@ -110,7 +110,7 @@ :text (concatenate 'string "Hello there, " (user-format-name new-member) "! Be on your bestest behaviour now!!") - :parse-mode "HTML" + :parse-mode html :caption-above t :allow-sending-without-reply t))) @@ -138,11 +138,12 @@ (= (message-entity-offset entity) 0)) do (on-text-command bot msg text (message-entity-extract entity text)))) + ;; TODO: Replace this cond with a nicer dispatch. Something like string-case? (cond ((equal text ":3") (reply-message bot msg ">:3")) ((equal text ">:3") - (reply-message bot msg ">:3" :parse-mode "HTML")) + (reply-message bot msg ">:3" :parse-mode html)) ((starts-with-ignore-case text "big ") (let ((the-text (subseq text 4))) @@ -152,7 +153,7 @@ "" (escape-xml (string-upcase the-text)) "") - :parse-mode "HTML")))) + :parse-mode html)))) ((string-equal text "dio cane") (reply-message bot @@ -166,7 +167,7 @@ (reply-message bot msg "idgi")) ((string= text "H") - (reply-message bot msg "Randomly selected reminder that h > H." :parse-mode "HTML")) + (reply-message bot msg "Randomly selected reminder that h > H." :parse-mode html)) ((string-equal text "porco dio") (reply-message bot @@ -216,9 +217,10 @@ (defun on-text-command (bot msg text cmd) (let ((simple-cmd (simplify-cmd bot cmd))) (log-debug "text-command: ~A AKA ~A" cmd simple-cmd) + ;; TODO: Replace this cond with a nicer dispatch. Something like string-case? (acond ((equal simple-cmd "chatid") - (reply-message bot msg (format nil "~A" (message-chat-id msg)) :parse-mode "HTML")) + (reply-message bot msg (format nil "~A" (message-chat-id msg)) :parse-mode html)) ((and (equal simple-cmd "msginfo") (message-reply-to-message msg)) @@ -252,4 +254,4 @@ Send time: ...")) (send-message bot :chat-id (config-dev-group (bot-config bot)) :text msg - :parse-mode "HTML"))) + :parse-mode html))) -- cgit v1.2.3