mirror of
https://github.com/toast-ts/Daggerbot-TS.git
synced 2024-11-17 04:10:59 -05:00
Will continue investigation later.
This commit is contained in:
parent
abb095b880
commit
2bd5a41571
@ -93,13 +93,14 @@ export default class TClient extends Client {
|
||||
async init(){
|
||||
mongoose.set('strictQuery', true);
|
||||
await mongoose.connect(this.tokens.mongodb_uri, {
|
||||
replicaSet: 'toastyy',
|
||||
autoIndex: true,
|
||||
serverSelectionTimeoutMS: 12000,
|
||||
socketTimeoutMS: 30000,
|
||||
family: 4,
|
||||
keepAlive: true,
|
||||
waitQueueTimeoutMS: 50000
|
||||
}).then(()=>console.log(this.logTime(), 'Successfully connected to MongoDB')).catch(()=>{console.log(this.logTime(), 'Failed to connect to MongoDB'); exec('pm2 stop Daggerbot')})
|
||||
serverSelectionTimeoutMS: 15000,
|
||||
waitQueueTimeoutMS: 50000,
|
||||
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.main);
|
||||
const commandFiles = fs.readdirSync('src/commands').filter(file=>file.endsWith('.ts'));
|
||||
for (const file of commandFiles){
|
||||
|
@ -29,10 +29,10 @@ function DZ(error:Error, location:string){// Yes, I may have shiternet but I don
|
||||
const channel = client.channels.resolve(client.config.mainServer.channels.errors) as Discord.TextChannel | null
|
||||
channel?.send({embeds: [new client.embed().setColor('#420420').setTitle('Error caught!').setFooter({text: location}).setDescription(`**Error:** \`${error.message}\`\n\n**Stack:** \`${`${error.stack}`.slice(0, 2500)}\``)]})
|
||||
}
|
||||
process.on('unhandledRejection', async(error: Error)=>DZ(error, 'unhandledRejection'));
|
||||
process.on('uncaughtException', async(error: Error)=>DZ(error, 'uncaughtException'));
|
||||
process.on('error', async(error: Error)=>DZ(error, 'process-error'));
|
||||
client.on('error', async(error: Error)=>DZ(error, 'client-error'));
|
||||
process.on('unhandledRejection', (error: Error)=>DZ(error, 'unhandledRejection'));
|
||||
process.on('uncaughtException', (error: Error)=>DZ(error, 'uncaughtException'));
|
||||
process.on('error', (error: Error)=>DZ(error, 'process-error'));
|
||||
client.on('error', (error: Error)=>DZ(error, 'client-error'));
|
||||
|
||||
// Daggerwin MP loop
|
||||
setInterval(async()=>{
|
||||
|
Loading…
Reference in New Issue
Block a user