bot: god i am SO stupid
vi did:web:vt3e.cat
Tue, 30 Jun 2026 23:28:39 +0100
2 files changed,
32 insertions(+),
91 deletions(-)
M
apps/bot/src/feats/tickets/actions/lifecycle.ts
→
apps/bot/src/feats/tickets/actions/lifecycle.ts
@@ -359,46 +359,20 @@ components: [actionRow],
flags: ["SuppressNotifications"], }).catch((err) => logger.error(err, `Failed to message closed channel ${channel.id}`)); - channel - .edit({ - permissionOverwrites: [ - { - id: guild.id, - type: OverwriteType.Role, - deny: [PermissionFlagsBits.ViewChannel], - }, - { - id: dbGuild.moderatorRole!, - type: OverwriteType.Role, - allow: [ - PermissionFlagsBits.ViewChannel, - PermissionFlagsBits.SendMessages, - PermissionFlagsBits.AttachFiles, - ], - }, - { - id: client.user!.id, - type: OverwriteType.Member, - allow: [ - PermissionFlagsBits.ViewChannel, - PermissionFlagsBits.ManageChannels, - PermissionFlagsBits.CreatePrivateThreads, - ], - }, + if (channel.type === ChannelType.GuildText) + channel.permissionOverwrites + .edit( + dbSubject.discordId!, { - id: dbSubject.discordId!, - type: OverwriteType.Member, - deny: [ - PermissionFlagsBits.ViewChannel, - PermissionFlagsBits.SendMessages, - PermissionFlagsBits.AttachFiles, - ], + ViewChannel: false, + SendMessages: false, + AttachFiles: false, }, - ], - }) - .catch((err) => - logger.error(err, `Failed to update name/permissions for closed channel ${channel.id}`), - ); + { type: OverwriteType.Member }, + ) + .catch((err) => + logger.error(err, `Failed to update name/permissions for closed channel ${channel.id}`), + ); } (async () => {@@ -500,43 +474,18 @@ const moderators = await getModerators(guild.id);
if (!moderators) throw new PublicError("Failed to reopen ticket: Moderators not found"); if (ticketChannel.type === ChannelType.GuildText) { - ticketChannel - .edit({ - permissionOverwrites: [ - { - id: guild.discordId, - type: OverwriteType.Role, - deny: [PermissionFlagsBits.ViewChannel], - }, - { - id: guild.moderatorRole!, - type: OverwriteType.Role, - allow: [ - PermissionFlagsBits.ViewChannel, - PermissionFlagsBits.SendMessages, - PermissionFlagsBits.AttachFiles, - ], - }, - { - id: client.user!.id, - type: OverwriteType.Member, - allow: [ - PermissionFlagsBits.ViewChannel, - PermissionFlagsBits.ManageChannels, - PermissionFlagsBits.CreatePrivateThreads, - ], - }, - { - id: ticket.subjectActor.discordId!, - type: OverwriteType.Member, - deny: [ - PermissionFlagsBits.ViewChannel, - PermissionFlagsBits.SendMessages, - PermissionFlagsBits.AttachFiles, - ], - }, - ], - }) + ticketChannel.permissionOverwrites + .edit( + ticket.subjectActor.discordId!, + { + ViewChannel: true, + SendMessages: true, + AttachFiles: true, + }, + { + type: OverwriteType.Member, + }, + ) .catch((err) => logger.error( err,
M
apps/bot/src/feats/tickets/commands.ts
→
apps/bot/src/feats/tickets/commands.ts
@@ -366,14 +366,10 @@ content: `Added participant <@${args.user.id}> to the ticket - ${args.reason ?? "no reason provided"}`,
}); if (ticketChannel?.type === ChannelType.GuildText) { - ticketChannel.edit({ - permissionOverwrites: [ - { - id: args.user.id, - type: OverwriteType.Member, - allow: ["ViewChannel", "SendVoiceMessages", "AttachFiles"], - }, - ], + ticketChannel.permissionOverwrites.edit(args.user.id, { + ViewChannel: true, + SendMessages: true, + AttachFiles: true, }); } },@@ -405,14 +401,10 @@ await removeTicketParticipant(ticket.id, participant.id);
await interaction.reply({ content: `<@${args.user.id}> was removed from the ticket` }); if (ticketChannel?.type === ChannelType.GuildText) { - ticketChannel.edit({ - permissionOverwrites: [ - { - id: args.user.id, - type: OverwriteType.Member, - deny: ["ViewChannel", "SendVoiceMessages", "AttachFiles"], - }, - ], + ticketChannel.permissionOverwrites.edit(args.user.id, { + ViewChannel: false, + SendMessages: false, + AttachFiles: false, }); } },