1
0
mirror of https://github.com/toast-ts/Daggerbot-TS.git synced 2024-12-27 04:15:38 -05:00

Fix any issues that rose upon.

This commit is contained in:
AnxietyisReal 2023-04-14 21:05:55 +10:00
parent 5f457c2604
commit d8506b7d21
4 changed files with 4 additions and 4 deletions

View File

@ -1,2 +1,2 @@
@echo off
pm2 start src/index.ts --name Daggerbot -i 1
pm2 start dist/index.js --name Daggerbot

View File

@ -101,7 +101,7 @@ export default class TClient extends Client {
socketTimeoutMS: 30000,
family: 4
}).then(()=>console.log(this.logTime(), 'Successfully connected to MongoDB')).catch((err)=>{console.error(this.logTime(), `Failed to connect to MongoDB\n${err.reason}`); exec('pm2 stop Daggerbot')})
await this.login(this.tokens.beta);
await this.login(this.tokens.main);
fs.readdirSync('dist/events').forEach(async file=>{
const eventFile = await import(`./events/${file}`);
this.on(file.replace('.js', ''), async(...args)=>eventFile.default.run(this,...args));

View File

@ -67,7 +67,7 @@ export default {
exec('git pull',(err:Error,stdout)=>{
if (err) clarkson.edit(`\`\`\`${removeUsername(err.message)}\`\`\``)
else if (stdout.includes('Already up to date')) clarkson.edit('Bot is already up to date with the repository, did you forgor to push the changes? :skull:')
else setTimeout(()=>clarkson.edit(`Commit: **${fetchCommitMsg}**\nCommit author: **${fetchCommitAuthor}**\n\nUptime before restarting: **${client.formatTime(client.uptime as number, 3, {commas: true, longNames: true})}**`).then(()=>exec('pm2 restart Daggerbot')),650)
else setTimeout(()=>clarkson.edit(`Commit: **${fetchCommitMsg}**\nCommit author: **${fetchCommitAuthor}**\n\nUptime before restarting: **${client.formatTime(client.uptime as number, 3, {commas: true, longNames: true})}**`).then(()=>exec('tsc && pm2 restart Daggerbot')),650)
});
},
presence: ()=>{

View File

@ -99,7 +99,7 @@ export default {
},
players: async()=>{
const embed1 = new client.embed();
const data = JSON.parse(fs.readFileSync(path.join(__dirname, '../database/MPPlayerData.json'), {encoding: 'utf8'})).slice(client.statsGraph)
const data = JSON.parse(fs.readFileSync(path.join('src/database/MPPlayerData.json'), {encoding: 'utf8'})).slice(client.statsGraph)
// handle negative days
data.forEach((change: number, i: number) => {
if (change < 0) data[i] = data[i - 1] || data[i + 1] || 0;