mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 03:53:29 +01:00
feat(builders): improve embed errors and predicates (#7795)
* feat(builders): improve embed errors * fix: use imageURLPredicates Co-authored-by: Synbulat Biishev <arziksin@gmail.com> Co-authored-by: Synbulat Biishev <arziksin@gmail.com>
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
import type { APIEmbedField } from 'discord-api-types/v10';
|
||||
import {
|
||||
authorNamePredicate,
|
||||
colorPredicate,
|
||||
descriptionPredicate,
|
||||
embedAuthorPredicate,
|
||||
embedFieldsArrayPredicate,
|
||||
footerTextPredicate,
|
||||
embedFooterPredicate,
|
||||
imageURLPredicate,
|
||||
timestampPredicate,
|
||||
titlePredicate,
|
||||
@@ -39,9 +39,7 @@ export class EmbedBuilder extends UnsafeEmbedBuilder {
|
||||
}
|
||||
|
||||
// Data assertions
|
||||
authorNamePredicate.parse(options.name);
|
||||
urlPredicate.parse(options.iconURL);
|
||||
urlPredicate.parse(options.url);
|
||||
embedAuthorPredicate.parse(options);
|
||||
|
||||
return super.setAuthor(options);
|
||||
}
|
||||
@@ -62,8 +60,7 @@ export class EmbedBuilder extends UnsafeEmbedBuilder {
|
||||
}
|
||||
|
||||
// Data assertions
|
||||
footerTextPredicate.parse(options.text);
|
||||
urlPredicate.parse(options.iconURL);
|
||||
embedFooterPredicate.parse(options);
|
||||
|
||||
return super.setFooter(options);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user