requested changes

This commit is contained in:
ITOH
2021-06-10 16:09:31 +02:00
parent 29c815712e
commit cccc0a3359
3 changed files with 12 additions and 10 deletions
+4 -3
View File
@@ -30,10 +30,11 @@ export async function editMessage(channelId: bigint, messageId: bigint, content:
} }
// TODO: v12 remove // TODO: v12 remove
if (content.embed) content.embeds = [content.embed, ...(content.embeds || [])]; if (content.embed) {
if (content.embeds && content.embeds.length > 10) { content.embeds = [content.embed, ...(content.embeds || [])];
content.embeds.splice(10); content.embed = undefined;
} }
content.embeds?.splice(10);
if (content.content && content.content.length > 2000) { if (content.content && content.content.length > 2000) {
throw new Error(Errors.MESSAGE_MAX_LENGTH); throw new Error(Errors.MESSAGE_MAX_LENGTH);
+7 -4
View File
@@ -35,10 +35,13 @@ export async function sendMessage(channelId: bigint, content: string | CreateMes
if (content.tts) requiredPerms.add("SEND_TTS_MESSAGES"); if (content.tts) requiredPerms.add("SEND_TTS_MESSAGES");
// TODO: v12 remove // TODO: v12 remove
if (content.embed) content.embeds = [content.embed, ...(content.embeds || [])]; if (content.embed) {
if (content.embeds?.length) requiredPerms.add("EMBED_LINKS"); content.embeds = [content.embed, ...(content.embeds || [])];
if (content.embeds && content.embeds.length > 10) { content.embed = undefined;
content.embeds.splice(10); }
if (content.embeds?.length) {
requiredPerms.add("EMBED_LINKS");
content.embeds?.splice(10);
} }
if (content.messageReference?.messageId || content.allowedMentions?.repliedUser) { if (content.messageReference?.messageId || content.allowedMentions?.repliedUser) {
+1 -3
View File
@@ -17,9 +17,7 @@ export async function sendWebhook(webhookId: bigint, webhookToken: string, optio
throw Error(Errors.MESSAGE_MAX_LENGTH); throw Error(Errors.MESSAGE_MAX_LENGTH);
} }
if (options.embeds && options.embeds.length > 10) { options.embeds?.splice(10);
options.embeds.splice(10);
}
if (options.allowedMentions) { if (options.allowedMentions) {
if (options.allowedMentions.users?.length) { if (options.allowedMentions.users?.length) {