Reputation: 21
I have a discord bot that has the prefix "Arm " (Yes with the space) and i would like to make it not case sensitive so its less annoying to use.
I have tried the solutions in this thread (Is there a way to make my prefix non case sensitive (Discord.js)) but they didnt seem to work
This is a bit of my code
const config = require("./config.json");
client.on("message", async message => {
if(message.author.bot) return;
if(!message.content.startsWith(config.prefix)) return;
This is my config
{
"token" : "Token here",
"prefix" : "Arm "
}
Upvotes: 1
Views: 118
Reputation: 6597
Replace
if(!message.content.startsWith(config.prefix)) return;
with
if(message.content.slice(0, config.prefix.length).toLowerCase() !== config.prefix) return;
and change the prefix from "Arm "
to "arm "
.
Upvotes: 1