;; SPDX-License-Identifier: EUPL-1.2 ;; SPDX-FileCopyrightText: 2025 Uko Kokņevičs (defpackage :ukkoclot/src/state (:documentation "Holds the global state") (:use :c2cl) (:import-from :com.dieggsy.f-string :enable-f-strings) (:import-from :conf :bot-token) (:export #:bot #:make-bot #:bot-p #:copy-bot #:bot-db #:bot-base-uri #:bot-power-on #:bot-username% #:bot-id%)) (in-package :ukkoclot/src/state) (enable-f-strings) (defstruct (bot (:constructor make-bot%)) (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 (db) (let ((base-uri #f"https://api.telegram.org/bot{(bot-token)}/")) (make-bot% :db db :base-uri base-uri)))