mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-19 04:38:17 +00:00
fix(handlers): add editSlashResponse() (#399)
* update: editSlashResponse * remove breaking changes
This commit is contained in:
@@ -482,8 +482,50 @@ export function editSlashResponse(
|
|||||||
token: string,
|
token: string,
|
||||||
options: EditSlashResponseOptions,
|
options: EditSlashResponseOptions,
|
||||||
) {
|
) {
|
||||||
|
if (options.content && options.content.length > 2000) {
|
||||||
|
throw Error(Errors.MESSAGE_MAX_LENGTH);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (options.embeds && options.embeds.length > 10) {
|
||||||
|
options.embeds.splice(10);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (options.allowed_mentions) {
|
||||||
|
if (options.allowed_mentions.users?.length) {
|
||||||
|
if (options.allowed_mentions.parse.includes("users")) {
|
||||||
|
options.allowed_mentions.parse = options.allowed_mentions.parse.filter((
|
||||||
|
p,
|
||||||
|
) => p !== "users");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (options.allowed_mentions.users.length > 100) {
|
||||||
|
options.allowed_mentions.users = options.allowed_mentions.users.slice(
|
||||||
|
0,
|
||||||
|
100,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (options.allowed_mentions.roles?.length) {
|
||||||
|
if (options.allowed_mentions.parse.includes("roles")) {
|
||||||
|
options.allowed_mentions.parse = options.allowed_mentions.parse.filter((
|
||||||
|
p,
|
||||||
|
) => p !== "roles");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (options.allowed_mentions.roles.length > 100) {
|
||||||
|
options.allowed_mentions.roles = options.allowed_mentions.roles.slice(
|
||||||
|
0,
|
||||||
|
100,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return RequestManager.patch(
|
return RequestManager.patch(
|
||||||
endpoints.INTERACTION_ORIGINAL_ID_TOKEN(applicationID, token),
|
options.messageID
|
||||||
|
? endpoints.WEBHOOK_MESSAGE(applicationID, token, options.messageID)
|
||||||
|
: endpoints.INTERACTION_ORIGINAL_ID_TOKEN(applicationID, token),
|
||||||
options,
|
options,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user