Add user icon to event to hide their ID in a place where I can retrieve it from

This commit is contained in:
Ean Milligan (Bastion) 2023-03-28 17:24:51 -04:00
parent 89bfce32f0
commit c1f026bb04
4 changed files with 7 additions and 4 deletions

View File

@ -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

View File

@ -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<string, string> = 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}`);

View File

@ -150,6 +150,7 @@ export const createLFGPost = (
eventDateTime: Date,
eventDateTimeStr: String,
eventDescription: string,
authorId: bigint,
author: string,
memberList: Array<LFGMember>,
alternateList: Array<LFGMember>,
@ -191,6 +192,7 @@ export const createLFGPost = (
}],
footer: {
text: `Created by: ${author}`,
iconUrl: `${config.links.creatorIcon}#${authorId}`,
},
timestamp: eventDateTime.getTime(),
}],

BIN
www/GroupUpSinglePerson.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB