-
Notifications
You must be signed in to change notification settings - Fork 72
Expand file tree
/
Copy pathindex.js
More file actions
83 lines (72 loc) · 2.86 KB
/
index.js
File metadata and controls
83 lines (72 loc) · 2.86 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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/*
____ ____ __ __ __ __ _
/ __ \____ _____ / __ )____ / /_ / / / /___ _____/ /_(_)___ ____ _
/ / / / __ `/ __ \/ __ / __ \/ __/ / /_/ / __ \/ ___/ __/ / __ \/ __ `/
/ /_/ / /_/ / / / / /_/ / /_/ / /_ / __ / /_/ (__ ) /_/ / / / / /_/ /
/_____/\__,_/_/ /_/_____/\____/\__/ /_/ /_/\____/____/\__/_/_/ /_/\__, /
Free Hosting forever! /____/
*/
;(async () => {
const fs = require("fs");
const Discord = require("discord.js");
const Sentry = require("@sentry/node");
//const { nodeProfilingIntegration } = require("@sentry/profiling-node");
const Config = require("./config.json");
const { initDB } = require("./src/database.js");
//Starting MySQL Database and initialising tables.
await initDB();
global.moment = require("moment");
//Sentry.io Error Tracking.
await Sentry.init({
dsn: Config.SentryLogging.dsn,
// integrations: [
// nodeProfilingIntegration(),
// ],
tracesSampleRate: 1.0, // Capture 100% of the transactions.
});
module.exports.Sentry = Sentry;
process.on("unhandledRejection", (Error) => Sentry.captureException(Error));
//Discord Bot:
const client = new Discord.Client({
intents: [
Discord.GatewayIntentBits.Guilds,
Discord.GatewayIntentBits.GuildMembers,
Discord.GatewayIntentBits.GuildModeration,
Discord.GatewayIntentBits.GuildIntegrations,
Discord.GatewayIntentBits.GuildPresences,
Discord.GatewayIntentBits.GuildMessages,
Discord.GatewayIntentBits.GuildMessageReactions,
Discord.GatewayIntentBits.GuildMessageTyping,
Discord.GatewayIntentBits.DirectMessages,
Discord.GatewayIntentBits.DirectMessageReactions,
Discord.GatewayIntentBits.DirectMessageTyping,
Discord.GatewayIntentBits.MessageContent
],
partials: [
Discord.Partials.Channel,
Discord.Partials.Message,
Discord.Partials.Reaction
],
presence: {
activities: [
{
name: "Managing DanBot Hosting"
}
]
}
});
//Event Handler.
fs.readdir("./src/events/", (err, files) => {
files = files.filter((f) => f.endsWith(".js"));
files.forEach((f) => {
const event = require(`./src/events/${f}`);
client.on(f.split(".")[0], event.bind(null, client));
delete require.cache[require.resolve(`./src/events/${f}`)];
});
});
//Server Creation:
await require('./createData_Prem.js').initialStart();
await require('./createData.js').initialStart();
await require('./createData_Private.js').initialStart();
client.login(Config.DiscordBot.Token);
})();