I am creating a channel with message.guild.channels.create
. How do I go about then finding the message id of that channel and sending a message in the newly created channel?
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
returns a promise that resolves to a GuildChannel. It means you can await the result and that's the newly created channel:
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;
Make sure that the parent function is an async
fucntion.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments