This commit is contained in:
Ean Milligan (Bastion) 2023-04-27 02:37:59 -04:00
parent 2edcd3a961
commit 2fcd475a4a
1 changed files with 26 additions and 10 deletions

View File

@ -2,7 +2,19 @@ import { ActionRow, ApplicationCommandFlags, Bot, ButtonStyles, Interaction, Int
import { failColor, infoColor1, safelyDismissMsg, somethingWentWrong } from '../../commandUtils.ts'; import { failColor, infoColor1, safelyDismissMsg, somethingWentWrong } from '../../commandUtils.ts';
import { Activities, Activity } from '../event-creation/activities.ts'; import { Activities, Activity } from '../event-creation/activities.ts';
import { generateActionRow, getFinalActivity, getNestedActivity } from '../event-creation/utils.ts'; import { generateActionRow, getFinalActivity, getNestedActivity } from '../event-creation/utils.ts';
import { activityMaxPlayersId, activitySubtitleId, activityTitleId, fillerChar, generateAlternateList, generateMemberList, generateMemberTitle, idSeparator, LfgEmbedIndexes, pathIdxEnder, pathIdxSeparator } from '../eventUtils.ts'; import {
activityMaxPlayersId,
activitySubtitleId,
activityTitleId,
fillerChar,
generateAlternateList,
generateMemberList,
generateMemberTitle,
idSeparator,
LfgEmbedIndexes,
pathIdxEnder,
pathIdxSeparator,
} from '../eventUtils.ts';
import { addTokenToMap, deleteTokenEarly, generateMapId, selfDestructMessage, tokenMap } from '../tokenCleanup.ts'; import { addTokenToMap, deleteTokenEarly, generateMapId, selfDestructMessage, tokenMap } from '../tokenCleanup.ts';
import utils from '../../utils.ts'; import utils from '../../utils.ts';
import config from '../../../config.ts'; import config from '../../../config.ts';
@ -25,7 +37,9 @@ const makeCustomEventRow = (customIdIdxPath: string): ActionRow => ({
const execute = async (bot: Bot, interaction: Interaction) => { const execute = async (bot: Bot, interaction: Interaction) => {
if (interaction.data?.customId && interaction.member && interaction.guildId && interaction.channelId) { if (interaction.data?.customId && interaction.member && interaction.guildId && interaction.channelId) {
const [evtChannelId, evtMessageId] = (interaction.data.customId.replaceAll(pathIdxEnder, '').replaceAll(fillerChar, '').split(idSeparator)[1] || '').split(pathIdxSeparator).map((id) => BigInt(id || '0')); const [evtChannelId, evtMessageId] = (interaction.data.customId.replaceAll(pathIdxEnder, '').replaceAll(fillerChar, '').split(idSeparator)[1] || '').split(pathIdxSeparator).map((id) =>
BigInt(id || '0')
);
// Check if we are done // Check if we are done
const valuesIdxPath = interaction.data?.values?.[0] || ''; const valuesIdxPath = interaction.data?.values?.[0] || '';
@ -62,7 +76,8 @@ const execute = async (bot: Bot, interaction: Interaction) => {
embeds: [{ embeds: [{
color: failColor, color: failColor,
title: 'Invalid Max Member count!', title: 'Invalid Max Member count!',
description: `${config.name} parsed the max members as \`${isNaN(activityMaxPlayers) ? 'Not a Number' : activityMaxPlayers description: `${config.name} parsed the max members as \`${
isNaN(activityMaxPlayers) ? 'Not a Number' : activityMaxPlayers
}\`, which is outside of the allowed range. Please re-edit this activity, but make sure the maximum player count is between 1 and 99.\n\n${safelyDismissMsg}`, }\`, which is outside of the allowed range. Please re-edit this activity, but make sure the maximum player count is between 1 and 99.\n\n${safelyDismissMsg}`,
}], }],
}, },
@ -178,7 +193,8 @@ const execute = async (bot: Bot, interaction: Interaction) => {
data: { data: {
embeds: [{ embeds: [{
title: 'Please select a Game and Activity, or create a Custom Event.', title: 'Please select a Game and Activity, or create a Custom Event.',
description: `Changing activity for [this event](${utils.idsToMessageUrl({ description: `Changing activity for [this event](${
utils.idsToMessageUrl({
guildId: interaction.guildId, guildId: interaction.guildId,
channelId: evtChannelId, channelId: evtChannelId,
messageId: evtMessageId, messageId: evtMessageId,