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
6341c8d4a2
commit
b2bac41acd
@ -93,13 +93,14 @@ export default class TClient extends Client {
|
|||||||
async init(){
|
async init(){
|
||||||
mongoose.set('strictQuery', true);
|
mongoose.set('strictQuery', true);
|
||||||
await mongoose.connect(this.tokens.mongodb_uri, {
|
await mongoose.connect(this.tokens.mongodb_uri, {
|
||||||
|
replicaSet: 'toastyy',
|
||||||
autoIndex: true,
|
autoIndex: true,
|
||||||
serverSelectionTimeoutMS: 12000,
|
|
||||||
socketTimeoutMS: 30000,
|
|
||||||
family: 4,
|
|
||||||
keepAlive: true,
|
keepAlive: true,
|
||||||
waitQueueTimeoutMS: 50000
|
serverSelectionTimeoutMS: 15000,
|
||||||
}).then(()=>console.log(this.logTime(), 'Successfully connected to MongoDB')).catch(()=>{console.log(this.logTime(), 'Failed to connect to MongoDB'); exec('pm2 stop Daggerbot')})
|
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);
|
await this.login(this.tokens.main);
|
||||||
const commandFiles = fs.readdirSync('src/commands').filter(file=>file.endsWith('.ts'));
|
const commandFiles = fs.readdirSync('src/commands').filter(file=>file.endsWith('.ts'));
|
||||||
for (const file of commandFiles){
|
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
|
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)}\``)]})
|
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('unhandledRejection', (error: Error)=>DZ(error, 'unhandledRejection'));
|
||||||
process.on('uncaughtException', async(error: Error)=>DZ(error, 'uncaughtException'));
|
process.on('uncaughtException', (error: Error)=>DZ(error, 'uncaughtException'));
|
||||||
process.on('error', async(error: Error)=>DZ(error, 'process-error'));
|
process.on('error', (error: Error)=>DZ(error, 'process-error'));
|
||||||
client.on('error', async(error: Error)=>DZ(error, 'client-error'));
|
client.on('error', (error: Error)=>DZ(error, 'client-error'));
|
||||||
|
|
||||||
// Daggerwin MP loop
|
// Daggerwin MP loop
|
||||||
setInterval(async()=>{
|
setInterval(async()=>{
|
||||||
|
Loading…
Reference in New Issue
Block a user