R16 - A Discord Trick Bot
R16 is a "trick bot" for Discord. It saves snippets of code, which can then be recalled and executed on user-provided input.
1 The Trick Environment
Tricks are stored as plain text, and invoked in a sandbox from racket/sandbox.
The following symbols are available in the trick context:
All symbols from the threading-lib package are available for convenience.
procedure
(make-attachment payload name mime) → any/c
payload : bytes? name : (or/c string? bytes?) mime : (or/c symbol? string? bytes?)
value
message-contents : string?
value
string-args : string?
procedure
(read-args) → (or/c (listof any/c) #f)
procedure
(read-storage type) → any/c
type : (or/c 'guild 'channel 'user)
A trick’s "trick-local storage" can be per-guild, per-channel, or per-user.
This will always return #f for the eval command.
procedure
(write-storage type data) → boolean?
type : (or/c 'guild 'channel 'user) data : any/c
Note that "trick-local storage" is transient and does not currently persist across bot restarts.
Type |
| Size Limit |
guild |
| 64kb |
channel |
| 8kb |
user |
| 2kb |
This will always be a no-op when invoked from the eval command.
procedure
(delete-caller) → void?
value
parent-context : (or/c (hash/c symbol? any/c) #f)