logs and apikeys

This commit is contained in:
Lio Young 2021-04-13 13:11:41 +02:00
parent f70b096b29
commit 76825d3fd3
No known key found for this signature in database
GPG Key ID: 789795A11879E169
3 changed files with 29 additions and 0 deletions

View File

@ -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

View File

@ -2,4 +2,11 @@ export type Shorten = {
id: number
url: string
slug: string
}
export type Key = {
id: string
key: string
owner: string
reason: string
}

20
src/utils.ts Normal file
View File

@ -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
}