mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-02 08:50:07 +00:00
19 lines
569 B
TypeScript
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),
|
|
};
|
|
}
|