blob: 5360f16c5d5d191f84b5c50a0c8cb56765d1b733 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
;; SPDX-License-Identifier: EUPL-1.2
;; SPDX-FileCopyrightText: 2025 Uko Kokņevičs <perkontevs@gmail.com>
(defpackage :ukkoclot/src/tg/get-me
(:documentation "getMe Telegram method")
(:use :c2cl :ukkoclot/src/tg/method-macros :ukkoclot/src/tg/user)
(:import-from :serapeum :->)
(:import-from :state)
(:export :bot-id :bot-username :get-me))
(in-package :ukkoclot/src/tg/get-me)
(define-tg-method (get-me% user :GET))
(-> get-me () user)
(defun get-me ()
"getMe Telegram method"
(let ((me (get-me%)))
(setf (state:id%) (user-id me))
(setf (state:username%) (user-username me))
me))
(-> bot-id () integer)
(defun bot-id ()
"Get the bot's ID, this memoizes the result"
(or (state:id%)
(progn
(get-me)
(state:id%))))
(-> bot-username () string)
(defun bot-username ()
"Get the bot's username, this memoizes the result"
(or (state:username%)
(progn
(get-me)
(state:username%))))
|