Skip to content

Commit

Permalink
Merge staging into main
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored Jun 4, 2023
2 parents ac46321 + e6511a5 commit 5034c03
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/managers/guild-ticket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,17 @@ export default class GuildTicketManager extends DataManager<number, Ticket, Tick
name: channelName,
parent: this.context.ticketsCategory ?? undefined
})
await channel.permissionOverwrites.edit(author, { ViewChannel: true })

// In random occassions on the Twin-Rail server, the permission overwrites
// creation shows up in the audit log but not actually in the channel's
// permissions tab. Force fetch the channel from the API first to make
// sure it was created before creating the permission overwrites.
channel = await this.context.guild.channels.fetch(channel.id, { force: true })
if (channel === null || !channel.isTextBased() || channel.isThread()) {
throw new Error('Could not find channel.')
}

await channel.permissionOverwrites.create(author, { ViewChannel: true })
} catch (err) {
await channel?.delete()
throw err
Expand Down

0 comments on commit 5034c03

Please sign in to comment.