From d1bc0af761aecb324459c6db1b4a477b76a76bb8 Mon Sep 17 00:00:00 2001 From: Skillz Date: Sun, 6 Sep 2020 14:57:24 -0400 Subject: [PATCH] getBan single ban fetch function --- egg.yml | 2 +- src/handlers/guild.ts | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/egg.yml b/egg.yml index 0bc29c68a..8a5f9eab5 100644 --- a/egg.yml +++ b/egg.yml @@ -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/**/* diff --git a/src/handlers/guild.ts b/src/handlers/guild.ts index 9d212377d..5f3ac1855 100644 --- a/src/handlers/guild.ts +++ b/src/handlers/guild.ts @@ -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; +} + /** 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 (