So I'm overwriting permissions for a ticket feature and its giving me an error
Cannot read property 'channel' of undefined
with this line of code:
message.guild.channels.create(`create-${message.author.id}`, { type: 'text' }).then(c => {
c.message.channel.overwritePermissions([
{
id: "@everyone",
deny: ['SEND_MESSAGES', 'READ_MESSAGES'],
}
]);
c.message.channel.overwritePermissions([
{
id: message.author.id,
allow: ['SEND_MESSAGES', 'READ_MESSAGES'],
},
]);
it has something to do with the second line and the 8th line (AKA)
c.message.channel.overwritePermissions([
X2
If I remove message from this property
c.message.channel.overwritePermissions([
I get this error
TypeError: Cannot read property 'overwritePermissions' of undefined
Channel
has no message
property, nor another channel
property.
message.guild.channels.create(`create-${message.author.id}`, {
type: 'text', permissionOverwrites: [
{
id: '@everyone',
deny: ['SEND_MESSAGES', 'VIEW_CHANNEL']
},
{
id: message.author.id,
allow: ['SEND_MESSAGES', 'VIEW_CHANNEL']
}
]
})
Note that there is no permission called READ_MESSAGES
. Instead, use VIEW_CHANNEL
.