Skip to main content

Module command

Module command 

Source
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Β§

ShardManagerContainer
TypeMap key for the shared shard manager.

EnumsΒ§

Command
A recognized mention-prefixed command.

ConstantsΒ§

DEBUG_MISSING_SOURCE_ERROR πŸ”’
Shown when debug has 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 Command if it starts with a mention of bot_id.
release_url
Builds the URL for a tagged GitHub release.
render_config πŸ”’
render_debug πŸ”’
Renders the debug reply body.
render_help πŸ”’
render_pong πŸ”’
Renders the ping reply 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 s so they can’t break out of a code block they’re embedded in.
send_reply πŸ”’
Sends content as a reply to request, suppressing link-preview embeds.
strip_bot_mention_prefix πŸ”’
Strips a leading <@ID> or <@!ID> mention of bot_id from content.