我的代码是
const { GuildMember, GuildMemberRoleManager, DiscordAPIError } = require("discord.js");
module.exports = {
name: 'jail',
description: "This command mutes a member a member!",
execute(message, args, Discord){
let target = message.mentions.users.first();
let memberTarget = message.guild.members.cache.get(target.id);
if (message.author.id = memberTarget.id) {
message.reply('You cant jail yourself dummy'); return;
} else {
}
if(message.member.permissions.has("KICK_MEMBERS")){
} else {message.channel.send(`Become an admin to use this <@${message.member.user.id}>`); return;}
if(target){
memberTarget.roles.set([])
.then(message => {
memberTarget.roles.add('782623155457753099')})
const NewEmbedMessage = new Discord.MessageEmbed()
.setTitle('Jailing')
.addFields(
{name: `You just jailed`, value: `<@${memberTarget.user.id}>`},
{name: `You can unjail people by doing`, value: `arax unjail @user`},
{name: `unjail command coming soon`, value: null}
)
message.channel.send(NewEmbedMessage)
}else{
message.channel.send(`You coudn't jail that member!`);
}
}
}
问题来了
let target = message.mentions.users.first();
let memberTarget = message.guild.members.cache.get(target.id);
if (message.author.id = memberTarget.id) {
message.reply('You cant jail yourself dummy'); return;
} else {
}
有什么帮助吗?
答案 0 :(得分:0)
在 if 语句中,您必须使用 ==
或 ===
。 =
用于设置变量的值。所以只要改变这个:
if (message.author.id = memberTarget.id)
进入这个:
if (message.author.id === memberTarget.id)