diff --git a/src/helpers/webhooks/send_webhook.ts b/src/helpers/webhooks/send_webhook.ts index 7c69ca9b3..2bbfbac78 100644 --- a/src/helpers/webhooks/send_webhook.ts +++ b/src/helpers/webhooks/send_webhook.ts @@ -37,6 +37,15 @@ export async function sendWebhook(bot: Bot, webhookId: bigint, webhookToken: str } } + const allowedMentions = options.allowedMentions + ? { + parse: options.allowedMentions.parse, + repliedUser: options.allowedMentions.repliedUser, + users: options.allowedMentions.users?.map((id) => id.toString()), + roles: options.allowedMentions.roles?.map((id) => id.toString()), + } + : { parse: [] }; + const result = await bot.rest.runMethod( bot.rest, "post", @@ -52,7 +61,7 @@ export async function sendWebhook(bot: Bot, webhookId: bigint, webhookToken: str tts: options.tts, file: options.file, embeds: options.embeds, - allowed_mentions: options.allowedMentions, + allowed_mentions: allowedMentions, } ); if (!options.wait) return; diff --git a/src/types/webhooks/execute_webhook.ts b/src/types/webhooks/execute_webhook.ts index a16604c32..092f2681e 100644 --- a/src/types/webhooks/execute_webhook.ts +++ b/src/types/webhooks/execute_webhook.ts @@ -22,7 +22,12 @@ export interface ExecuteWebhook { /** Embedded `rich` content */ embeds?: Embed[]; /** Allowed mentions for the message */ - allowedMentions?: AllowedMentions; + allowedMentions?: Omit & { + /** Array of role_ids to mention (Max size of 100) */ + roles?: bigint[]; + /** Array of user_ids to mention (Max size of 100) */ + users?: bigint[]; + }; } export type DiscordExecuteWebhook = SnakeCasedPropertiesDeep>;