added handler to send string as an attachment if it's too long

This commit is contained in:
Aster Fialla
2026-02-15 16:19:59 -05:00
parent be83e8d629
commit f81da5ac27
3 changed files with 16 additions and 3 deletions

View File

@@ -51,7 +51,10 @@ cmds.set('import', {
if (error instanceof AggregateError) {
// errors.message can be a list of successfully added members, or say that none were successful.
let errorsText = `${error.message}.\nThese errors occurred:\n${error.errors.join('\n')}`;
await message.reply(errorsText);
await message.reply(errorsText).catch(async () => {
await messageHelper.sendMessageAsAttachment(errorsText, message);
});
}
// If just one error was returned.
else {