diff --git a/src/buttons/event-creation/step3-createEvent.ts b/src/buttons/event-creation/step3-createEvent.ts index ca3e5d6..abef8f8 100644 --- a/src/buttons/event-creation/step3-createEvent.ts +++ b/src/buttons/event-creation/step3-createEvent.ts @@ -2,7 +2,7 @@ import { ApplicationCommandFlags, Bot, Interaction, InteractionResponseTypes, Me import { generateLFGButtons } from './utils.ts'; import { idSeparator, LfgEmbedIndexes } from '../eventUtils.ts'; import { deleteTokenEarly } from '../tokenCleanup.ts'; -import { dmTestMessage, safelyDismissMsg, sendDirectMessage, somethingWentWrong, warnColor } from '../../commandUtils.ts'; +import { commonFixes, dmTestMessage, safelyDismissMsg, sendDirectMessage, somethingWentWrong, warnColor } from '../../commandUtils.ts'; import { dbClient } from '../../db/client.ts'; import { queries } from '../../db/common.ts'; import utils from '../../utils.ts'; @@ -52,7 +52,7 @@ const execute = async (bot: Bot, interaction: Interaction) => { }], }).catch((e: Error) => utils.commonLoggers.messageSendError('step3-createEvent.ts', 'createEvent', e)); if (!eventMessage) { - somethingWentWrong(bot, interaction, 'creatingEventSendMessageFinalizeEventStep'); + somethingWentWrong(bot, interaction, 'creatingEventSendMessageFinalizeEventStep', commonFixes.CANT_SEND_MESSAGE); return; } diff --git a/src/buttons/live-event/joinEvent.ts b/src/buttons/live-event/joinEvent.ts index 5d615ff..b83e46f 100644 --- a/src/buttons/live-event/joinEvent.ts +++ b/src/buttons/live-event/joinEvent.ts @@ -106,7 +106,7 @@ ${safelyDismissMsg}`, timestamp: new Date().getTime(), }); }).catch((e: Error) => { - somethingWentWrong(bot, interaction, 'failedToDMOwnerInRequestToJoinEventButton'); + somethingWentWrong(bot, interaction, 'failedToDMOwnerInRequestToJoinEventButton', `${config.name} could not message <@${ownerId}>. This likely means <@${ownerId}> has turned off DMs.`); utils.commonLoggers.messageSendError('joinEvent.ts@dmOwner', 'failed to DM owner for join request', e); }); } diff --git a/src/commandUtils.ts b/src/commandUtils.ts index e39b7fd..9f61d0f 100644 --- a/src/commandUtils.ts +++ b/src/commandUtils.ts @@ -27,7 +27,7 @@ export const isLFGChannel = (guildId: bigint, channelId: bigint) => { }; // Tell user to try again or report issue -export const somethingWentWrong = (bot: Bot, interaction: Interaction, errorCode: string) => +export const somethingWentWrong = (bot: Bot, interaction: Interaction, errorCode: string, possibleFix = 'No fix provided.') => bot.helpers.sendInteractionResponse(interaction.id, interaction.token, { type: InteractionResponseTypes.ChannelMessageWithSource, data: { @@ -35,15 +35,24 @@ export const somethingWentWrong = (bot: Bot, interaction: Interaction, errorCode embeds: [{ color: failColor, title: 'Something went wrong...', - description: `You should not be able to get here. Please try again and if the issue continues, \`/${reportSlashName}\` this issue to the developers with the error code below.`, + description: + `You should not be able to get here. If ${config.name} has seen this error before, the developer may have a possible fix for you to try. If one is provided, please attempt it before \`/${reportSlashName}\`ing it. If the issue continues, please \`/${reportSlashName}\` this issue to the developer with the error code below.`, fields: [{ name: 'Error Code:', value: `\`${errorCode}\``, + }, { + name: 'Possible Fix:', + value: possibleFix, }], }], }, }).catch((e: Error) => utils.commonLoggers.interactionSendError('commandUtils.ts@somethingWentWrong', interaction, e)); +// Possible fixes for the user to try before reporting. +export const commonFixes = { + CANT_SEND_MESSAGE: `Please verify ${config.name} has permission to send messages in this channel.`, +}; + // Smack the user for trying to modify an event that isn't theirs export const stopThat = (bot: Bot, interaction: Interaction, stopWhat: string) => bot.helpers.sendInteractionResponse(interaction.id, interaction.token, {