阻击命令不显示最后删除的消息

时间:2020-05-18 06:16:59

标签: discord.js

所以我在机器人中添加了一个snip命令。在测试时,我会发送一条消息,然后将其删除。我做; snipe,它返回@CasuallyNick,没有最近删除的消息!我知道邮件已删除。

这是代码

const { MessageEmbed } = require('discord.js');
module.exports ={
  config:{
    name: "snipe",
    category: "info",
    description: "Shows the most recent deleted message.",
    usage: ";snipe"
  },
    run: async(client, message, args) => {
        const msg = client.snipes.get(message.channel.id);
        if(!msg) return message.reply("There are no recently deleted messages!");

        const embed = new MessageEmbed()
            .setAuthor(`Deleted by ${msg.author.tag}`, msg.author.displayAvatarURL())
            .setDescription(msg.content);
      message.channel.send(embed)
    }
} 

我不知道这是否与不和谐的新更新有关,或者我是否缺少某些东西!

1 个答案:

答案 0 :(得分:0)

嗯,client.snipes是什么?我猜想它是您制作的Discord.Collection,其他一切看起来都很好,因此必须是您设置client.snipes的值的方式

在您的消息处理程序上,您有这个或类似的东西吗?

client.on("message", msg => {
    client.snipes.set(msg.channel.id, msg);
});