Skip to content
Advertisement

Discord.js | Chatbot responds to command name

so I’m trying to make a chatbot that sends the message after the user types the prefix and the command name. The command works in general but it seems to also take in the command name. I use a command and event handler btw. This is what it looks like:

JavaScript

So when people do a.chat without an arg after that, bot will respond To chat, do a.chat <message> and when people put the message in there it seems to take the chat part in a.chat as a ${message.content} as well. How do I make it so it will ignore a.chat and respond to only the things after it?

Advertisement

Answer

You can join all args array items into one sentence.

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement