[英]How do i make the bots prefix not case sensitive on discord.js?
我有一個 discord 機器人,它的前綴是“Arm”(空格是),我想讓它不區分大小寫,這樣使用起來就不那么煩人了。
我已經嘗試過這個線程中的解決方案( 有沒有辦法讓我的前綴不區分大小寫(Discord.js) ),但它們似乎沒有用
這是我的一些代碼
const config = require("./config.json");
client.on("message", async message => {
if(message.author.bot) return;
if(!message.content.startsWith(config.prefix)) return;
這是我的配置
{
"token" : "Token here",
"prefix" : "Arm "
}
代替
if(!message.content.startsWith(config.prefix)) return;
和
if(message.content.slice(0, config.prefix.length).toLowerCase() !== config.prefix) return;
並將前綴從"Arm "
更改為"arm "
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.