Creating Custom Commands
A guide on how to create your own custom command with Discommand!
Last updated
A guide on how to create your own custom command with Discommand!
Last updated
Creating custom commands is pretty simple, though here's a guide on how to create one, as well as some examples to get you started.
The basics of a custom command work in a guild-id:command-name:command-response way. The guild ID is handled automatically, and is used for mapping which command goes where, and prevents duplicates, the command name is what you enter after the prefix to run the command, and of course, the command response is what the command responds with, which can be literally anything, since the bot has the same message capabilities of a normal user.
Creating commands is pretty simple too, with a few built-in commands (web dashboard coming soon!).
This will be in a step-by-step fashion. Lets get started by creating a simple hello world command. Type >create hello Hello world! :wave:
into your text channel. If it succeeds, you'll get a nice message. Then, type >hello
into the channel, and you'll get your response!
So, you made a nice simple command, awesome. Say you don't like this hello world command though. How do you get rid of it? Easy! Just type >delete hello
.
No more response, no more command. Its that easy.
Discommand has some cool things called placeholders. These can be used to get real data on use of a command, making your custom commands way more smarter and fancier. Here's an example of an upvote
command used in the support server:
As you can see, then {author.mention}
placeholder I used was replaced with my mention when I used the command. This is dynamic as well, anyone using the command will get their own mention.
(thanks Bob Jones#0172, you were a life saver there!)
And thats all for now on how to make your own custom commands.
In the future, I aim to add embeds, a web dashboard for quicker command creation, command descriptions (so the list command is more smarter), as well as some options such as replying to bots or not, sending the reply in DMs or even deleting the command message. -ThatTonybo