Home / Features / Custom Commands

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

!createcmd welcome Welcome to the server, {user}! Enjoy your stay.

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

!listcmds - View all custom commands
!editcmd [name] [new response] - Edit an existing command
!delcmd [name] - Delete a custom command

Command Permissions

By default, anyone can use custom commands, but only administrators can create, edit, or delete them. You can customize these permissions:

!cmdperm create @role - Set which roles can create commands
!cmdperm use [command] @role - Set which roles can use a specific command

Using Variables

Make dynamic commands with variables

!createcmd serverinfo Server Name: {server.name} Members: {server.memberCount} Created: {server.creationDate}

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

!createcmd role {if:args==admin}{give.role:admin}{else}You need to specify a valid role!{endif}

Conditional statements allow your commands to perform different actions based on specific conditions.

Conditional Syntax

If Statement

{if:condition}content{endif}

If-Else Statement

{if:condition}content if true{else}content if false{endif}

If-Else If-Else Statement

{if:condition1}content if condition1 true{else if:condition2}content if condition2 true{else}content if all false{endif}

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

!createcmd economy {if:args==balance} Your balance: {user.balance} coins {else if:args==daily} {if:user.claimedDaily} You already claimed your daily reward! {else} {add.balance:100} You received 100 coins! {set.claimedDaily:true} {endif} {else} Available commands: !economy balance !economy daily {endif}

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:

!cooldown [command] [time in seconds]

Example: !cooldown economy 86400 (24-hour cooldown)

Command Embeds

Create rich embeds for your custom commands

{embed:title=My Embed Title;description=This is a description;color=#ff0000;footer=Footer text;thumbnail={user.avatar}}

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

1

Keep commands simple

Start with basic commands and gradually add complexity as you become more familiar with the syntax.

2

Test in a private channel

Always test your commands in a private channel before making them available to all users.

3

Document your commands

Create a help command that explains how to use your custom commands.

4

Use appropriate permissions

Restrict access to powerful commands to trusted roles only.