Expand description
Mention-prefixed lightweight command system.
Slash commands and text commands both carry more ceremony (registration,
parsing conventions) than this bot needs. Instead, a message that starts
with a mention of the bot itself is treated as a command. Requiring the
mention to be the first thing in the message is what keeps an incidental
@babyrite buried inside a normal message from being misread as a command.
StructsΒ§
- Shard
Manager Container - TypeMap key for the shared shard manager.
EnumsΒ§
- Command
- A recognized mention-prefixed command.
ConstantsΒ§
- DEBUG_
MISSING_ πSOURCE_ ERROR - Shown when
debughas nothing to display. - MAX_
MESSAGE_ πCONTENT_ CHARS - Discord rejects message content longer than this many characters.
- TRUNCATION_
NOTICE π - Appended to a debug payload that had to be cut to fit
MAX_MESSAGE_CONTENT_CHARS.
FunctionsΒ§
- current_
gateway_ πlatency - Reads the gateway heartbeat latency for the shard handling this context.
- execute
- Executes a parsed command, replying on the channel the request came from.
- execute_
ping π - format_
latency π - parse
- Parses a message into a
Commandif it starts with a mention ofbot_id. - release_
url - Builds the URL for a tagged GitHub release.
- render_
config π - render_
debug π - Renders the
debugreply body. - render_
help π - render_
pong π - Renders the
pingreply body; used for both the initial send and the latency edit so the two stay in sync. - render_
unknown π - render_
version π - sanitize_
code_ πblock - Replaces code fences in
sso they canβt break out of a code block theyβre embedded in. - send_
reply π - Sends
contentas a reply torequest, suppressing link-preview embeds. - strip_
bot_ πmention_ prefix - Strips a leading
<@ID>or<@!ID>mention ofbot_idfromcontent.