mirror of
https://github.com/koreanbots/core.git
synced 2025-12-16 14:30:22 +00:00
types: added types
This commit is contained in:
parent
461ad2b9d8
commit
6286a9fa2a
@ -14,7 +14,7 @@ import { sign, verify } from './Jwt'
|
|||||||
|
|
||||||
export const imageRateLimit = new TLRU<unknown, number>({ maxAgeMs: 60000 })
|
export const imageRateLimit = new TLRU<unknown, number>({ maxAgeMs: 60000 })
|
||||||
|
|
||||||
async function getBot(id: string, owners=true) {
|
async function getBot(id: string, owners=true):Promise<Bot> {
|
||||||
const res = await knex('bots')
|
const res = await knex('bots')
|
||||||
.select([
|
.select([
|
||||||
'id',
|
'id',
|
||||||
@ -61,7 +61,7 @@ async function getBot(id: string, owners=true) {
|
|||||||
return res[0] ?? null
|
return res[0] ?? null
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getUser(id: string, bots = true) {
|
async function getUser(id: string, bots = true):Promise<User> {
|
||||||
const res = await knex('users')
|
const res = await knex('users')
|
||||||
.select(['id', 'perm', 'github'])
|
.select(['id', 'perm', 'github'])
|
||||||
.where({ id })
|
.where({ id })
|
||||||
@ -203,7 +203,7 @@ async function getImage(url: string):Promise<Stream> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function getDiscordUser(id: string):Promise<DiscordUser> {
|
async function getDiscordUser(id: string):Promise<DiscordUser> {
|
||||||
return DiscordBot.users.cache.get(id) ?? await DiscordBot.users.fetch(id, false, true).then(u => u).catch(()=>null)
|
return DiscordBot.users.cache.get(id) ?? await DiscordBot.users.fetch(id, false, true).then(u => u.toJSON()).catch(()=>null)
|
||||||
}
|
}
|
||||||
|
|
||||||
async function assignToken(info: TokenRegister):Promise<string> {
|
async function assignToken(info: TokenRegister):Promise<string> {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user