Custom Commands

Create custom commands for people in your server to use as they please

Introduction

Custom commands are not the easiest thing to fully understand, so we will explore them a bit in a step by step guide which will teach you to create a couple nice commands.

A couple important things to note upfront:

  1. We will assume the prefix ! for the whole tutorial, if you are using a different prefix, you will need to replace the prefix ! with your own prefix.

  2. There is a limit for how many custom commands can be created on a single server, namely 15. This limit may change in the future, so when in doubt, listen to what the bot says.

  3. Custom commands are, as the name suggests, custom, so they will always only be on one specific server and won't move around servers with the creator.

A simple greeting command

Our first command will be a simple greeting command, which we will call !greet

!ccmd add greet Howdy fella!

The bot should respond with an embed, informing you it has created the greet command running as !greet.

Now, you can run the command by simply using !greet

Renaming commands

Now, we will create a second command, which we would use to greet a new person joining the community, but !greet is already taken from the command we just created, so we have to rename it

!ccmd rename greet howdy

To which the bot will once again give us confirmation that the command has been renamed

Now, you can proceed to create a new greet command following the steps from "A simple greeting command"

Changing command functionality

Changing command functionality is not available out of the box, so instead you have to first delete your old command and then create a new one with the same name. To delete a command, for example our "howdy" command out of the previous section, you would simply execute the following statement

!ccmd remove howdy

Following that, you can then go ahead and create a new command

Role Commands

You obviously can't just create commands that make the bot say things, even though that is great fun in itself, but you can also create lots of other commands, including commands to enable your members to give themselves a role.

There is 3 types of role commands, which work interchangably:

  1. Addrole: When a user uses the command, they get the role, if they didn't have it before

  2. Removerole: When a user uses the command, they lose the role, if they had it before

  3. Togglerole: When a user uses the command, they either get the role, if they didn't have it before, or they lose it, if they had it before

So with those types cleared up, you can now create a command doing any of those 3, though a lot of situations you will probably want to use the togglerole one so people can change their mind later on

!ccmd add twitternotif togglerole:@Twitter Notifiations

In our example, we create a command with which people can toggle a role which the bot would use in the twitter announcement messages. If you want to tag the role, you will need to leave a space between the colon and the at (togglerole: @Twitter) so you get tab completion, the bot will still be able to understand the command, even with that space there. Altearnatively, you can also just type the name (Twitter Notifications) or part of the name for the bot to recognise the role on it's own or, if you have developer mode enabled, copy the role's ID and then just paste that.

Embed

If you want some really fancy messages with a simple command, this is the right place. The usage is very simple, simply create an embed, copy the JSON output and then paste it to create an embed command.

!ccmd add beautifulEmbed embed:{
  "description": "A very beautiful embed",
  "color": 53380
}

You may take out the spaces, but the bot accepts the json over multiple lines just fine, so there is no need to go through the extra steps.

Execute

Last but not least, the execute command. With this powerful tool, you can call any of the global commands like !play, pass in arguments like your dance playlist and you will never have to go to youtube to copy your playlist's link again.

!ccmd add anime execute:play args=https://www.youtube.com/playlist?list=PLg_LXnyvZsrwbm8hTebmhakZ1VEOavKcq

With this command, simply running !anime will queue up a bunch of anime intros for you to listen to. If you don't need to pass any arguments, you can just stop right after the name of the command you want to run.

Additional Commands

A couple commands, that so far went unmentioned:

Enable|Disable You can enable/disable either all custom commands at once, or by giving a command name, enable/disable a single command temporarily

List If you are either just a member looking to use some custom commands or you forgot all of the custom commands, just run !ccmd list for a quick overview of all of the commands available on each server.

This concludes the tutorial on custom commands. Go ahead and see what cool things you can create with this functionality

Last updated