diff options
Diffstat (limited to 'src/tg/message-entity.lisp')
| -rw-r--r-- | src/tg/message-entity.lisp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/tg/message-entity.lisp b/src/tg/message-entity.lisp index 1a8cd27..c87dca0 100644 --- a/src/tg/message-entity.lisp +++ b/src/tg/message-entity.lisp | |||
| @@ -3,6 +3,7 @@ | |||
| 3 | (defpackage :ukkoclot/src/tg/message-entity | 3 | (defpackage :ukkoclot/src/tg/message-entity |
| 4 | (:documentation "MessageEntity Telegram type") | 4 | (:documentation "MessageEntity Telegram type") |
| 5 | (:use :c2cl :iterate :ukkoclot/src/enum :ukkoclot/src/tg/type-macros :ukkoclot/src/tg/user) | 5 | (:use :c2cl :iterate :ukkoclot/src/enum :ukkoclot/src/tg/type-macros :ukkoclot/src/tg/user) |
| 6 | (:import-from :serapeum :->) | ||
| 6 | (:export | 7 | (:export |
| 7 | #:message-entity-type | 8 | #:message-entity-type |
| 8 | #:mention | 9 | #:mention |
| @@ -72,6 +73,7 @@ | |||
| 72 | (unless (= char-code-limit #x110000) | 73 | (unless (= char-code-limit #x110000) |
| 73 | (error "Some UTF-16 fuckery assumes that system chars are UTF-32")) | 74 | (error "Some UTF-16 fuckery assumes that system chars are UTF-32")) |
| 74 | 75 | ||
| 76 | (-> utf16-width (character) (member 1 2)) | ||
| 75 | (defun utf16-width (ch) | 77 | (defun utf16-width (ch) |
| 76 | "Calculate the size of char in UTF-16 units." | 78 | "Calculate the size of char in UTF-16 units." |
| 77 | (declare (type character ch)) | 79 | (declare (type character ch)) |
| @@ -79,6 +81,7 @@ | |||
| 79 | 1 | 81 | 1 |
| 80 | 2)) | 82 | 2)) |
| 81 | 83 | ||
| 84 | (-> message-entity-extract (message-entity string) string) | ||
| 82 | (defun message-entity-extract (entity text) | 85 | (defun message-entity-extract (entity text) |
| 83 | "Extract the text corresponding to the ENTITY from the message text (in TEXT)." | 86 | "Extract the text corresponding to the ENTITY from the message text (in TEXT)." |
| 84 | (check-type entity message-entity) | 87 | (check-type entity message-entity) |