不和谐机器人可以返回并对所有旧消息做出反应吗

时间:2021-03-29 17:24:37

标签: javascript node.js json discord discord.js

这将用于图像投票系统。我在想: 10 秒后,我的机器人拒绝向@everyone 发送消息,但同时对所有已发送的消息做出反应,因此人们可以为每张图片投票。 (ADD_REACTIONS 一直处于关闭状态)

setTimeout(() => {
      var channel = client.channels.cache.get(`823225045231992892`) 
      
        channel.send('You cant send more messages, but you can vote now!');
        channel.overwritePermissions(
          [
            {
              id: channel.guild.id,
              allow: ["SEND_MESSAGES"],
            },
          ],
          "Deny access to send messages"
        );
    }, 0);

1 个答案:

答案 0 :(得分:1)

猜猜这就是你想做的

//Guessing the channel is catched as Channel
Channel.send("The reactable message").then(msg => {
    msg.react("100000000001").then( () => { //Put the available Emoji ID
        setTimeout( () => {
            msg.reactions.cache.get("100000000001").remove().cache(console.log);
            msg.react("❌"); //the unavailable Emoji
        },1000);
    })
});