getBan single ban fetch function

This commit is contained in:
Skillz
2020-09-06 14:57:24 -04:00
parent 7b08e4d014
commit d1bc0af761
2 changed files with 14 additions and 1 deletions

View File

@@ -2,7 +2,7 @@ name: Discordeno
description: >-
Discord Deno TypeScript API library wrapper(Officially vetted library by
Discord Team) https://discordeno.netlify.app
version: 8.5.0
version: 8.7.0
stable: true
files:
- ./src/**/*

View File

@@ -509,6 +509,19 @@ export async function getBans(guildID: string) {
);
}
/** 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 function getBan(guildID: string, memberID: string) {
if (
!botHasPermission(guildID, [Permissions.BAN_MEMBERS])
) {
throw new Error(Errors.MISSING_BAN_MEMBERS);
}
return RequestManager.get(
endpoints.GUILD_BAN(guildID, memberID),
) as Promise<BannedUser>;
}
/** Ban a user from the guild and optionally delete previous messages sent by the user. Requires teh BAN_MEMBERS permission. */
export function ban(guildID: string, id: string, options: BanOptions) {
if (