【问题标题】:Snipe Command not shwoing last deleted message狙击命令不显示最后删除的消息
【发布时间】:2020-05-18 14:24:42
【问题描述】:

所以我在我的机器人中添加了一个 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)
    }
} 

我不知道这是否与不和谐的新更新有关,或者我是否遗漏了什么!

【问题讨论】:

  • Client.snipes 在 Discord.js 中似乎不存在,你指的是什么? (Client docs)

标签: discord.js


【解决方案1】:

那么,client.snipes 是什么?我猜它是您制作的Discord.Collection,其他一切看起来都很好,所以这一定是您设置client.snipes 值的方式

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

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

【讨论】:

    猜你喜欢
    • 2019-03-01
    • 1970-01-01
    • 1970-01-01
    • 2020-11-23
    • 2021-04-21
    • 2021-01-30
    • 2021-02-27
    • 2021-10-26
    • 1970-01-01
    相关资源
    最近更新 更多