MCPcopy Index your code
hub / github.com/codebymitch/TitanBot / safeShowModal

Method safeShowModal

src/utils/interactionHelper.js:245–267  ·  view source on GitHub ↗
(interaction, modal)

Source from the content-addressed store, hash-verified

243 }
244
245 static async safeShowModal(interaction, modal) {
246 try {
247 if (!this.isInteractionValid(interaction)) {
248 logger.warn(`Interaction ${interaction.id} has expired before showModal, ignoring`);
249 return false;
250 }
251
252 if (interaction.replied || interaction.deferred) {
253 logger.warn(`Interaction ${interaction.id} already acknowledged, cannot show modal`);
254 return false;
255 }
256
257 await interaction.showModal(modal);
258 return true;
259 } catch (error) {
260 if (isInteractionUnavailableError(error)) {
261 logger.warn(`Interaction ${interaction.id} unavailable during showModal:`, error.message);
262 return false;
263 }
264 logger.error('Failed to show modal:', error);
265 return false;
266 }
267 }
268
269 static async safeExecute(interaction, commandFunction, errorEmbed, options = {}) {
270 const autoDeferDefault = !interaction._isPrefixCommand;

Callers 7

handleEditContentFunction · 0.80
handleSetColorFunction · 0.80
handleSetAuthorFunction · 0.80
handleSetFooterFunction · 0.80
handleSetImagesFunction · 0.80
handleAddFieldFunction · 0.80
handleEditFieldFunction · 0.80

Calls 2

isInteractionValidMethod · 0.95

Tested by

no test coverage detected