如何让我的机器人在一段时间后删除频道?

How do I make my bot delete a channel after some time has passed?

我有点迷路了,如何让我的机器人在一段时间后删除频道?比如3秒。

代码:

        if((message.author.bot) && (message.channel.name.includes('closed')) && (message.author.id === "id")){
      for (let embed of message.embeds) {
         if(embed.description.includes('custom msg')){   
            setTimeout(function(){ 
              message.channel.delete
            }, 3000); 
          }
        }
      }

今天好好休息!

测试了这段代码,它对我有用,试试看它的作用

// just verifying here, please double check the statement below becuase that is what is going to trigger the bot

// if a bot sends a message in a channel whose name includes 'closed' and that bots id is "id" then 
if (message.author.bot && message.channel.name.includes('closed') && message.author.id === "id") {
    message.channel.messages.fetch().then(messages => {
        messages.forEach(message => {
            const embed = message.embed[0]
            if (embed) {
                if (embed.description.includes('custom msg')) {
                    setTimeout(() => {
                        message.channel.delete()
                    }, 3000)
                }
            }
        })
    })
}

如果 if 语句上面的注释有误并需要调整,请告诉我,我们可以修复它