-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
74 lines (58 loc) · 1.49 KB
/
index.js
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
const { Client, Collection, GatewayIntentBits, ActivityFlagsBitField, Partials } = require('discord.js');
const { logInfo, logError, logSuccess } = require("./helpers/log");
const axios = require('axios');
require('dotenv').config()
const Sentry = require("@sentry/node");
const Tracing = require("@sentry/tracing");
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMembers
],
partials: [
Partials.GuildMember
],
presence: {
status: 'online'
}
});
client.config = process.env;
Sentry.init({
dsn: client.config.SENTRY_URL,
tracesSampleRate: 1.0,
});
client.sentry = Sentry;
const transaction = Sentry.startTransaction({
op: "initial",
name: "Bot Startup",
});
module.exports = client;
client.commands = new Collection();
client.subCommands = new Collection();
client.modals = new Collection();
client.selectCache = new Collection();
client.getDiscordUser = (id, guild = false) => {
if(client.user.id === id) {
return false;
}
if(guild) {
return guild.members.cache.find(u => u.id === id && !u.bot && !u.system);
}
return client.users.cache.find(u => u.id === id && !u.bot && !u.system);
}
require('./bot.js')(client);
client.login(client.config.TOKEN).then(r => {
client.user.setPresence({
activities: [{
name: process.env.STATUS
}]
})
logInfo("Client connected to Discord")
transaction.finish();
setInterval(() => {
axios.get(client.config.KUMA_URL)
.catch(() => {
console.log("Unable to update Kuma")
});
}, 60*1000)
});