typings for config

This commit is contained in:
Lio Young 2021-04-09 20:43:45 +02:00
parent b11f63fc8b
commit b12a772669
No known key found for this signature in database
GPG key ID: 789795A11879E169
2 changed files with 40 additions and 2 deletions

17
sample.config.ts Normal file
View file

@ -0,0 +1,17 @@
import variables from "./variables"
import pkg from './package.json'
import { Config } from './src/utils/types'
export default <Config>{
pkg,
variables,
token: "",
apis: {
sheri: "",
yiffrest: ""
},
supabase: {
url: "",
key: ""
}
}

View file

@ -36,6 +36,7 @@ export type Command = {
export type Context = { export type Context = {
client: Client; client: Client;
args: string[]
guild: Guild | null; guild: Guild | null;
message: Message; message: Message;
channel: TextChannel | NewsChannel; channel: TextChannel | NewsChannel;
@ -49,13 +50,29 @@ export type Context = {
// ! Config Typings // ! Config Typings
interface Config { export interface Config {
/**
* package.json import to autocompltete it's vars
*/
pkg: Pkg; pkg: Pkg;
/**
* variables.ts import
* Public Variables are defined in here.
*/
variables: Variables; variables: Variables;
/**
* API Keys for various APIs
*/
apis: Apis; apis: Apis;
/**
* Discord API Token
*/
token: string; token: string;
/**
* Config Strings for Supabase
* Thaldrin's Database
*/
supabase: Supabase; supabase: Supabase;
developers: Developer[];
} }
interface Developer { interface Developer {
@ -75,6 +92,10 @@ interface Apis {
interface Variables { interface Variables {
name: string; name: string;
prefix: string[]; prefix: string[];
/**
* Developers of this Bot
*/
developers: Developer[];
} }
interface Pkg { interface Pkg {