简体   繁体   English

为什么清除命令不起作用? (无错误)discord.js

[英]Why does the purge command not work? (no errors) discord.js

Bot #1 (Eulogist Official Bot) Bot #1(Eulogist 官方 Bot)

机器人#1(不工作)

Bot #2 (Prosser Recoveries) Bot #2(Prosser 回收)

bot2 #2(工作)

So here we have two of my bots.所以这里我们有两个我的机器人。 the purge command is:清除命令是:

const { MessageEmbed } = require("discord.js");
const config = require("../../config.json");
module.exports = {
  config: {
    name: "purge",
    description: "Purges messages",
    usage: " ",
    category: "moderation",
    accessableby: "Moderators",
    aliases: ["clear", "prune"],
  },
  run: async (prosser, message, args) => {
    message.delete();
    let hrps = new MessageEmbed()
      .setTitle(`**Command:** ${config["Bot_Info"].prefix}purge`)
      .setDescription(
        `**Aliases:** /prune, /clear\n**Description:** Delete a number of messages from a channel. (limit 100)\n**Usage:**\n${config["Bot_Info"].prefix}purge 20\n${config["Bot_Info"].prefix}bc`
      )
      .setColor();
      let done = new MessageEmbed()
      .setDescription(`Purged \`${args[0]}\` message(s). ✅`)
      .setColor(`${config["Embed_Defaults"].EmbedColour}`);
    if (!message.member.hasPermission("MANAGE_MESSAGES"))
      return message.reply("Doesn't look like you can do that");
    if (!args[0]) return message.channel.send(hrps);
    message.channel.bulkDelete(args[0]).then(() => {
      message.channel
        .send(done)
        .then((msg) => msg.delete({ timeout: 1000 }));
    });
  },
};

These two bots have the same purge command but only one of the bots command works.这两个机器人具有相同的清除命令,但只有一个机器人命令有效。 (i've checked perms & invited to different servers). (我已经检查了烫发并被邀请到不同的服务器)。

Has anyone got a solution for this?有没有人对此有解决方案?

Fixed.固定的。 All i done was moved the js file to a different command folder and it suddenly worked.我所做的只是将 js 文件移动到不同的命令文件夹,然后它突然起作用了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM