Snippets¶
The Snippets module allows you to create, manage, and use code snippets in your Discord server. Snippets are reusable pieces of text or code that can be quickly accessed by name, and you can create aliases to point to existing snippets.
Snippets are useful for storing frequently used code, text, or responses that you want to quickly access. You can create snippets with custom names, create aliases that point to existing snippets, and manage your snippet library.
Snippets are server-specific and can be locked by moderators to prevent unauthorized editing.
Commands¶
| Command | Aliases | Description | Documentation |
|---|---|---|---|
$createsnippet |
cs |
Create a new snippet or alias | Details |
$snippet |
s |
View and use a snippet | Details |
$snippets |
ls |
List all available snippets | Details |
$snippetinfo |
si |
Get detailed information about a snippet | Details |
$editsnippet |
es |
Edit an existing snippet | Details |
$deletesnippet |
ds |
Delete a snippet | Details |
$togglesnippetlock |
tsl |
Lock or unlock a snippet | Details |
Common Use Cases¶
Creating Code Snippets¶
Store frequently used code blocks or canned responses for quick access.
Steps:
- Use the
$createsnippetcommand with a unique name and the content. - Access your snippet anytime using the
$snippetcommand.
Example:
$createsnippet python-example print('Hello, World!')
$snippet python-example
Creating Aliases¶
Create shortcuts to existing snippets to make them easier to remember or faster to type.
Steps:
- Use the
$createsnippetcommand with a new name. - Provide the name of an existing snippet as the content (this automatically creates an alias).
Example:
$createsnippet short-name python-example
Managing Snippets¶
Organize, review, and protect your snippet library.
Steps:
- List all snippets with
$snippetsto browse the library. - Check metadata (creator, date, lock status, usage count) with
$snippetinfo. - Edit snippets with
$editsnippetwhen content needs updating. - Protect important snippets using
$togglesnippetlockto prevent unauthorized edits.
Example:
$snippets
$snippetinfo python-example
$editsnippet python-example print('Hello, Updated World!')
$togglesnippetlock python-example
Permissions¶
Bot Permissions¶
Tux requires the following permissions for this module:
- Send Messages - Required for command responses
- Embed Links - Required for rich snippet displays
- Manage Messages - Required for locking and managing snippet responses
User Permissions¶
Snippet commands are available to all users by default, but snippet creation and editing may be restricted to specific permission ranks based on server configuration.
Permission System
Tux uses a dynamic permission system. Configure command permissions via /config commands or see the Permission Configuration guide.
Related Documentation¶
- Snippets Feature – Configuration and role-based access
- Permission Configuration
- Admin Configuration Guide