(interaction, modal)
| 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; |
no test coverage detected