From 965c7aedf119f821c557db1abb0237fefcaa9d0f Mon Sep 17 00:00:00 2001 From: AnxietyisReal <96593068+AnxietyisReal@users.noreply.github.com> Date: Thu, 29 Dec 2022 21:10:13 +1100 Subject: [PATCH] Add types for tokens and configs --- src/client.ts | 12 ++++---- src/typings/interfaces.d.ts | 60 ++++++++++++++++++++++++++++++++++++- 2 files changed, 66 insertions(+), 6 deletions(-) diff --git a/src/client.ts b/src/client.ts index 2ec42c3..1cc7b39 100644 --- a/src/client.ts +++ b/src/client.ts @@ -2,16 +2,18 @@ import Discord, { Client, GatewayIntentBits, Partials } from 'discord.js'; import fs from 'node:fs'; import { Database } from './database'; 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 axios from 'axios'; import moment from 'moment'; +import tokens from './tokens.json'; +import config from './config.json'; export class TClient extends Client { invites: Map; commands: Discord.Collection; registry: Array; - config: any; - tokens: any; + config: Config; + tokens: Tokens; YTCache: any; embed: typeof Discord.EmbedBuilder; collection: any; @@ -44,8 +46,8 @@ export class TClient extends Client { this.invites = new Map(); this.commands = new Discord.Collection(); this.registry = []; - this.config = require('./config.json'); - this.tokens = require('./tokens.json'); + this.config = config as Config; + this.tokens = tokens as Tokens; this.YTCache = { 'UCQ8k8yTDLITldfWYKDs3xFg': undefined, // Daggerwin 'UCguI73--UraJpso4NizXNzA': undefined // Machinery Restorer diff --git a/src/typings/interfaces.d.ts b/src/typings/interfaces.d.ts index fab37ef..e04ec08 100644 --- a/src/typings/interfaces.d.ts +++ b/src/typings/interfaces.d.ts @@ -1,4 +1,4 @@ -import Discord from 'discord.js'; +import Discord, { ColorResolvable } from 'discord.js'; export interface UserLevels { messages: number, @@ -122,4 +122,62 @@ interface slotUsage { } interface XMLText { _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 +} +interface mainServer { + id: string, + staffRoles: Array, + 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 } \ No newline at end of file