Skip to content

Commit

Permalink
Use display name for mod ticket thread name
Browse files Browse the repository at this point in the history
  • Loading branch information
theimperious1 committed Nov 10, 2024
1 parent c92170d commit 8b06d7e
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/discord/utils/techHelp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
TextChannel,
ButtonBuilder,
GuildMember,
User,
ThreadChannel,
ModalSubmitInteraction,
Colors,
Expand Down Expand Up @@ -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}`);
Expand Down

0 comments on commit 8b06d7e

Please sign in to comment.