1
0
mirror of https://github.com/toast-ts/Daggerbot-TS.git synced 2024-12-28 13:05:38 -05:00
This commit is contained in:
AnxietyisReal 2022-12-19 15:22:28 +11:00
parent a88b32161d
commit 1ba3826f76
2 changed files with 7 additions and 5 deletions

View File

@ -4,6 +4,8 @@ import { Database } from './database';
import timeNames from './timeNames';
import { Punishment, formatTimeOpt, createTableOpt, punOpt } from './typings/interfaces';
import MPDB from './models/MPServer';
import axios from 'axios';
import moment from 'moment';
export class TClient extends Client {
invites: Map<any, any>;
commands: Discord.Collection<string, any>;
@ -15,9 +17,9 @@ export class TClient extends Client {
collection: any;
messageCollector: any;
attachmentBuilder: any;
moment: any;
moment: typeof moment;
xjs: any;
axios: any;
axios: typeof axios;
ms: any;
userLevels: userLevels;
punishments: punishments;
@ -52,9 +54,9 @@ export class TClient extends Client {
this.collection = Discord.Collection;
this.messageCollector = Discord.MessageCollector;
this.attachmentBuilder = Discord.AttachmentBuilder;
this.moment = require('moment');
this.moment = moment;
this.xjs = require('xml-js');
this.axios = require('axios');
this.axios = axios;
this.ms = require('ms');
this.userLevels = new userLevels(this);
this.bonkCount = new bonkCount(this);

View File

@ -74,7 +74,7 @@ setInterval(async()=>{
};
if (!verifyURL) return msg.edit({content: 'Invalid gameserver IP, please update!', embeds: null})
async function serverData(client:TClient, URL: string){
return await client.axios.get(URL, {timeout: 4000, headers: {'User-Agent': `Daggerbot/axios ${client.axios.version}`}}).catch((error:Error)=>error.message)
return await client.axios.get(URL, {timeout: 4000, headers: {'User-Agent': `Daggerbot/axios ${client.axios.VERSION}`}}).catch((error:Error)=>error.message)
}
await Promise.all([serverData(client, completedURL_DSS), serverData(client, completedURL_CSG)]).then(function(results){
if (typeof results[0] == 'string'){