TheDaann
TheDaann

Reputation: 31

Prefix in commandhandler

When created in a command, this command is called every prefix. So suppose I have created a "help" command, then I can use everything as a prefix.

Examples: !Help ?Help .Help -Help

How do I set that I have a fixed prefix.

(I use a command handler by the way)

Upvotes: 0

Views: 119

Answers (1)

txshiro
txshiro

Reputation: 218

I don't get what you mean. Do you want to use !, /, -, etc.. prefixes for your help command ? Or do you want a one prefix like !?

Based on your answer you want this:

  1. Create a JSON file named config inside your projects
{
  "prefix": "YOUR PREFIX HERE"
}
  1. In your main file do
const { prefix } = require("./config.json");

bot.on('message', message => {

    if (!message.content.startsWith(prefix)) return;

})

Upvotes: 1

Related Questions