USAGE 1 USAGE
2
3 (asdf:load-system :trilemabot)
4 (defvar *bot*)
5 (setq *bot*
6 (trlb:make-trilemabot
7 "chat.freenode.net" 6667 "nick" "password" "prefix" '("#trilema")))
8
9 ;; connect in separate thread, returning thread
10 (ircbot:ircbot-connect-thread *bot*)
11
12 ;;;; 1. Self-voicing
13
14 ;; ask for n !!up OTPs from deedbot
15 (loop for i from 1 to n do
16 (trlb:trilemabot-send-up *bot*)
17 (sleep 0.5))
18
19 ;; get messages received from deedbot
20 (trlb:trilemabot-inbox *bot*)
21
22 ;; add decrypted !!up OTPs
23 (trlb:trilemabot-add-voice-otps *bot*
24 "decrypted-otp-1" "decrypted-otp2" ... "decrypted-otpn")
25
26 ;; get the list of !!up OTPs
27 (trlb:trilemabot-voice-otp-stash *bot*)
28
29 ;; save !!up OTPs to disk
30 (trlb:trilemabot-save-voice-otp-stash *bot* "voice-otps.sexp")
31
32 ;; self-voice
33 (trlb:trilemabot-voice *bot*)
34
35 ;; if `voice-otp-stash' is not empty, the bot will automatically
36 ;; self-voice on reconnect
37 (ircbot:ircbot-reconnect *bot*)
38
39 ;;;; 2. Prefixed command handling
40
41 ;; Example: echo received message
42 (trlb:trilemabot-define-cmd (:echo bot message target args)
43 (let ((recipient (if (string= target (ircbot:ircbot-nick bot))
44 (cl-irc:source message) target)))
45 (ircbot:ircbot-send-message bot recipient args)))
46
47 ;; For a more detailed example, see dictbot.