Skip to content

Commit

Permalink
Merge branch 'main' into rpg-premium-membership-item
Browse files Browse the repository at this point in the history
  • Loading branch information
theimperious1 authored Nov 11, 2024
2 parents 576cc0d + fd0acee commit 90bd07b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
18 changes: 12 additions & 6 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 All @@ -119,11 +125,11 @@ export async function techHelpClick(interaction:ButtonInteraction) {
const techHelpButtons = new ActionRowBuilder<ButtonBuilder>()
.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),
);
Expand Down
9 changes: 8 additions & 1 deletion src/discord/utils/trust.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,14 +168,21 @@ but they were already marked at trusted in the database, so no message was sent`
const greeting = greetingList[Math.floor(Math.random() * greetingList.length)];

const channelLounge = await newMember.client.channels.fetch(env.CHANNEL_LOUNGE) as TextChannel;
await channelLounge.send({
const message = await channelLounge.send({
content: stripIndents`**${greeting}**
Head to <#${env.CHANNEL_TRIPSIT}> if you need a tripsitter. :)
Be safe, have fun, and don't forget to visit the <id:guide> for more information!
*${await topic()}*`,
});

try {
await message.react('<:ts_welcomeA:1222543903677485156>');
await message.react('<:ts_welcomeB:1222543905216663634>');
} catch (err) {
log.debug(F, 'Attempted to add welcome emojis to welcome message, but they appear to be missing.');
}

await db.members.upsert({
where: {
id_guild_id: {
Expand Down

0 comments on commit 90bd07b

Please sign in to comment.