From 6b544b58dba095cafd6906d78b70bfd237397439 Mon Sep 17 00:00:00 2001 From: Uko Kokņevičs Date: Sun, 19 Oct 2025 11:12:24 +0300 Subject: Fix lint issues --- src/tg/message-entity.lisp | 51 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 49 insertions(+), 2 deletions(-) (limited to 'src/tg/message-entity.lisp') diff --git a/src/tg/message-entity.lisp b/src/tg/message-entity.lisp index feb3e8f..1a8cd27 100644 --- a/src/tg/message-entity.lisp +++ b/src/tg/message-entity.lisp @@ -1,13 +1,34 @@ ;; SPDX-License-Identifier: EUPL-1.2 ;; SPDX-FileCopyrightText: 2025 Uko Kokņevičs (defpackage :ukkoclot/src/tg/message-entity - (:use :c2cl :iterate :ukkoclot/src/tg/type-macros :ukkoclot/src/tg/message-entity-type :ukkoclot/src/tg/user) + (:documentation "MessageEntity Telegram type") + (:use :c2cl :iterate :ukkoclot/src/enum :ukkoclot/src/tg/type-macros :ukkoclot/src/tg/user) (:export + #:message-entity-type + #:mention + #:hashtag + #:cashtag + #:bot-command + #:url-entity + #:email + #:phone-number + #:bold + #:italic + #:underline + #:strikethrough + #:spoiler + #:blockquote + #:expandable-blockquote + #:code + #:pre + #:text-link + #:text-mention + #:custom-emoji + #:message-entity #:make-message-entity #:message-entity-p #:copy-message-entity - #:message-entity-type #:message-entity-offset #:message-entity-length #:message-entity-url @@ -18,6 +39,27 @@ #:message-entity-extract)) (in-package :ukkoclot/src/tg/message-entity) +(define-enum message-entity-type + (mention "mention") + (hashtag "hashtag") + (cashtag "cashtag") + (bot-command "bot_command") + (url-entity "url") + (email "email") + (phone-number "phone_number") + (bold "bold") + (italic "italic") + (underline "underline") + (strikethrough "strikethrough") + (spoiler "spoiler") + (blockquote "blockquote") + (expandable-blockquote "expandable_blockquote") + (code "code") + (pre "pre") + (text-link "text_link") + (text-mention "text_mention") + (custom-emoji "custom_emoji")) + (define-tg-type message-entity (type message-entity-type) (offset integer) @@ -31,11 +73,16 @@ (error "Some UTF-16 fuckery assumes that system chars are UTF-32")) (defun utf16-width (ch) + "Calculate the size of char in UTF-16 units." + (declare (type character ch)) (if (< (char-code ch) #x10000) 1 2)) (defun message-entity-extract (entity text) + "Extract the text corresponding to the ENTITY from the message text (in TEXT)." + (check-type entity message-entity) + (check-type text string) (with-slots (length offset) entity (if (zerop length) "" -- cgit v1.2.3