summaryrefslogtreecommitdiff
path: root/src/bot/methods.lisp
diff options
context:
space:
mode:
Diffstat (limited to 'src/bot/methods.lisp')
-rw-r--r--src/bot/methods.lisp46
1 files changed, 33 insertions, 13 deletions
diff --git a/src/bot/methods.lisp b/src/bot/methods.lisp
index 99b6411..7ccc4ad 100644
--- a/src/bot/methods.lisp
+++ b/src/bot/methods.lisp
@@ -2,22 +2,22 @@
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/bot/methods 3(defpackage :ukkoclot/bot/methods
4 (:use :c2cl :ukkoclot/bot/impl :ukkoclot/tg-types :ukkoclot/tg-types/macros) 4 (:use :c2cl :ukkoclot/bot/impl :ukkoclot/tg-types :ukkoclot/tg-types/macros)
5 (:export :answer-callback-query :delete-message :edit-message-text :get-me :get-updates :send-message :set-my-name)) 5 (:export :answer-callback-query :delete-message :send-animation :edit-message-text :get-me :get-updates :send-message :set-my-name))
6(in-package :ukkoclot/bot/methods) 6(in-package :ukkoclot/bot/methods)
7 7
8(define-tg-method (answer-callback-query boolean "answerCallbackQuery" #'identity) 8(define-tg-method (answer-callback-query boolean "answerCallbackQuery")
9 (callback-query-id string) 9 (callback-query-id string)
10 (text (or string null) nil) 10 (text (or string null) nil)
11 (show-alert boolean nil) 11 (show-alert boolean nil)
12 (url (or string null) nil) 12 (url (or string null) nil)
13 (cache-time (or integer null) nil)) 13 (cache-time (or integer null) nil))
14 14
15(define-tg-method (delete-message boolean "deleteMessage" #'identity) 15(define-tg-method (delete-message boolean "deleteMessage")
16 (chat-id (or integer string)) 16 (chat-id (or integer string))
17 (message-id integer)) 17 (message-id integer))
18 18
19;; TODO: Add a way to simply specify :message msg :) 19;; TODO: Add a way to simply specify :message msg :)
20(define-tg-method (edit-message-text message "editMessageText" #'hash->message) 20(define-tg-method (edit-message-text message "editMessageText")
21 (business-connection-id (or string null) nil) 21 (business-connection-id (or string null) nil)
22 (chat-id (or integer string null) nil) 22 (chat-id (or integer string null) nil)
23 (message-id (or integer null) nil) 23 (message-id (or integer null) nil)
@@ -28,7 +28,7 @@
28 (link-preview-options (or link-preview-options null) nil) 28 (link-preview-options (or link-preview-options null) nil)
29 (reply-markup (or inline-keyboard-markup null) nil)) 29 (reply-markup (or inline-keyboard-markup null) nil))
30 30
31(define-tg-method (get-me% user "getMe" #'hash->user :GET)) 31(define-tg-method (get-me% user "getMe" :GET))
32 32
33(defun get-me (bot) 33(defun get-me (bot)
34 (let ((res (get-me% bot))) 34 (let ((res (get-me% bot)))
@@ -36,16 +36,39 @@
36 (setf (bot-username% bot) (user-username res)) 36 (setf (bot-username% bot) (user-username res))
37 res)) 37 res))
38 38
39(define-tg-method (get-my-name bot-name "getMyName" #'hash->bot-name :GET) 39(define-tg-method (get-my-name bot-name "getMyName" :GET)
40 (language-code (or string null) nil)) 40 (language-code (or string null) nil))
41 41
42(define-tg-method (get-updates (array update) "getUpdates" #'parse-update-array) 42(define-tg-method (get-updates (array update) "getUpdates")
43 (offset (or integer null) nil) 43 (offset (or integer null) nil)
44 (limit (or integer null) nil) 44 (limit (or integer null) nil)
45 (timeout (or integer null) nil) 45 (timeout (or integer null) nil)
46 (allowed-updates (or string null) nil)) 46 (allowed-updates (or string null) nil))
47 47
48(define-tg-method (send-message message "sendMessage" #'hash->message) 48(define-tg-method (send-animation message "sendAnimation")
49 (business-connection-id (or string null) nil)
50 (chat-id (or integer string))
51 (message-thread-id (or integer null) nil)
52 (direct-messages-topic-id (or integer null) nil)
53 (animation (or pathname string))
54 (duration (or integer null) nil)
55 (width (or integer null) nil)
56 (height (or integer null) nil)
57 (thumbnail (or pathname string null) nil)
58 (caption (or string null) nil)
59 (parse-mode (or string null) nil)
60 (caption-entities (or (array message-entity) null) nil)
61 (show-caption-above-media boolean nil)
62 (has-spoiler boolean nil)
63 (disable-notification boolean nil)
64 (protect-content boolean nil)
65 (allow-paid-broadcast boolean nil)
66 (message-effect-id (or string null) nil)
67 (suggested-post-parameters (or suggested-post-parameters null) nil)
68 (reply-parameters (or reply-parameters null) nil)
69 (reply-markup (or inline-keyboard-markup reply-keyboard-markup reply-keyboard-remove force-reply null) nil))
70
71(define-tg-method (send-message message "sendMessage")
49 (business-connection-id (or string null) nil) 72 (business-connection-id (or string null) nil)
50 (chat-id (or integer string)) 73 (chat-id (or integer string))
51 (message-thread-id (or integer null) nil) 74 (message-thread-id (or integer null) nil)
@@ -58,12 +81,9 @@
58 (protect-content (or boolean null) nil) 81 (protect-content (or boolean null) nil)
59 (message-effect-id (or string null) nil) 82 (message-effect-id (or string null) nil)
60 (reply-parameters (or reply-parameters null) nil) 83 (reply-parameters (or reply-parameters null) nil)
61 (reply-markup (or inline-keyboard-markup 84 (reply-markup (or inline-keyboard-markup reply-keyboard-markup reply-keyboard-remove force-reply null) nil))
62 ;; TODO: reply-keyboard-markup
63 ;; TODO: reply-keyboard-remove
64 force-reply null) nil))
65 85
66(define-tg-method (set-my-name% boolean "setMyName" #'identity) 86(define-tg-method (set-my-name% boolean "setMyName")
67 (name (or string null) nil) 87 (name (or string null) nil)
68 (language-code (or string null) nil)) 88 (language-code (or string null) nil))
69 89