From 4067eac7305bfed1ac5b76829e6410bba352aa16 Mon Sep 17 00:00:00 2001 From: AnxietyisReal <96593068+AnxietyisReal@users.noreply.github.com> Date: Sun, 27 Aug 2023 01:03:14 +1000 Subject: [PATCH] Move dedicated files to functions folder --- src/client.ts | 2 +- src/{ => funcs}/DatabaseServer.ts | 4 ++-- src/{ => funcs}/MPLoop.ts | 4 ++-- src/index.ts | 2 +- tsconfig.json | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) rename src/{ => funcs}/DatabaseServer.ts (94%) rename src/{ => funcs}/MPLoop.ts (98%) diff --git a/src/client.ts b/src/client.ts index 93fc017..8813094 100644 --- a/src/client.ts +++ b/src/client.ts @@ -8,7 +8,7 @@ import punishments from './models/punishments.js'; import tags from './models/tagSystem.js'; import bonkCount from './models/bonkCount.js'; import MPServer from './models/MPServer.js'; -import DatabaseServer from './DatabaseServer.js'; +import DatabaseServer from './funcs/DatabaseServer.js'; import xjs from 'xml-js'; import moment from 'moment'; const tokens = JSON.parse(readFileSync('src/tokens.json', 'utf8')); diff --git a/src/DatabaseServer.ts b/src/funcs/DatabaseServer.ts similarity index 94% rename from src/DatabaseServer.ts rename to src/funcs/DatabaseServer.ts index d43c050..1eeaf12 100644 --- a/src/DatabaseServer.ts +++ b/src/funcs/DatabaseServer.ts @@ -1,4 +1,4 @@ -import TClient from './client'; +import TClient from '../client'; import mongoose from 'mongoose'; export default async(client:TClient)=>{ @@ -24,7 +24,7 @@ export default async(client:TClient)=>{ .on('disconnecting', ()=>console.log(client.logTime(), `${LogPrefix} Disconnecting from MongoDB`)) .on('disconnected', ()=>console.log(client.logTime(), `${LogPrefix} Disconnected from MongoDB`)) .on('close', ()=>console.log(client.logTime(), `${LogPrefix} MongoDB has closed the connection`)) - .on('reconnected', ()=>console.log(client.logTime(), `${LogPrefix} Re-establishing a connection to MongoDB`)) + .on('reconnected', ()=>console.log(client.logTime(), `${LogPrefix} Connection to MongoDB has been re-established`)) .on('all', ()=>console.log(client.logTime(), `${LogPrefix} Successfully established a connection to all members`)) .on('fullsetup', ()=>console.log(client.logTime(), `${LogPrefix} Successfully established a connection to Primary server & atleast one member`)) .on('error', ((err:mongoose.Error)=>console.error(client.logTime(), `${LogPrefix} Encountered an error in MongoDB: ${err.message}`))); diff --git a/src/MPLoop.ts b/src/funcs/MPLoop.ts similarity index 98% rename from src/MPLoop.ts rename to src/funcs/MPLoop.ts index 500cbbc..2277882 100644 --- a/src/MPLoop.ts +++ b/src/funcs/MPLoop.ts @@ -1,7 +1,7 @@ import Discord from 'discord.js'; -import TClient from './client'; +import TClient from '../client'; import {writeFileSync, readFileSync} from 'node:fs'; -import {FSPlayer, FSData, FSCareerSavegame, TServer} from './typings/interfaces'; +import {FSPlayer, FSData, FSCareerSavegame, TServer} from '../typings/interfaces'; export default async(client:TClient, Channel:string, Message:string, Server:TServer, ServerName:string)=>{ let MPLoopPrefix = '[MPLoop] '; diff --git a/src/index.ts b/src/index.ts index c1bab8b..132b255 100644 --- a/src/index.ts +++ b/src/index.ts @@ -2,7 +2,7 @@ import Discord from 'discord.js'; import TClient from './client.js'; const client = new TClient; client.init(); -import MPLoop from './MPLoop.js'; +import MPLoop from './funcs/MPLoop.js'; import {Player} from 'discord-player'; const player = Player.singleton(client); import {writeFileSync, readFileSync} from 'node:fs'; diff --git a/tsconfig.json b/tsconfig.json index 82249c8..4d5971f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -15,5 +15,5 @@ "typeRoots": [ "./src/typings" ], }, "include": [ "src/" ], - "exclude": [ ".yarn/cache", ".yarn/unplugged",".git", "src/config.json", "src/DB-Beta.config.json", "src/Toast-Testbot.config.json", "src/disabled" ] + "exclude": [ ".yarn/cache", ".yarn/unplugged",".git", "src/config.json", "src/DB-Beta.config.json", "src/Toast-Testbot.config.json" ] }