【发布时间】:2022-01-23 07:28:32
【问题描述】:
晚上好,我在 v13 中制作了我的机器人,但在禁止我想要的人之前,我无法让我的机器人在 dm 中发送消息,但没有成功,所以我来寻求帮助,如果你想要,这里是代码。 :
const discord = module.require("discord.js");
module.exports = {
name: "ban",
category: "moderation",
description: "Ban anyone with one shot whithout knowing anyone xD",
usage: "ban <@user> <reason>",
userPerms: ["BAN_MEMBERS"],
botPerms: ["EMBED_LINKS", "BAN_MEMBERS"],
run: async (client, message, args) => {
let reason = args.slice(1).join(" ");
if (!reason) reason = "Unspecified";
const target = message.mentions.members.first() || message.guild.users.cache.get(args[0]);
if (!target) {
return message.channel.send(
`**${message.author.username}**, Please mention the person who you want to ban.`
);
}
if (target.id === message.author.id) {
return message.channel.send(
`**${message.author.username}**, You can not ban yourself!`
);
}
if (target.id === message.guild.ownerId) {
return message.channel.send("You cannot Ban The Server Owner");
}
let embed = new discord.MessageEmbed()
.setTitle("Action : Ban")
.setDescription(`Banned ${target} (${target.id})\nReason: ${reason}`)
.setColor("#ff2050")
.setThumbnail(target.avatarURL)
.setFooter(`Banned by ${message.author.tag}`);
await message.guild.bans.create(target, {
reason: reason
}).then(() => {
message.channel.send({ embeds: [embed] });
});
},
};
【问题讨论】:
标签: node.js discord discord.js bots