diff options
| author | 2025-10-12 22:14:39 +0300 | |
|---|---|---|
| committer | 2025-10-12 22:14:39 +0300 | |
| commit | 31a972d6825114b1a971e42cdc86e1bd7a9834c3 (patch) | |
| tree | b40ff73cc76ff88d969b9e12325fd4b17e68dadc /src/main.lisp | |
| parent | msginfo: pretty print the response (diff) | |
| download | ukkoclot-31a972d6825114b1a971e42cdc86e1bd7a9834c3.tar.gz ukkoclot-31a972d6825114b1a971e42cdc86e1bd7a9834c3.tar.xz ukkoclot-31a972d6825114b1a971e42cdc86e1bd7a9834c3.zip | |
Introduce enums and a pretty parse-mode type
Diffstat (limited to 'src/main.lisp')
| -rw-r--r-- | src/main.lisp | 14 |
1 files changed, 8 insertions, 6 deletions
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 @@ | |||
| 110 | :text (concatenate 'string "Hello there, " | 110 | :text (concatenate 'string "Hello there, " |
| 111 | (user-format-name new-member) | 111 | (user-format-name new-member) |
| 112 | "! Be on your bestest behaviour now!!") | 112 | "! Be on your bestest behaviour now!!") |
| 113 | :parse-mode "HTML" | 113 | :parse-mode html |
| 114 | :caption-above t | 114 | :caption-above t |
| 115 | :allow-sending-without-reply t))) | 115 | :allow-sending-without-reply t))) |
| 116 | 116 | ||
| @@ -138,11 +138,12 @@ | |||
| 138 | (= (message-entity-offset entity) 0)) | 138 | (= (message-entity-offset entity) 0)) |
| 139 | do (on-text-command bot msg text (message-entity-extract entity text)))) | 139 | do (on-text-command bot msg text (message-entity-extract entity text)))) |
| 140 | 140 | ||
| 141 | ;; TODO: Replace this cond with a nicer dispatch. Something like string-case? | ||
| 141 | (cond ((equal text ":3") | 142 | (cond ((equal text ":3") |
| 142 | (reply-message bot msg ">:3")) | 143 | (reply-message bot msg ">:3")) |
| 143 | 144 | ||
| 144 | ((equal text ">:3") | 145 | ((equal text ">:3") |
| 145 | (reply-message bot msg "<b>>:3</b>" :parse-mode "HTML")) | 146 | (reply-message bot msg "<b>>:3</b>" :parse-mode html)) |
| 146 | 147 | ||
| 147 | ((starts-with-ignore-case text "big ") | 148 | ((starts-with-ignore-case text "big ") |
| 148 | (let ((the-text (subseq text 4))) | 149 | (let ((the-text (subseq text 4))) |
| @@ -152,7 +153,7 @@ | |||
| 152 | "<b>" | 153 | "<b>" |
| 153 | (escape-xml (string-upcase the-text)) | 154 | (escape-xml (string-upcase the-text)) |
| 154 | "</b>") | 155 | "</b>") |
| 155 | :parse-mode "HTML")))) | 156 | :parse-mode html)))) |
| 156 | 157 | ||
| 157 | ((string-equal text "dio cane") | 158 | ((string-equal text "dio cane") |
| 158 | (reply-message bot | 159 | (reply-message bot |
| @@ -166,7 +167,7 @@ | |||
| 166 | (reply-message bot msg "idgi")) | 167 | (reply-message bot msg "idgi")) |
| 167 | 168 | ||
| 168 | ((string= text "H") | 169 | ((string= text "H") |
| 169 | (reply-message bot msg "<code>Randomly selected reminder that h > H.</code>" :parse-mode "HTML")) | 170 | (reply-message bot msg "<code>Randomly selected reminder that h > H.</code>" :parse-mode html)) |
| 170 | 171 | ||
| 171 | ((string-equal text "porco dio") | 172 | ((string-equal text "porco dio") |
| 172 | (reply-message bot | 173 | (reply-message bot |
| @@ -216,9 +217,10 @@ | |||
| 216 | (defun on-text-command (bot msg text cmd) | 217 | (defun on-text-command (bot msg text cmd) |
| 217 | (let ((simple-cmd (simplify-cmd bot cmd))) | 218 | (let ((simple-cmd (simplify-cmd bot cmd))) |
| 218 | (log-debug "text-command: ~A AKA ~A" cmd simple-cmd) | 219 | (log-debug "text-command: ~A AKA ~A" cmd simple-cmd) |
| 220 | ;; TODO: Replace this cond with a nicer dispatch. Something like string-case? | ||
| 219 | (acond | 221 | (acond |
| 220 | ((equal simple-cmd "chatid") | 222 | ((equal simple-cmd "chatid") |
| 221 | (reply-message bot msg (format nil "<code>~A</code>" (message-chat-id msg)) :parse-mode "HTML")) | 223 | (reply-message bot msg (format nil "<code>~A</code>" (message-chat-id msg)) :parse-mode html)) |
| 222 | 224 | ||
| 223 | ((and (equal simple-cmd "msginfo") | 225 | ((and (equal simple-cmd "msginfo") |
| 224 | (message-reply-to-message msg)) | 226 | (message-reply-to-message msg)) |
| @@ -252,4 +254,4 @@ Send time: ...")) | |||
| 252 | (send-message bot | 254 | (send-message bot |
| 253 | :chat-id (config-dev-group (bot-config bot)) | 255 | :chat-id (config-dev-group (bot-config bot)) |
| 254 | :text msg | 256 | :text msg |
| 255 | :parse-mode "HTML"))) | 257 | :parse-mode html))) |