From b7e0cea2b9ea54b90af9abe11d42f58193fdce13 Mon Sep 17 00:00:00 2001 From: Toast <96593068+AnxietyisReal@users.noreply.github.com> Date: Sun, 26 Nov 2023 13:27:09 +1100 Subject: [PATCH] Update MPModule.ts --- src/funcs/MPModule.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/funcs/MPModule.ts b/src/funcs/MPModule.ts index 2898b05..3be8b0d 100644 --- a/src/funcs/MPModule.ts +++ b/src/funcs/MPModule.ts @@ -17,11 +17,11 @@ export default async(client:TClient, Channel:string, Message:string, Server:TSer const serverErrorEmbed = new client.embed().setColor(client.config.embedColorRed).setTitle('Host did not respond back in time'); const genericEmbed = new client.embed(); const refreshIntervalText = 'Refreshes every 35 seconds.'; - let sessionInit = {signal: AbortSignal.timeout(8500),headers:{'User-Agent':'Daggerbot - HITALL/undici'}}; + let sessionInit = {signal: AbortSignal.timeout(8500),headers:{'User-Agent':`${client.user.username} - MPModule/undici`}}; try { const hitDSS = await fetch(Server.ip+'/feed/dedicated-server-stats.json?code='+Server.code, sessionInit).then(r=>r.json() as Promise); - const hitCSG = await fetch(Server.ip+'/feed/dedicated-server-savegame.html?code='+Server.code+'&file=careerSavegame', sessionInit).then(async r=>(new client.fxp.XMLParser({ignoreAttributes: false, transformAttributeName(attributeName){return attributeName.replaceAll('@_','')}}).parse(await r.text()) as any).careerSavegame as FSCareerSavegame); + const hitCSG = await fetch(Server.ip+'/feed/dedicated-server-savegame.html?code='+Server.code+'&file=careerSavegame', sessionInit).then(async r=>(new client.fxp.XMLParser({ignoreAttributes: false, attributeNamePrefix: ''}).parse(await r.text()) as any).careerSavegame as FSCareerSavegame); if (!hitDSS ?? !hitCSG){ if (hitDSS && !hitDSS.slots) return Logger.forwardToConsole('log', 'MPModule', `DSS failed with unknown slots table for ${client.MPServerCache[ServerName].name}`);