From c1f026bb04d2095d2bdf4c0133b208d7c82b4e5c Mon Sep 17 00:00:00 2001 From: "Ean Milligan (Bastion)" Date: Tue, 28 Mar 2023 17:24:51 -0400 Subject: [PATCH] Add user icon to event to hide their ID in a place where I can retrieve it from --- config.example.ts | 1 + src/buttons/event-creation/step2-finalize.ts | 8 ++++---- src/buttons/event-creation/utils.ts | 2 ++ www/GroupUpSinglePerson.png | Bin 0 -> 2328 bytes 4 files changed, 7 insertions(+), 4 deletions(-) create mode 100644 www/GroupUpSinglePerson.png diff --git a/config.example.ts b/config.example.ts index bd5086c..bca27aa 100644 --- a/config.example.ts +++ b/config.example.ts @@ -16,6 +16,7 @@ export const config = { 'sourceCode': 'https://github.com/Burn-E99/GroupUp', // Link to the repository 'supportServer': '', // Invite link to the Discord support server 'addToCalendar': '', // Link to where the icsGenerator is hosted + 'creatorIcon': '', // Link to where the GroupUpSinglePerson.png (or similar image) is hosted }, 'logChannel': 'the_log_channel', // Discord channel ID where the bot should put startup messages and other error messages needed 'reportChannel': 'the_report_channel', // Discord channel ID where reports will be sent when using the built-in report command diff --git a/src/buttons/event-creation/step2-finalize.ts b/src/buttons/event-creation/step2-finalize.ts index 15eea90..b5063ef 100644 --- a/src/buttons/event-creation/step2-finalize.ts +++ b/src/buttons/event-creation/step2-finalize.ts @@ -8,12 +8,12 @@ import { getDateFromRawInput } from './dateTimeUtils.ts'; export const customId = 'finalize'; const execute = async (bot: Bot, interaction: Interaction) => { - if (interaction?.data?.components?.length && interaction.guildId && interaction.channelId && interaction.member) { + if (interaction?.data?.components?.length && interaction.guildId && interaction.channelId && interaction.member && interaction.member.user) { const tempDataMap: Map = new Map(); for (const row of interaction.data.components) { if (row.components?.[0]) { const textField = row.components[0]; - tempDataMap.set(textField.customId || 'missingCustomId', textField.value || 'missingValue'); + tempDataMap.set(textField.customId || 'missingCustomId', textField.value || ''); } } @@ -43,7 +43,7 @@ const execute = async (bot: Bot, interaction: Interaction) => { const rawEventTime = tempDataMap.get(eventTimeId) || ''; const rawEventTimeZone = tempDataMap.get(eventTimeZoneId) || ''; const rawEventDate = tempDataMap.get(eventDateId) || ''; - const eventDescription = tempDataMap.get(eventDescriptionId) || 'No Description Provided.'; + const eventDescription = tempDataMap.get(eventDescriptionId) || 'No description provided.'; if (!rawEventTime || !rawEventTimeZone || !rawEventDate) { // Error out if user somehow failed to provide one of the fields (eventDescription is allowed to be null/empty) somethingWentWrong(bot, interaction, `missingFieldFromEventDescription@${rawEventTime}_${rawEventTimeZone}_${rawEventDate}`); @@ -56,7 +56,7 @@ const execute = async (bot: Bot, interaction: Interaction) => { bot.helpers.sendInteractionResponse( interaction.id, interaction.token, - createLFGPost(category, activity, eventDateTime, eventDateTimeStr, eventDescription, interaction.member.nick || 'test', [], [], customIdIdxPath, true), + createLFGPost(category, activity, eventDateTime, eventDateTimeStr, eventDescription, interaction.member.id, interaction.member.user.username, [], [], customIdIdxPath, true), ); // somethingWentWrong(bot, interaction, `TESTING@${rawEventTime}_${rawEventTimeZone}_${rawEventDate}`); diff --git a/src/buttons/event-creation/utils.ts b/src/buttons/event-creation/utils.ts index 6cbae16..0735fc4 100644 --- a/src/buttons/event-creation/utils.ts +++ b/src/buttons/event-creation/utils.ts @@ -150,6 +150,7 @@ export const createLFGPost = ( eventDateTime: Date, eventDateTimeStr: String, eventDescription: string, + authorId: bigint, author: string, memberList: Array, alternateList: Array, @@ -191,6 +192,7 @@ export const createLFGPost = ( }], footer: { text: `Created by: ${author}`, + iconUrl: `${config.links.creatorIcon}#${authorId}`, }, timestamp: eventDateTime.getTime(), }], diff --git a/www/GroupUpSinglePerson.png b/www/GroupUpSinglePerson.png new file mode 100644 index 0000000000000000000000000000000000000000..d1375141de466858608c4fb98ba76fffb95de2ed GIT binary patch literal 2328 zcmd^>doCk4M!YL((2Kqv(g@*Hr1RCRW)&~ON=WA>c z_9$}I;4@#N?Fl=I@X}~uo5CrRLxaxkK&BgPPbo6>#FOF45XgSPt|@gTR1zT&wOow9 z&(|sV#a{;Eap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