1
0
mirror of https://github.com/toast-ts/Daggerbot-TS.git synced 2024-11-17 16:30:58 -05:00
This commit is contained in:
AnxietyisReal 2022-12-19 15:22:28 +11:00
parent 91839364d5
commit 63c5717ccd
2 changed files with 7 additions and 5 deletions

View File

@ -4,6 +4,8 @@ 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 } from './typings/interfaces';
import MPDB from './models/MPServer'; import MPDB from './models/MPServer';
import axios from 'axios';
import moment from 'moment';
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>;
@ -15,9 +17,9 @@ export class TClient extends Client {
collection: any; collection: any;
messageCollector: any; messageCollector: any;
attachmentBuilder: any; attachmentBuilder: any;
moment: any; moment: typeof moment;
xjs: any; xjs: any;
axios: any; axios: typeof axios;
ms: any; ms: any;
userLevels: userLevels; userLevels: userLevels;
punishments: punishments; punishments: punishments;
@ -52,9 +54,9 @@ export class TClient extends Client {
this.collection = Discord.Collection; this.collection = Discord.Collection;
this.messageCollector = Discord.MessageCollector; this.messageCollector = Discord.MessageCollector;
this.attachmentBuilder = Discord.AttachmentBuilder; this.attachmentBuilder = Discord.AttachmentBuilder;
this.moment = require('moment'); this.moment = moment;
this.xjs = require('xml-js'); this.xjs = require('xml-js');
this.axios = require('axios'); this.axios = axios;
this.ms = require('ms'); this.ms = require('ms');
this.userLevels = new userLevels(this); this.userLevels = new userLevels(this);
this.bonkCount = new bonkCount(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}) if (!verifyURL) return msg.edit({content: 'Invalid gameserver IP, please update!', embeds: null})
async function serverData(client:TClient, URL: string){ 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){ await Promise.all([serverData(client, completedURL_DSS), serverData(client, completedURL_CSG)]).then(function(results){
if (typeof results[0] == 'string'){ if (typeof results[0] == 'string'){