简体   繁体   English

(discord.js) Select 公会中的特定频道

[英](discord.js) Select specific channel in a guild

I need this to work but I don`t know what the variable selectedchannel to be.我需要这个工作,但我不知道变量 selectedchannel 是什么。 I need to delete all messages on 710069375184404500 channel.我需要删除 710069375184404500 频道上的所有消息。 I am using v12 Discord.js.我正在使用v12 Discord.js。

var selectedchannel =  .....

selectedchannel.messages.fetch({ limit: 99 }).then(messages => { 
     selectedchannel.bulkDelete(messages)
});

You can achieve this by getting the channel first.您可以通过首先获取频道来实现此目的。

var selectedchannel = client.channels.cache.get('710069375184404500')

selectedchannel.messages.fetch({ limit: 99 }).then(messages => { 
     selectedchannel.bulkDelete(messages)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM