summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrant Shangreaux <shshoshin@protonmail.com>2020-05-01 23:17:51 -0500
committerGrant Shangreaux <shshoshin@protonmail.com>2020-05-01 23:18:29 -0500
commitd5d63415a1641d5082da9bfb7e1a87c12fa43b0f (patch)
treef5661826cb789fffe3c42aecbd733ff303ace6c8
parent884432d544de2925c918f0014b61950e4c8677d0 (diff)
Feature: add a memory slot to granolin that can save arbitrary data
saves in hardcopy. hopefully this is fine
-rw-r--r--granolin.lisp14
1 files changed, 10 insertions, 4 deletions
diff --git a/granolin.lisp b/granolin.lisp
index a5846a9..1511fac 100644
--- a/granolin.lisp
+++ b/granolin.lisp
@@ -58,11 +58,15 @@
:reader ssl
:initarg :ssl
:initform T
- :documentation "Set to nil to use http protocol."))
+ :documentation "Set to nil to use http protocol.")
+ (memory
+ :accessor memory
+ :initform nil
+ :documentation "Generic memory to store anything your bot might want to remember"))
(:documentation "An instance of CLIENT holds the necessary state for
interacting with a Matrix server. If HARDCOPY is supplied, the
INITIALIZE-INSTANCE :after auxilliary method will attempt to populate the
- following slots from a file: HOMESERVER, TIMEOUT, ACCESS-TOKEN, NEXT-BATCH."))
+ following slots from a file: HOMESERVER, TIMEOUT, ACCESS-TOKEN, NEXT-BATCH, MEMORY."))
(defun logged-in-p (client)
"T if the client has an access token."
@@ -82,7 +86,8 @@
:timeout (timeout client)
:user-id (user-id client)
:access-token (access-token client)
- :next-batch (next-batch client))
+ :next-batch (next-batch client)
+ :memory (memory client))
out)))
(defun load-client-state (client &optional fname)
@@ -96,7 +101,8 @@
(setf (slot-value client 'user-id) (getf conf :user-id))
(setf (timeout client) (getf conf :timeout))
(setf (access-token client) (getf conf :access-token))
- (setf (next-batch client) (getf conf :next-batch)))
+ (setf (next-batch client) (getf conf :next-batch))
+ (setf (memory client) (getf conf :memory)))
client)
;; TODO