fix webhook allowed mentions

This commit is contained in:
Skillz4Killz
2021-11-14 14:22:41 +00:00
committed by GitHub
parent 6f646f88f5
commit 67278fdc1e
2 changed files with 16 additions and 2 deletions
+10 -1
View File
@@ -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<Message>(
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;
+6 -1
View File
@@ -22,7 +22,12 @@ export interface ExecuteWebhook {
/** Embedded `rich` content */
embeds?: Embed[];
/** Allowed mentions for the message */
allowedMentions?: AllowedMentions;
allowedMentions?: Omit<AllowedMentions, "users" | "roles"> & {
/** 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<Omit<ExecuteWebhook, "wait">>;