(title, detail = null, options = {})
| 280 | * @deprecated Prefer buildUserErrorEmbed or replyUserError from errorHandler.js. |
| 281 | */ |
| 282 | export function errorEmbed(title, detail = null, options = {}) { |
| 283 | const { showDetails = process.env.NODE_ENV !== 'production' } = options; |
| 284 | let body = detail; |
| 285 | |
| 286 | if (detail && showDetails && typeof detail !== 'string') { |
| 287 | const detailText = detail.message || String(detail); |
| 288 | body = formatCodeBlock(detailText); |
| 289 | } |
| 290 | |
| 291 | const description = body ? String(body).trim() : ''; |
| 292 | const titleOverride = title && title !== 'Error' ? title : undefined; |
| 293 | |
| 294 | return buildUserErrorEmbed('unknown', description, { titleOverride }); |
| 295 | } |
| 296 | |
| 297 | /** @param {string} titleOrBody - With one arg: body text. With two args: title and body. */ |
| 298 | export function successEmbed(title, body = '') { |
nothing calls this directly
no test coverage detected