-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbot.js
More file actions
31 lines (26 loc) · 1.18 KB
/
bot.js
File metadata and controls
31 lines (26 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
require('module-alias/register');
const BotClient = require('@structures/bot/Client.js');
const client = new BotClient({
intents: [
'Guilds', 'GuildBans',
'GuildEmojisAndStickers',
'GuildIntegrations', 'GuildWebhooks',
'GuildInvites', 'DirectMessages',
'GuildMessages', 'GuildMessageReactions'
]
});
client.login(client.config.token);
String.prototype.toProperCase = function () {
return this.replace(/([^\W_]+[^\s-]*) */g, (txt) => `${txt.charAt(0).toUpperCase() + txt.slice(1).toLowerCase()}`);
};
// These 2 process methods will catch exceptions and give *more details* about the error and stack trace.
process.on("uncaughtException", (err) => {
const errorMsg = err.stack.replace(new RegExp(`${__dirname}/`, "g"), "./");
console.error("Uncaught Exception: ", errorMsg);
client.webhooks.error.send({content: `**${client.user.username} - uncaughtException:**\n\`\`\`\n${err.stack}`.slice(0,1995)+'\`\`\`' })
// process.exit(1);
});
process.on("unhandledRejection", err => {
console.error("Uncaught Promise Error: ", err);
client.webhooks.error.send({content: `**${client.user.username} - unhandledRejection:**\n\`\`\`\n${err.stack}`.slice(0,1995)+'\`\`\`' })
});