From 8b06d7e2b42ac5f41b284e35834d29a97d199466 Mon Sep 17 00:00:00 2001 From: theimperious1 Date: Sat, 9 Nov 2024 05:35:20 -0500 Subject: [PATCH 1/2] Use display name for mod ticket thread name --- src/discord/utils/techHelp.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/discord/utils/techHelp.ts b/src/discord/utils/techHelp.ts index a9835743e..b8cd5afec 100644 --- a/src/discord/utils/techHelp.ts +++ b/src/discord/utils/techHelp.ts @@ -6,6 +6,7 @@ import { TextChannel, ButtonBuilder, GuildMember, + User, ThreadChannel, ModalSubmitInteraction, Colors, @@ -96,15 +97,20 @@ export async function techHelpClick(interaction:ButtonInteraction) { const modalInput = i.fields.getTextInputValue(`${issueType}IssueInput`); // log.debug(F, `modalInput: ${modalInput}!`); - // // Get the actor - const actor = i.user; + // Get the actor + const actor = (i.member ?? i.user) as GuildMember | User; + + // Get the actors name. + const targetName = (actor as GuildMember | null)?.displayName + ?? (actor as User | null)?.username + ?? '[Deleted Discord Account]'; // Create a new thread in channel const ticketThread = await (i.channel as TextChannel).threads.create({ - name: `🧡│${actor.username}'s ${issueType} issue!`, + name: `🧡│${targetName}'s ${issueType} issue!`, autoArchiveDuration: 1440, type: ChannelType.PrivateThread as AllowedThreadTypeForTextChannel, - reason: `${actor.username} submitted a(n) ${issueType} issue`, + reason: `${targetName} submitted a(n) ${issueType} issue`, invitable: false, }); // log.debug(F, `Created meta-thread ${ticketThread.id}`); From c0c5a786a42092d1bbd8426591feead90e323e6e Mon Sep 17 00:00:00 2001 From: Shadow Date: Mon, 11 Nov 2024 12:02:49 +0000 Subject: [PATCH 2/2] Resolve DeepScan errors DeepScan fix attempt 1 --- src/discord/utils/techHelp.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/discord/utils/techHelp.ts b/src/discord/utils/techHelp.ts index b8cd5afec..c5e215357 100644 --- a/src/discord/utils/techHelp.ts +++ b/src/discord/utils/techHelp.ts @@ -125,11 +125,11 @@ export async function techHelpClick(interaction:ButtonInteraction) { const techHelpButtons = new ActionRowBuilder() .addComponents( new ButtonBuilder() - .setCustomId(`techHelpOwn~${issueType}~${actor.id}`) + .setCustomId(`techHelpOwn~${issueType}~${actor?.id}`) .setLabel('Own this issue!') .setStyle(ButtonStyle.Primary), new ButtonBuilder() - .setCustomId(`techHelpClose~${issueType}~${actor.id}`) + .setCustomId(`techHelpClose~${issueType}~${actor?.id}`) .setLabel('Close this issue!') .setStyle(ButtonStyle.Success), );