1
0
mirror of https://github.com/toast-ts/Daggerbot-TS.git synced 2024-11-17 00:10:58 -05:00

Add types for tokens and configs

This commit is contained in:
toast-ts 2022-12-29 21:10:13 +11:00
parent 83d78f71c0
commit 1aada89272
2 changed files with 66 additions and 6 deletions

View File

@ -2,16 +2,18 @@ import Discord, { Client, GatewayIntentBits, Partials } from 'discord.js';
import fs from 'node:fs'; import fs from 'node:fs';
import { Database } from './database'; import { Database } from './database';
import timeNames from './timeNames'; import timeNames from './timeNames';
import { Punishment, formatTimeOpt, createTableOpt, punOpt } from './typings/interfaces'; import { Punishment, formatTimeOpt, createTableOpt, punOpt, Tokens, Config } from './typings/interfaces';
import MPDB from './models/MPServer'; import MPDB from './models/MPServer';
import axios from 'axios'; import axios from 'axios';
import moment from 'moment'; import moment from 'moment';
import tokens from './tokens.json';
import config from './config.json';
export class TClient extends Client { export class TClient extends Client {
invites: Map<any, any>; invites: Map<any, any>;
commands: Discord.Collection<string, any>; commands: Discord.Collection<string, any>;
registry: Array<Discord.ApplicationCommandDataResolvable>; registry: Array<Discord.ApplicationCommandDataResolvable>;
config: any; config: Config;
tokens: any; tokens: Tokens;
YTCache: any; YTCache: any;
embed: typeof Discord.EmbedBuilder; embed: typeof Discord.EmbedBuilder;
collection: any; collection: any;
@ -44,8 +46,8 @@ export class TClient extends Client {
this.invites = new Map(); this.invites = new Map();
this.commands = new Discord.Collection(); this.commands = new Discord.Collection();
this.registry = []; this.registry = [];
this.config = require('./config.json'); this.config = config as Config;
this.tokens = require('./tokens.json'); this.tokens = tokens as Tokens;
this.YTCache = { this.YTCache = {
'UCQ8k8yTDLITldfWYKDs3xFg': undefined, // Daggerwin 'UCQ8k8yTDLITldfWYKDs3xFg': undefined, // Daggerwin
'UCguI73--UraJpso4NizXNzA': undefined // Machinery Restorer 'UCguI73--UraJpso4NizXNzA': undefined // Machinery Restorer

View File

@ -1,4 +1,4 @@
import Discord from 'discord.js'; import Discord, { ColorResolvable } from 'discord.js';
export interface UserLevels { export interface UserLevels {
messages: number, messages: number,
@ -122,4 +122,62 @@ interface slotUsage {
} }
interface XMLText { interface XMLText {
_text: string _text: string
}
export interface Tokens {
token_main: string
token_beta: string
token_toast: string
token_tae: string
}
export interface Config {
embedColor: ColorResolvable,
embedColorGreen: ColorResolvable,
embedColorYellow: ColorResolvable,
embedColorRed: ColorResolvable,
embedColorBCA: ColorResolvable,
embedColorXmas: ColorResolvable,
LRSstart: number,
botSwitches: botSwitches,
eval: Eval,
mainServer: mainServer
}
interface botSwitches {
registerCommands: boolean,
commands: boolean,
logs: boolean,
automod: boolean,
mpstats: boolean,
autores: boolean
}
interface Eval {
allowed: boolean,
whitelist: Array<string>
}
interface mainServer {
id: string,
staffRoles: Array<string>,
roles: mainServerRoles,
channels: mainServerChannels
}
interface mainServerRoles {
admin: string,
bottech: string,
dcmod: string,
mpmanager: string,
mpmod: string,
vtcmanager: string,
vtcstaff: string,
ytmod: string,
mphelper: string,
mpplayer: string,
vtcmember: string
}
interface mainServerChannels {
console: string,
errors: string,
thismeanswar: string,
bot_status: string,
logs: string,
welcome: string,
botcommands: string
} }