我正在创建一个频道message.guild.channels.create
。我该如何找到该频道的消息 ID 并在新创建的频道中发送消息?
message.guild.channels.create(`bug-priority${reportPriority}-${reportStart}`, {
type: 'text',
permissionOverwrites: [{
id: message.author.id,
allow: ['VIEW_CHANNEL', 'SEND_MESSAGES'],
},
{
id: memberRole.id,
deny: ['VIEW_CHANNEL', 'SEND_MESSAGES'],
}]
})
guild.channels.create https://discord.js.org/#/docs/main/stable/class/GuildChannelManager?scrollTo=create返回一个承诺,解决公会频道 https://discord.js.org/#/docs/main/stable/class/GuildChannel。这意味着您可以等待结果,这就是新创建的通道:
const channel = await message.guild.channels.create(`bug-priority${reportPriority}-${reportStart}`, {
type: 'text',
permissionOverwrites: [
{
id: message.author.id,
allow: ['VIEW_CHANNEL', 'SEND_MESSAGES'],
},
{
id: memberRole.id,
deny: ['VIEW_CHANNEL', 'SEND_MESSAGES'],
},
],
});
const { id } = channel;
确保父函数是async
功能。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)