From 76825d3fd3d17ce1ac3b52960cafd7df54277b04 Mon Sep 17 00:00:00 2001 From: Lio Young Date: Tue, 13 Apr 2021 13:11:41 +0200 Subject: [PATCH] logs and apikeys --- README.md | 2 ++ src/types.ts | 7 +++++++ src/utils.ts | 20 ++++++++++++++++++++ 3 files changed, 29 insertions(+) create mode 100644 src/utils.ts diff --git a/README.md b/README.md index dd7b631..286bb6a 100644 --- a/README.md +++ b/README.md @@ -2,4 +2,6 @@ Brevis is the API handling shortens on [t8.pm] +To get access to this API, [join Thaldrin's Support Server](https://t8.pm/support) and become a [10€ Patron](https://t8.pm/patreon) + [t8.pm]: https://t8.pm diff --git a/src/types.ts b/src/types.ts index e375306..4bc8368 100644 --- a/src/types.ts +++ b/src/types.ts @@ -2,4 +2,11 @@ export type Shorten = { id: number url: string slug: string +} + +export type Key = { + id: string + key: string + owner: string + reason: string } \ No newline at end of file diff --git a/src/utils.ts b/src/utils.ts new file mode 100644 index 0000000..2b2191f --- /dev/null +++ b/src/utils.ts @@ -0,0 +1,20 @@ +import axios from "axios" + + +export async function logToDiscord(message: string, webhook?: string) { + + if (process.env.BREVIS_WEBHOOK) { + + try { + let req = await axios.post(process.env.BREVIS_WEBHOOK, { + username: "Brevis", + content: message + }) + + return req + } catch (error) { + console.error(error) + } + + } else return +} \ No newline at end of file