Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/onesoft-sudo/sudobot/llms.txt

Use this file to discover all available pages before exploring further.

Snippets are named, reusable responses that SudoBot delivers when a member triggers them by name. Each snippet can contain text (including full embed directives), file attachments, a list of aliases, and fine-grained access controls covering specific channels, users, roles, and Discord permissions or permission levels. You can maintain a library of FAQs, rule summaries, link collections, or any other content you want to surface on demand without copying and pasting it each time.

How snippets work

SnippetManagerService loads every snippet from the database on startup and caches them in memory keyed by guildId_name (and additionally by each alias). When a message matches a snippet name or alias, the service checks whether the author meets the snippet’s requirements, processes the content through the directive parser to resolve embed blocks, appends any stored attachments, and sends the result. The files are stored on disk under storage/snippets/<guildId>/.

Managing snippets

Use the snippet command group (or its subcommands) to create, update, list, rename, and delete snippets.

Creating a snippet

-snippet add <name> <content>
You can attach files to the command message to include them in the snippet. Attachment URLs are downloaded and stored locally so they remain available even if the original message is deleted.
ParameterDescription
nameA unique name for the snippet within the server.
contentThe text to send. Supports embed directives.
AttachmentsAny files attached to the command message.
Example:
-snippet add rules Read and follow the rules at all times or you will be removed.

Deleting a snippet

-snippet delete <name>
This removes the database record, clears all cache entries (including aliases), and deletes any stored attachment files.

Renaming a snippet

-snippet rename <old-name> <new-name>
The new name must not already exist in the server.

Listing snippets

-snippet list
Returns a list of every snippet registered for the current server.

Updating snippet attributes

-snippet update <name> <attribute> <value>
AttributeValuesDescription
contentAny stringReplaces the snippet’s text content.
randomizetrue / false / 1 / 0 / enabledWhen enabled, picks a random content entry or attachment on each trigger.
levelIntegerMinimum permission level required to trigger the snippet (only when permissions.mode is levels).
perm / permissionSpace-separated permission namesDiscord or system permissions required to trigger the snippet.
pmode / permission_modeAND / ORWhether all listed permissions are required (AND) or at least one (OR).

Access control

Every snippet supports multiple layers of access gating. All conditions must pass for the snippet to be delivered.
Specify which channels can trigger a snippet. When the channels list is non-empty, the snippet only fires from those channels.
-snippet add faq-answer <content>
# Then restrict to a specific channel via the snippet update API or admin command

Randomization

When you set randomize: true on a snippet that has multiple content entries or multiple attachments, SudoBot selects one at random each time the snippet is triggered. This is useful for rotating welcome tips, fun facts, or random quotes.
-snippet update facts randomize true
A snippet with randomize enabled picks one content entry and one attachment at random per trigger. Non-randomized snippets send all attachments at once.

Mentions in snippets

If the message that triggers a snippet @-mentions any users (other than the replied-to user), SudoBot prepends those mentions to the snippet response. This lets members direct the snippet answer at someone specific.

Embed directives in snippet content

Snippet content is passed through the directive parser before sending, so you can embed rich Discord embeds using the bot’s directive syntax.
$embed title="Server Rules" color=0xe74c3c
1. Be respectful.
2. No spam.
3. Follow Discord ToS.
$endembed
Snippet names and aliases are matched case-sensitively in the cache. Make sure members know the exact casing to use when triggering a snippet.

Adding attachments to existing snippets

Use the snippet push-attachment subcommand to add new files to an existing snippet without overwriting its current attachments. Attach the files to the command message before running it.
-snippet push-attachment <name>
The new files are downloaded and appended to the snippet’s attachment list in the database.

Reaction Roles

Assign roles automatically when members react to a message.

Queues & Scheduling

Schedule snippet posts or other commands for a later time.

Build docs developers (and LLMs) love