mirror of
https://github.com/toast-ts/Daggerbot-TS.git
synced 2024-11-17 20:30:58 -05:00
Fix /mp status
and fetchPlayerData
function
This commit is contained in:
parent
29bf036c91
commit
7e105f8a1e
@ -93,10 +93,10 @@ export default class MP {
|
||||
if (!DSS) return console.log('Endpoint failed - status');
|
||||
|
||||
DSS.server ? await interaction.reply({embeds: [new client.embed().setColor(client.config.embedColor).addFields(
|
||||
{name: 'Name', value: DSS.server?.name?.length < 1 ? '*`Offline`*' : `\`${DSS?.server?.name}\``},
|
||||
{name: 'Name', value: `\`${DSS.server?.name.length > 0 ? DSS.server.name : 'Offline'}\``},
|
||||
{name: 'Players', value: `${DSS?.slots.used}/${DSS?.slots.capacity}`},
|
||||
{name: 'Map', value: DSS?.server.mapName ?? 'Unavailable'}
|
||||
).setFooter({text: `Version: ${DSS?.server?.version} | Time: ${`${('0'+Math.floor((DSS?.server.dayTime/3600/1000))).slice(-2)}:${('0'+Math.floor((DSS?.server.dayTime/60/1000)%60)).slice(-2)}`}`})]}) : null
|
||||
{name: 'Map', value: DSS.server?.mapName.length > 0 ? DSS.server.mapName : 'No map'}
|
||||
).setFooter({text: `Version: ${DSS?.server?.version.length > 0 ? DSS?.server?.version : '0.0.0.0'} | Time: ${`${('0'+Math.floor((DSS?.server.dayTime/3600/1000))).slice(-2)}:${('0'+Math.floor((DSS?.server.dayTime/60/1000)%60)).slice(-2)}`}`})]}) : null
|
||||
},
|
||||
pallets: async()=>{
|
||||
const DSS = await fetchData(client, interaction, choiceSelector) as FSData;
|
||||
|
@ -57,6 +57,7 @@ export class MPServerSvc {
|
||||
}
|
||||
async fetchPlayerData(serverName:string) {
|
||||
const server = await this.model.findOne({where: {serverName}});
|
||||
if (!server) return [];
|
||||
return server.dataValues.playerData ??= [];
|
||||
}
|
||||
async addServer(serverName:string, ip:string, code:string) {
|
||||
|
Loading…
Reference in New Issue
Block a user