1
0
mirror of https://github.com/toast-ts/Daggerbot-TS.git synced 2024-11-17 20:30:58 -05:00

Compare commits

...

3 Commits

Author SHA1 Message Date
toast-ts
f7f3db7c90 Intrusive thought won 2024-04-11 17:26:50 +10:00
toast-ts
6eb0298238 Causing issues in container environment due to dockerignore file 2024-04-11 17:19:42 +10:00
toast-ts
7e105f8a1e Fix /mp status and fetchPlayerData function 2024-04-11 17:15:12 +10:00
4 changed files with 6 additions and 5 deletions

View File

@ -81,7 +81,7 @@ export default class Developer {
if (interaction.replied) interaction.followUp(update_success); if (interaction.replied) interaction.followUp(update_success);
else interaction.reply(update_success); else interaction.reply(update_success);
}; };
exec('git pull --rebase', {windowsHide:true}, (err:Error, stdout)=>{ exec('git pull', {windowsHide:true}, (err:Error, stdout)=>{
if (err) hammondYouIdiot.edit(`\`\`\`${UsernameHelper(err.message)}\`\`\``); if (err) hammondYouIdiot.edit(`\`\`\`${UsernameHelper(err.message)}\`\`\``);
else if (stdout.includes('Already up to date')) hammondYouIdiot.edit('Repository is currently up to date.'); else if (stdout.includes('Already up to date')) hammondYouIdiot.edit('Repository is currently up to date.');
else hammondYouIdiot.edit('Running `yarn tsc`...').then(()=>exec('yarn tsc', {windowsHide:true}, (err:Error)=>{ else hammondYouIdiot.edit('Running `yarn tsc`...').then(()=>exec('yarn tsc', {windowsHide:true}, (err:Error)=>{

View File

@ -93,10 +93,10 @@ export default class MP {
if (!DSS) return console.log('Endpoint failed - status'); if (!DSS) return console.log('Endpoint failed - status');
DSS.server ? await interaction.reply({embeds: [new client.embed().setColor(client.config.embedColor).addFields( 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: 'Players', value: `${DSS?.slots.used}/${DSS?.slots.capacity}`},
{name: 'Map', value: DSS?.server.mapName ?? 'Unavailable'} {name: 'Map', value: DSS.server?.mapName.length > 0 ? DSS.server.mapName : 'No map'}
).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 ).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()=>{ pallets: async()=>{
const DSS = await fetchData(client, interaction, choiceSelector) as FSData; const DSS = await fetchData(client, interaction, choiceSelector) as FSData;

View File

@ -13,7 +13,7 @@ export default ()=>{
'traffic light', 'bridge', 'traffic light', 'bridge',
'fountain', 'dumpster', 'fountain', 'dumpster',
'mailbox', 'parking meter', 'mailbox', 'parking meter',
'bus', 'truck' 'bus', 'truck', 'glass door'
] as string[]; ] as string[];
return ranIntoSomething[Math.floor(Math.random()*ranIntoSomething.length)]; return ranIntoSomething[Math.floor(Math.random()*ranIntoSomething.length)];
} }

View File

@ -57,6 +57,7 @@ export class MPServerSvc {
} }
async fetchPlayerData(serverName:string) { async fetchPlayerData(serverName:string) {
const server = await this.model.findOne({where: {serverName}}); const server = await this.model.findOne({where: {serverName}});
if (!server) return [];
return server.dataValues.playerData ??= []; return server.dataValues.playerData ??= [];
} }
async addServer(serverName:string, ip:string, code:string) { async addServer(serverName:string, ip:string, code:string) {