blob: ea1aa033de061faaee5b4418f7a1d29cbbd93a76 (
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
|
;; SPDX-License-Identifier: EUPL-1.2
;; SPDX-FileCopyrightText: 2025 Uko Kokņevičs <perkontevs@gmail.com>
(defpackage :ukkoclot/bot/impl
(:use :c2cl :iterate :ukkoclot/config)
(:export
:bot :bot-p :make-bot
:bot-config :bot-db :bot-base-uri :bot-power-on :bot-username% :bot-id%))
(in-package :ukkoclot/bot/impl)
(defstruct (bot (:constructor make-bot%))
(config (error "No value given for config") :read-only t)
(db (error "No value given for DB") :read-only t)
(base-uri (error "No value given for base-uri") :read-only t)
(power-on t :type boolean)
(username% nil :type (or string null))
(id% nil :type (or integer null)))
(defun make-bot (config db)
(let ((base-uri (concatenate 'string
"https://api.telegram.org/bot"
(config-bot-token config) "/")))
(make-bot% :config config :db db :base-uri base-uri)))
|