mirror of
https://github.com/thaldrin/brevis.git
synced 2024-08-15 03:03:56 +00:00
logs and apikeys
This commit is contained in:
parent
f70b096b29
commit
76825d3fd3
3 changed files with 29 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -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
20
src/utils.ts
Normal 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
|
||||
}
|
Loading…
Reference in a new issue