mirror of
https://github.com/toast-ts/Daggerbot-TS.git
synced 2024-12-29 01:25:38 -05:00
Rename fetch, as Nodejs uses undici under the hood
This commit is contained in:
parent
403b28ae40
commit
15ee06a88e
@ -178,7 +178,7 @@ export default class TClient extends Client {
|
|||||||
let Data:any;
|
let Data:any;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await fetch(`https://www.youtube.com/feeds/videos.xml?channel_id=${YTChannelID}`, {signal: AbortSignal.timeout(6000),headers:{'User-Agent':`Daggerbot - Notification/fetch`}}).then(async xml=>Data = this.xjs.xml2js(await xml.text(), {compact: true}))
|
await fetch(`https://www.youtube.com/feeds/videos.xml?channel_id=${YTChannelID}`, {signal: AbortSignal.timeout(6000),headers:{'User-Agent':`Daggerbot - Notification/undici`}}).then(async xml=>Data = this.xjs.xml2js(await xml.text(), {compact: true}))
|
||||||
} catch(err){
|
} catch(err){
|
||||||
console.log(this.logTime(), `${YTChannelName} YT fail`)
|
console.log(this.logTime(), `${YTChannelName} YT fail`)
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ export default {
|
|||||||
if (interaction.channelId === '468835769092669461' && !client.isStaff(interaction.member) && ['status', 'players'].includes(interaction.options.getSubcommand())) return interaction.reply('Please use <#739084625862852715> for `/mp status/players` commands to prevent clutter in this channel.').then(()=>setTimeout(()=>interaction.deleteReply(), 6000));
|
if (interaction.channelId === '468835769092669461' && !client.isStaff(interaction.member) && ['status', 'players'].includes(interaction.options.getSubcommand())) return interaction.reply('Please use <#739084625862852715> for `/mp status/players` commands to prevent clutter in this channel.').then(()=>setTimeout(()=>interaction.deleteReply(), 6000));
|
||||||
|
|
||||||
const database = await client.MPServer._content.findById(interaction.guildId);
|
const database = await client.MPServer._content.findById(interaction.guildId);
|
||||||
const endpoint = await fetch(database[serverSelector].ip+'/feed/dedicated-server-stats.json?code='+database[serverSelector].code, {signal: AbortSignal.timeout(7500),headers:{'User-Agent':`Daggerbot - MPdata/fetch`}}).then(r=>r.json() as Promise<FSData>);
|
const endpoint = await fetch(database[serverSelector].ip+'/feed/dedicated-server-stats.json?code='+database[serverSelector].code, {signal: AbortSignal.timeout(7500),headers:{'User-Agent':`Daggerbot - MPdata/undici`}}).then(r=>r.json() as Promise<FSData>);
|
||||||
const embed = new client.embed();
|
const embed = new client.embed();
|
||||||
({
|
({
|
||||||
players: async()=>{
|
players: async()=>{
|
||||||
|
@ -19,7 +19,7 @@ export default async(client:TClient, Channel:string, Message:string, Server:TSer
|
|||||||
}
|
}
|
||||||
|
|
||||||
const HITALL = async()=>{
|
const HITALL = async()=>{
|
||||||
let sessionInit = {signal: AbortSignal.timeout(7500),headers:{'User-Agent':`Daggerbot - HITALL/fetch`}};
|
let sessionInit = {signal: AbortSignal.timeout(7500),headers:{'User-Agent':`Daggerbot - HITALL/undici`}};
|
||||||
try {
|
try {
|
||||||
const hitDSS = await fetch(Server.ip+'/feed/dedicated-server-stats.json?code='+Server.code, sessionInit).then(r=>r.json() as Promise<FSData>);
|
const hitDSS = await fetch(Server.ip+'/feed/dedicated-server-stats.json?code='+Server.code, sessionInit).then(r=>r.json() as Promise<FSData>);
|
||||||
const hitCSG = await fetch(Server.ip+'/feed/dedicated-server-savegame.html?code='+Server.code+'&file=careerSavegame', sessionInit).then(async r=>(client.xjs.xml2js(await r.text(), {compact: true}) 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=>(client.xjs.xml2js(await r.text(), {compact: true}) as any).careerSavegame as FSCareerSavegame);
|
||||||
|
Loading…
Reference in New Issue
Block a user