blob: e7d41a16f0c6afaa90b9d53ba56f74b611224d00 (
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
|
;; 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 :state)
(:export :bot-id :bot-username :get-me))
(in-package :ukkoclot/src/tg/get-me)
(define-tg-method (get-me% user :GET))
(defun get-me ()
"getMe Telegram method"
(let ((me (get-me%)))
(setf (state:id%) (user-id me))
(setf (state:username%) (user-username me))
me))
(defun bot-id ()
"Get the bot's ID, this memoizes the result"
(or (state:id%)
(progn
(get-me)
(state:id%))))
(defun bot-username ()
"Get the bot's username, this memoizes the result"
(or (state:username%)
(progn
(get-me)
(state:username%))))
|