我有一个警告脚本,其中您基本上会警告duh,它可以工作,但是每次发送不想要的消息时都会
这是我的剧本
const db = require("quick.db")
execute(message, args, prefix){
if(!message.mentions.users.first())
{
message.channel.send("Please specify a user to warn")
return;
}
if(args[1]){
if(args[1].startsWith("<")){
message.channel.send("You can only warn one person at a time")
return;
}
}
if(!args[1]){
message.channel.send("Please specify a reson for the warn")
return;
}
let warned = message.guild.member(message.mentions.users.first())
message.channel.send(`${message.mentions.users.first}` + "You have been `warned` for " + args.slice(1).join(' '))
if(!db.get(`WCount_${message.guild.id}_${warned}`)){
db.set(`WCount_${message.guild.id}_${warned}`, 1)
}else if(db.get(`WCount_${message.guild.id}_${warned}`)){
db.set(`WCount_${message.guild.id}_${warned}`,db.get(`WCount_${message.guild.id}_${warned}`) + 1 )
}
message.channel.send(`${message.mentions.users.first()}, You now have ${db.get(`WCount_${message.guild.id}_${warned}`)} warns!`)
}
我很确定这是一个错误,但是请确保我在这里问了它 感谢您的帮助
答案 0 :(得分:1)
在编写message.mentions.users.first
的下一行中,您将附加实际函数的代码而不是调用它:
message.channel.send(`${message.mentions.users.first}` + "You have been `warned` for " + args.slice(1).join(' '))
您需要在函数后添加括号以确保调用它:
message.channel.send(`${message.mentions.users.first()}` + "You have been `warned` for " + args.slice(1).join(' '))