diff options
| author | 2025-10-12 22:42:41 +0300 | |
|---|---|---|
| committer | 2025-10-12 22:42:41 +0300 | |
| commit | 542f074a6929ec12b8b42e4cf16ff74523e04602 (patch) | |
| tree | 938b88157954a873fc602f682514b0ba7ea104af /src | |
| parent | Fix enum jsonification (diff) | |
| download | ukkoclot-542f074a6929ec12b8b42e4cf16ff74523e04602.tar.gz ukkoclot-542f074a6929ec12b8b42e4cf16ff74523e04602.tar.xz ukkoclot-542f074a6929ec12b8b42e4cf16ff74523e04602.zip | |
Add message-entity-type enum
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.lisp | 2 | ||||
| -rw-r--r-- | src/tg-types.lisp | 1 | ||||
| -rw-r--r-- | src/tg-types/message-entity-type.lisp | 47 | ||||
| -rw-r--r-- | src/tg-types/message-entity.lisp | 4 |
4 files changed, 51 insertions, 3 deletions
diff --git a/src/main.lisp b/src/main.lisp index 4db0425..f31cd7c 100644 --- a/src/main.lisp +++ b/src/main.lisp | |||
| @@ -133,7 +133,7 @@ | |||
| 133 | 133 | ||
| 134 | (awhen (message-entities msg) | 134 | (awhen (message-entities msg) |
| 135 | (loop for entity across it | 135 | (loop for entity across it |
| 136 | when (and (equal (message-entity-type entity) "bot_command") | 136 | when (and (equal (message-entity-type entity) bot-command) |
| 137 | (= (message-entity-offset entity) 0)) | 137 | (= (message-entity-offset entity) 0)) |
| 138 | do (on-text-command bot msg text (message-entity-extract entity text)))) | 138 | do (on-text-command bot msg text (message-entity-extract entity text)))) |
| 139 | 139 | ||
diff --git a/src/tg-types.lisp b/src/tg-types.lisp index 46d68b9..68c5735 100644 --- a/src/tg-types.lisp +++ b/src/tg-types.lisp | |||
| @@ -19,6 +19,7 @@ | |||
| 19 | :ukkoclot/tg-types/link-preview-options | 19 | :ukkoclot/tg-types/link-preview-options |
| 20 | :ukkoclot/tg-types/message | 20 | :ukkoclot/tg-types/message |
| 21 | :ukkoclot/tg-types/message-entity | 21 | :ukkoclot/tg-types/message-entity |
| 22 | :ukkoclot/tg-types/message-entity-type | ||
| 22 | :ukkoclot/tg-types/parse-mode | 23 | :ukkoclot/tg-types/parse-mode |
| 23 | :ukkoclot/tg-types/photo-size | 24 | :ukkoclot/tg-types/photo-size |
| 24 | :ukkoclot/tg-types/reply-keyboard-markup | 25 | :ukkoclot/tg-types/reply-keyboard-markup |
diff --git a/src/tg-types/message-entity-type.lisp b/src/tg-types/message-entity-type.lisp new file mode 100644 index 0000000..f34c44a --- /dev/null +++ b/src/tg-types/message-entity-type.lisp | |||
| @@ -0,0 +1,47 @@ | |||
| 1 | ;; SPDX-License-Identifier: EUPL-1.2 | ||
| 2 | ;; SPDX-FileCopyrightText: 2025 Uko Kokņevičs <perkontevs@gmail.com> | ||
| 3 | (defpackage :ukkoclot/tg-types/message-entity-type | ||
| 4 | (:use :c2cl :ukkoclot/enum) | ||
| 5 | (:export | ||
| 6 | :message-entity-type | ||
| 7 | :mention | ||
| 8 | :hashtag | ||
| 9 | :cashtag | ||
| 10 | :bot-command | ||
| 11 | :url-entity | ||
| 12 | |||
| 13 | :phone-number | ||
| 14 | :bold | ||
| 15 | :italic | ||
| 16 | :underline | ||
| 17 | :strikethrough | ||
| 18 | :spoiler | ||
| 19 | :blockquote | ||
| 20 | :expandable-blockquote | ||
| 21 | :code | ||
| 22 | :pre | ||
| 23 | :text-link | ||
| 24 | :text-mention | ||
| 25 | :custom-emoji)) | ||
| 26 | (in-package :ukkoclot/tg-types/message-entity-type) | ||
| 27 | |||
| 28 | (define-enum message-entity-type | ||
| 29 | (mention "mention") | ||
| 30 | (hashtag "hashtag") | ||
| 31 | (cashtag "cashtag") | ||
| 32 | (bot-command "bot_command") | ||
| 33 | (url-entity "url") | ||
| 34 | (email "email") | ||
| 35 | (phone-number "phone_number") | ||
| 36 | (bold "bold") | ||
| 37 | (italic "italic") | ||
| 38 | (underline "underline") | ||
| 39 | (strikethrough "strikethrough") | ||
| 40 | (spoiler "spoiler") | ||
| 41 | (blockquote "blockquote") | ||
| 42 | (expandable-blockquote "expandable_blockquote") | ||
| 43 | (code "code") | ||
| 44 | (pre "pre") | ||
| 45 | (text-link "text_link") | ||
| 46 | (text-mention "text_mention") | ||
| 47 | (custom-emoji "custom_emoji")) | ||
diff --git a/src/tg-types/message-entity.lisp b/src/tg-types/message-entity.lisp index a605f23..1eb96cb 100644 --- a/src/tg-types/message-entity.lisp +++ b/src/tg-types/message-entity.lisp | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | ;; SPDX-License-Identifier: EUPL-1.2 | 1 | ;; SPDX-License-Identifier: EUPL-1.2 |
| 2 | ;; SPDX-FileCopyrightText: 2025 Uko Kokņevičs <perkontevs@gmail.com> | 2 | ;; SPDX-FileCopyrightText: 2025 Uko Kokņevičs <perkontevs@gmail.com> |
| 3 | (defpackage :ukkoclot/tg-types/message-entity | 3 | (defpackage :ukkoclot/tg-types/message-entity |
| 4 | (:use :c2cl :iterate :ukkoclot/tg-types/macros :ukkoclot/tg-types/user) | 4 | (:use :c2cl :iterate :ukkoclot/tg-types/macros :ukkoclot/tg-types/message-entity-type :ukkoclot/tg-types/user) |
| 5 | (:export | 5 | (:export |
| 6 | #:message-entity | 6 | #:message-entity |
| 7 | #:make-message-entity | 7 | #:make-message-entity |
| @@ -19,7 +19,7 @@ | |||
| 19 | (in-package :ukkoclot/tg-types/message-entity) | 19 | (in-package :ukkoclot/tg-types/message-entity) |
| 20 | 20 | ||
| 21 | (define-tg-type message-entity | 21 | (define-tg-type message-entity |
| 22 | (type string nil) ;TODO: keywords | 22 | (type message-entity-type) |
| 23 | (offset integer) | 23 | (offset integer) |
| 24 | (length integer) | 24 | (length integer) |
| 25 | (url (or string null) nil) | 25 | (url (or string null) nil) |