mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-15 11:03:30 +01:00
chore: upgrade deps (#10824)
This commit is contained in:
@@ -15,6 +15,7 @@ export const localeMapPredicate = z
|
||||
.strict();
|
||||
|
||||
export const refineURLPredicate = (allowedProtocols: string[]) => (value: string) => {
|
||||
// eslint-disable-next-line n/prefer-global/url
|
||||
const url = new URL(value);
|
||||
return allowedProtocols.includes(url.protocol);
|
||||
};
|
||||
|
||||
@@ -63,15 +63,12 @@ export const messagePredicate = z
|
||||
poll: pollPredicate.optional(),
|
||||
})
|
||||
.refine(
|
||||
(data) => {
|
||||
return (
|
||||
data.content !== undefined ||
|
||||
(data.embeds !== undefined && data.embeds.length > 0) ||
|
||||
data.poll !== undefined ||
|
||||
(data.attachments !== undefined && data.attachments.length > 0) ||
|
||||
(data.components !== undefined && data.components.length > 0) ||
|
||||
(data.sticker_ids !== undefined && data.sticker_ids.length > 0)
|
||||
);
|
||||
},
|
||||
(data) =>
|
||||
data.content !== undefined ||
|
||||
(data.embeds !== undefined && data.embeds.length > 0) ||
|
||||
data.poll !== undefined ||
|
||||
(data.attachments !== undefined && data.attachments.length > 0) ||
|
||||
(data.components !== undefined && data.components.length > 0) ||
|
||||
(data.sticker_ids !== undefined && data.sticker_ids.length > 0),
|
||||
{ message: 'Messages must have content, embeds, a poll, attachments, components, or stickers' },
|
||||
);
|
||||
|
||||
@@ -47,24 +47,16 @@ export const embedPredicate = z
|
||||
fields: z.array(embedFieldPredicate).max(25).optional(),
|
||||
})
|
||||
.refine(
|
||||
(embed) => {
|
||||
return (
|
||||
embed.title !== undefined ||
|
||||
embed.description !== undefined ||
|
||||
(embed.fields !== undefined && embed.fields.length > 0) ||
|
||||
embed.footer !== undefined ||
|
||||
embed.author !== undefined ||
|
||||
embed.image !== undefined ||
|
||||
embed.thumbnail !== undefined
|
||||
);
|
||||
},
|
||||
(embed) =>
|
||||
embed.title !== undefined ||
|
||||
embed.description !== undefined ||
|
||||
(embed.fields !== undefined && embed.fields.length > 0) ||
|
||||
embed.footer !== undefined ||
|
||||
embed.author !== undefined ||
|
||||
embed.image !== undefined ||
|
||||
embed.thumbnail !== undefined,
|
||||
{
|
||||
message: 'Embed must have at least a title, description, a field, a footer, an author, an image, OR a thumbnail.',
|
||||
},
|
||||
)
|
||||
.refine(
|
||||
(embed) => {
|
||||
return embedLength(embed) <= 6_000;
|
||||
},
|
||||
{ message: 'Embeds must not exceed 6000 characters in total.' },
|
||||
);
|
||||
.refine((embed) => embedLength(embed) <= 6_000, { message: 'Embeds must not exceed 6000 characters in total.' });
|
||||
|
||||
Reference in New Issue
Block a user