【问题标题】:I'm trying to delete messages in discord.js我正在尝试删除 discord.js 中的消息
【发布时间】:2020-05-05 16:28:59
【问题描述】:

我正在尝试删除我在 5 秒后发送的消息

msg.channel.send(Embed).then(messageReaction => {
    messageReaction.react("❌");
    messageReaction.react("✔️");
    messageReaction.delete(5000); // This line causes the error

但它不起作用。这是我得到的错误:

> (node:54020) UnhandledPromiseRejectionWarning: TypeError [INVALID_TYPE]: Supplied options is not an object.
    at Message.delete (C:\Users\Josh\Desktop\Discord Bot\node_modules\discord.js\src\structures\Message.js:501:44)  
    at C:\Users\Josh\Desktop\Discord Bot\index.js:45:29
    at processTicksAndRejections (internal/process/task_queues.js:97:5)

【问题讨论】:

    标签: javascript discord discord.js


    【解决方案1】:

    由于 discord.js v12,您需要将超时和原因等选项作为对象传递,因此您的解决方案是:

    messageReaction.delete({ timeout: 5000 });
    

    【讨论】:

    • 还是不行,我试过这个:messageReaction.delete({ timeout: 5000, reason: "a"});还是不行
    • 你收到的是Supplied options is not an object.
    • 是的,我仍然是
    • 你确定你的文件中没有.delete()吗?
    • 是吗?我在别的地方有,让我现在试试
    猜你喜欢
    • 2022-09-28
    • 1970-01-01
    • 2021-08-28
    • 2019-08-07
    • 2018-04-29
    • 2018-08-26
    • 2020-07-04
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多