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

Fix any issues that rose upon.

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

View File

@ -1,2 +1,2 @@
@echo off @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, socketTimeoutMS: 30000,
family: 4 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')}) }).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=>{ fs.readdirSync('dist/events').forEach(async file=>{
const eventFile = await import(`./events/${file}`); const eventFile = await import(`./events/${file}`);
this.on(file.replace('.js', ''), async(...args)=>eventFile.default.run(this,...args)); 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)=>{ exec('git pull',(err:Error,stdout)=>{
if (err) clarkson.edit(`\`\`\`${removeUsername(err.message)}\`\`\``) 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 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: ()=>{ presence: ()=>{

View File

@ -99,7 +99,7 @@ export default {
}, },
players: async()=>{ players: async()=>{
const embed1 = new client.embed(); 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 // handle negative days
data.forEach((change: number, i: number) => { data.forEach((change: number, i: number) => {
if (change < 0) data[i] = data[i - 1] || data[i + 1] || 0; if (change < 0) data[i] = data[i - 1] || data[i + 1] || 0;