From 4f3e2214dfc36ec72e33989c63bab93106b9ca64 Mon Sep 17 00:00:00 2001 From: Skillz Date: Fri, 28 Aug 2020 17:02:13 -0400 Subject: [PATCH] add getWebhook and export the webhook in mod --- egg.yml | 2 +- mod.ts | 1 + src/constants/discord.ts | 1 + src/handlers/webhook.ts | 4 ++++ 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/egg.yml b/egg.yml index a1c6db9e1..6eeb94667 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.2.3 +version: 8.3.0 stable: true files: - ./src/**/* diff --git a/mod.ts b/mod.ts index afed7644b..62f4feb00 100644 --- a/mod.ts +++ b/mod.ts @@ -14,6 +14,7 @@ export * from "./src/handlers/channel.ts"; export * from "./src/handlers/guild.ts"; export * from "./src/handlers/member.ts"; export * from "./src/handlers/message.ts"; +export * from "./src/handlers/webhook.ts"; export * from "./src/types/activity.ts"; export * from "./src/types/cdn.ts"; diff --git a/src/constants/discord.ts b/src/constants/discord.ts index d7b647829..ea2e01227 100644 --- a/src/constants/discord.ts +++ b/src/constants/discord.ts @@ -87,6 +87,7 @@ export const endpoints = { WEBHOOK: (id: string, token: string) => `${baseEndpoints.BASE_URL}/webhooks/${id}/${token}`, + WEBHOOK_ID: (id: string) => `${baseEndpoints.BASE_URL}/webhooks/${id}`, // User endpoints USER_AVATAR: (id: string, icon: string) => diff --git a/src/handlers/webhook.ts b/src/handlers/webhook.ts index 3b1dfd472..e7e57517f 100644 --- a/src/handlers/webhook.ts +++ b/src/handlers/webhook.ts @@ -100,3 +100,7 @@ export async function executeWebhook( return createMessage(result as MessageCreateOptions); } + +export function getWebhook(webhookID: string) { + return RequestManager.get(endpoints.WEBHOOK_ID(webhookID)) +}