Files
discordeno/helpers/guilds/automod/getAutomodRule.ts
T
Skillz4Killz 3a5bdce32d feat: helpers support strings in args (#2478)
* fix: helpers support strings in args

* fix: fmt
2022-09-15 20:59:02 -05:00

28 lines
1000 B
TypeScript

import { Bot } from "../../../bot.ts";
import { AutoModerationRule } from "../../../transformers/automodRule.ts";
import { DiscordAutoModerationRule } from "../../../types/discord.ts";
import { BigString } from "../../../types/shared.ts";
/**
* Gets an automod rule by its ID.
*
* @param bot - The bot instance to use to make the request.
* @param guildId - The ID of the guild to get the rule of.
* @param ruleId - The ID of the rule to get.
* @returns An instance of {@link AutoModerationRule}.
*
* @remarks
* Requires the `MANAGE_GUILD` permission.
*
* @see {@link https://discord.com/developers/docs/resources/auto-moderation#get-auto-moderation-rule}
*/
export async function getAutomodRule(bot: Bot, guildId: BigString, ruleId: BigString): Promise<AutoModerationRule> {
const result = await bot.rest.runMethod<DiscordAutoModerationRule>(
bot.rest,
"GET",
bot.constants.routes.AUTOMOD_RULE(guildId, ruleId),
);
return bot.transformers.automodRule(bot, result);
}