mirror of
https://github.com/koreanbots/core.git
synced 2025-12-16 06:20:24 +00:00
types: added and fixed
This commit is contained in:
parent
c4aef077a2
commit
3e1a020a9b
@ -107,6 +107,12 @@ export interface ImageOptions {
|
||||
format?: ImageFormat
|
||||
size?: ImageSize
|
||||
}
|
||||
|
||||
export interface KoreanbotsImageOptions {
|
||||
format?: 'webp' | 'png' | 'gif'
|
||||
size?: 128 | 256 | 512
|
||||
}
|
||||
|
||||
export enum DiscordImageType {
|
||||
EMOJI = 'emoji',
|
||||
GUILD = 'guild',
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { ImageOptions } from '@types'
|
||||
import { ImageOptions, KoreanbotsImageOptions } from '@types'
|
||||
import { makeImageURL } from './Tools'
|
||||
|
||||
export const Status = {
|
||||
@ -104,6 +104,12 @@ export const DiscordEnpoints = {
|
||||
}
|
||||
}
|
||||
|
||||
export const KoreanbotsEndPoints = {
|
||||
CDN: class CDN {
|
||||
static avatar (id: string, options: KoreanbotsImageOptions) { return makeImageURL(`/api/image/discord/avatars/${id}`, options) }
|
||||
}
|
||||
}
|
||||
|
||||
export const Oauth = {
|
||||
discord: (clientID: string, scope: string) => `https://discord.com/oauth2/authorize?client_id=${clientID}&scope=${scope}&permissions=0&response_type=code&redirect_uri=${process.env.KOREANBOTS_URL}/api/auth/discord/callback&prompt=none`
|
||||
}
|
||||
|
||||
@ -19,7 +19,7 @@ export interface botListArgument {
|
||||
export const ImageOptionsSchema: Yup.SchemaOf<ImageOptions> = Yup.object({
|
||||
id: Yup.string().required(),
|
||||
ext: Yup.mixed<ext>().oneOf(['webp', 'png', 'gif']).required(),
|
||||
size: Yup.mixed<ImageSize>().oneOf([128, 256, 512]).required()
|
||||
size: Yup.mixed<ImageSize>().oneOf(['128', '256', '512']).required()
|
||||
})
|
||||
|
||||
interface ImageOptions {
|
||||
@ -29,7 +29,7 @@ interface ImageOptions {
|
||||
}
|
||||
|
||||
type ext = 'webp' | 'png' | 'gif'
|
||||
type ImageSize = 128 | 256 | 512
|
||||
type ImageSize = '128' | '256' | '512'
|
||||
|
||||
|
||||
export default Yup
|
||||
Loading…
x
Reference in New Issue
Block a user