Add user icon to event to hide their ID in a place where I can retrieve it from
This commit is contained in:
parent
89bfce32f0
commit
c1f026bb04
|
@ -16,6 +16,7 @@ export const config = {
|
||||||
'sourceCode': 'https://github.com/Burn-E99/GroupUp', // Link to the repository
|
'sourceCode': 'https://github.com/Burn-E99/GroupUp', // Link to the repository
|
||||||
'supportServer': '', // Invite link to the Discord support server
|
'supportServer': '', // Invite link to the Discord support server
|
||||||
'addToCalendar': '', // Link to where the icsGenerator is hosted
|
'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
|
'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
|
'reportChannel': 'the_report_channel', // Discord channel ID where reports will be sent when using the built-in report command
|
||||||
|
|
|
@ -8,12 +8,12 @@ import { getDateFromRawInput } from './dateTimeUtils.ts';
|
||||||
export const customId = 'finalize';
|
export const customId = 'finalize';
|
||||||
|
|
||||||
const execute = async (bot: Bot, interaction: Interaction) => {
|
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();
|
const tempDataMap: Map<string, string> = new Map();
|
||||||
for (const row of interaction.data.components) {
|
for (const row of interaction.data.components) {
|
||||||
if (row.components?.[0]) {
|
if (row.components?.[0]) {
|
||||||
const textField = 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 rawEventTime = tempDataMap.get(eventTimeId) || '';
|
||||||
const rawEventTimeZone = tempDataMap.get(eventTimeZoneId) || '';
|
const rawEventTimeZone = tempDataMap.get(eventTimeZoneId) || '';
|
||||||
const rawEventDate = tempDataMap.get(eventDateId) || '';
|
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) {
|
if (!rawEventTime || !rawEventTimeZone || !rawEventDate) {
|
||||||
// Error out if user somehow failed to provide one of the fields (eventDescription is allowed to be null/empty)
|
// 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}`);
|
somethingWentWrong(bot, interaction, `missingFieldFromEventDescription@${rawEventTime}_${rawEventTimeZone}_${rawEventDate}`);
|
||||||
|
@ -56,7 +56,7 @@ const execute = async (bot: Bot, interaction: Interaction) => {
|
||||||
bot.helpers.sendInteractionResponse(
|
bot.helpers.sendInteractionResponse(
|
||||||
interaction.id,
|
interaction.id,
|
||||||
interaction.token,
|
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}`);
|
// somethingWentWrong(bot, interaction, `TESTING@${rawEventTime}_${rawEventTimeZone}_${rawEventDate}`);
|
||||||
|
|
|
@ -150,6 +150,7 @@ export const createLFGPost = (
|
||||||
eventDateTime: Date,
|
eventDateTime: Date,
|
||||||
eventDateTimeStr: String,
|
eventDateTimeStr: String,
|
||||||
eventDescription: string,
|
eventDescription: string,
|
||||||
|
authorId: bigint,
|
||||||
author: string,
|
author: string,
|
||||||
memberList: Array<LFGMember>,
|
memberList: Array<LFGMember>,
|
||||||
alternateList: Array<LFGMember>,
|
alternateList: Array<LFGMember>,
|
||||||
|
@ -191,6 +192,7 @@ export const createLFGPost = (
|
||||||
}],
|
}],
|
||||||
footer: {
|
footer: {
|
||||||
text: `Created by: ${author}`,
|
text: `Created by: ${author}`,
|
||||||
|
iconUrl: `${config.links.creatorIcon}#${authorId}`,
|
||||||
},
|
},
|
||||||
timestamp: eventDateTime.getTime(),
|
timestamp: eventDateTime.getTime(),
|
||||||
}],
|
}],
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 2.3 KiB |
Loading…
Reference in New Issue