Files
discordeno/helpers/guilds/getBan.ts
ITOH 03996c5f58 refactor: revert "feat: base plugin lib idea (#2308)" (#2336)
* Revert "feat: base plugin lib idea (#2308)"

This reverts commit ffe7cdbc6f.

* fmt
2022-07-02 14:24:43 +01:00

19 lines
569 B
TypeScript

import type { Bot } from "../../bot.ts";
import { DiscordBan } from "../../types/discord.ts";
/** Returns a ban object for the given user or a 404 not found if the ban cannot be found. Requires the BAN_MEMBERS permission. */
export async function getBan(bot: Bot, guildId: bigint, memberId: bigint) {
const result = await bot.rest.runMethod<DiscordBan>(
bot.rest,
"GET",
bot.constants.routes.GUILD_BAN(guildId, memberId),
);
if (!result?.user) return;
return {
reason: result.reason,
user: bot.transformers.user(bot, result.user),
};
}