Custom Commands
Create your own simple or advanced commands.
Custom commands come in two shapes: simple JSON message lists that need no code, and full Python cogs that can do anything a cog can do.
Simple commands
Quick text-based commands. No coding required, just define your messages in JSON. Files are stored in custom/simple/. Each file is named after the command and contains a JSON array of messages to send.
// custom/simple/greet.json
[
{ "message": "Hello! Welcome to the server."", "delay": 0, "autodelete": 0 },
{ "message": "Read the rules in #rules!"", "delay": 2000, "autodelete": 10000 }
]| Field | Description |
|---|---|
message | The text to send. Supports regular text, markdown, and embed-formatted content. |
delay | Milliseconds to wait before sending this message. Use 0 for an instant send. |
autodelete | Milliseconds after which the message is automatically deleted. Use 0 to keep it permanently. |
/simple <name> or command <name>. The output posts visibly to the channel.Advanced commands
Full Python cogs for complete control over bot behavior. Files are stored in custom/advanced/. Each file is a standard discord.py cog.
# custom/advanced/helper.py
import discord
from discord.ext import commands
class Helper(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command(help="helper » Get help information")
async def helper(self, ctx, topic: str = None):
if topic:
await ctx.send(f"Help on: {topic}")
else:
await ctx.send("Available topics: setup, config, modules")
async def setup(bot):
await bot.add_cog(Helper(bot))getattr(bot, '_selfbot', False) to detect which process the cog is running in, if your code needs to behave differently per-process.Creating an advanced command
- Create the file. Create a new
.pyfile incustom/advanced/. - Define the cog. Write a standard discord.py cog with an
async def setup(bot)entry point. - Add commands. Use
@commands.commandfor commands. The help text should follow the format"name » Description". - Restart. Restart the bot to load the new cog, or use
/custom reloadto reload it without a full restart.
Extra packages
Install additional Python packages that your custom commands or cogs depend on. If your advanced custom commands use external Python libraries (like requests, aiohttp, beautifulsoup4, etc.), those packages need to be installed before the bot starts. You can configure this through the Extra Packages option in the Startup tab.
How to install extra packages
- Identify the package. Check your custom command's imports at the top of the
.pyfile. Any package that is not part of the Python standard library ordiscord.pyneeds to be installed separately. - Add it to Extra Packages. In the Startup tab of your control panel, find the Extra Packages field. Enter the package name exactly as it appears on PyPI (e.g.,
requests,beautifulsoup4,pillow). - Multiple packages. If you need multiple packages, enter them one per line. The installer processes each line sequentially before the bot starts.
- Start the bot. When you start the bot, the control panel installs the listed packages via
pip installbefore launching the selfbot. You will see installation output in the console.
Examples
- Installing requests. If your cog has
import requests, addrequeststo the Extra Packages field. The system runspip install requestsautomatically on startup. - Multiple packages. Enter each package on a separate line:
requests beautifulsoup4 pillow
- Specific versions. You can pin versions using standard pip syntax:
requests==2.31.0orpillow>=10.0.
Command aliases
Create shortcuts for existing commands. Aliases are managed via commands in Discord, so there is no need to edit files manually.
alias create <alias> <cmd>— create a new shortcut. For example,alias create p pinglets you typepinstead ofping.alias remove <alias>— remove an existing shortcut.alias list— show all active aliases.
// custom/alias.json (auto-managed)
{
"p": "ping"",
"h": "help"",
"bal": "balance""
}Security notes
- Only load advanced commands from sources you trust.
- Custom commands run with restricted permissions. Certain system-level operations are blocked for your safety.
- Never share your token or advanced command code with untrusted sources.
Next steps
Continue with Context Menus, Configuration or Modules.