Custom Commands
Create your own custom commands with GenBot {Engin} to automate tasks, create interactive responses, and enhance your server experience.
Creating Your First Command
Learn how to create a basic custom command
Creating a custom command is simple. Use the !createcmd
command followed by the name of your command and the response text.
Once created, users can trigger your command by typing !welcome
in any channel where the bot has permission to read and send messages.
Command Management
Command Permissions
By default, anyone can use custom commands, but only administrators can create, edit, or delete them. You can customize these permissions:
Using Variables
Make dynamic commands with variables
Variables allow your commands to display dynamic information. They are enclosed in curly braces {variable}
.
User Variables
-
{user}
- Username -
{user.id}
- User ID -
{user.tag}
- User tag (e.g., User#1234) -
{user.avatar}
- User's avatar URL -
{user.joinedAt}
- When user joined -
{user.roles}
- User's roles
Server Variables
-
{server.name}
- Server name -
{server.id}
- Server ID -
{server.memberCount}
- Member count -
{server.icon}
- Server icon URL -
{server.owner}
- Server owner -
{server.creationDate}
- Creation date
Channel Variables
-
{channel}
- Channel name -
{channel.id}
- Channel ID -
{channel.topic}
- Channel topic -
{channel.type}
- Channel type
Other Variables
-
{date}
- Current date -
{time}
- Current time -
{args}
- Command arguments -
{args[n]}
- Specific argument (n=0,1,2...)
Conditional Logic
Create commands that respond differently based on conditions
Conditional statements allow your commands to perform different actions based on specific conditions.
Conditional Syntax
If Statement
If-Else Statement
If-Else If-Else Statement
Comparison Operators
-
==
- Equal to -
!=
- Not equal to -
>
- Greater than -
<
- Less than
-
>=
- Greater than or equal to -
<=
- Less than or equal to -
contains
- Contains substring -
startswith
- Starts with substring
Advanced Command Example
Combining variables, conditionals, and actions
This example shows a more complex command that implements a simple economy system.
Action Functions
Action functions allow your commands to perform actions beyond just sending messages:
User Actions
-
{give.role:roleName}
- Give a role -
{take.role:roleName}
- Remove a role -
{timeout:duration}
- Timeout a user
Data Actions
-
{set.variable:value}
- Set a variable -
{add.variable:amount}
- Add to a variable -
{subtract.variable:amount}
- Subtract from a variable
Custom Command Cooldowns
You can set cooldowns to prevent command spam:
Example: !cooldown economy 86400
(24-hour cooldown)
Command Embeds
Create rich embeds for your custom commands
Embed properties are separated by semicolons (;) and property values are assigned with equals (=).
Available Embed Properties
-
title
- Embed title -
description
- Embed description -
color
- Color in hex format (#rrggbb) -
footer
- Footer text -
image
- Main image URL -
thumbnail
- Thumbnail image URL -
author
- Author name -
authorIcon
- Author icon URL
Tips & Best Practices
Keep commands simple
Start with basic commands and gradually add complexity as you become more familiar with the syntax.
Test in a private channel
Always test your commands in a private channel before making them available to all users.
Document your commands
Create a help command that explains how to use your custom commands.
Use appropriate permissions
Restrict access to powerful commands to trusted roles only.