-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
100 lines (90 loc) · 2.48 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
const {
Client,
ActivityType,
Partials,
GatewayIntentBits,
Collection,
} = require("discord.js");
const fs = require("fs");
const {
Guilds,
GuildMembers,
GuildMessages,
MessageContent,
GuildMessageReactions,
GuildVoiceStates,
} = GatewayIntentBits;
const { User, Message, GuildMember, ThreadMember } = Partials;
const { ReactionRole } = require("discordjs-reaction-role");
const discordModals = require("discord-modals");
const client = new Client({
intents: [
GuildVoiceStates,
Guilds,
GuildMembers,
GuildMessages,
MessageContent,
GuildMessageReactions,
],
partials: [User, Message, GuildMember, ThreadMember],
});
const { loadEvents } = require("./Handlers/eventHandler");
const { loadConfig } = require("./Functions/configLoader");
client.config = require("./config.json");
client.events = new Collection();
client.commands = new Collection();
client.subCommands = new Collection();
client.guildConfig = new Collection();
client.aliases = new Collection();
client.userSettings = new Collection();
client.maintenanced = false;
client.buttons = new Collection();
const { connect } = require("mongoose");
connect(client.config.MONGODB_SRV, {}).then(() =>
console.log(`Client is connected to the DataBase.`)
);
const { GiveawaysManager } = require("discord-giveaways");
const manager = new GiveawaysManager(client, {
storage: "./giveaways.json",
default: {
botsCanWin: false,
embedColor: "#000000",
embedColorEnd: "#ff0000",
reaction: "<a:WhiteCrown:977502005775970304>",
},
});
client.giveawaysManager = manager;
client.giveawaysManager.on(
"giveawayReactionAdded",
(giveaway, member, reaction) => {
console.log(
`${member.user.tag} entered giveaway #${giveaway.messageId} (${reaction.emoji.name})`
);
}
);
client.giveawaysManager.on(
"giveawayReactionRemoved",
(giveaway, member, reaction) => {
console.log(
`${member.user.tag} unreact to giveaway #${giveaway.messageId} (${reaction.emoji.name})`
);
}
);
client.giveawaysManager.on("giveawayEnded", (giveaway, winners) => {
console.log(
`Giveaway #${giveaway.messageId} ended! Winners: ${winners
.map((member) => member.user.username)
.join(", ")}`
);
});
const rr = new ReactionRole(client, [
{
messageId: "1074336328470233248",
reaction: "<:check:1074331873632862288>",
roleId: "1070725604003041310",
}, // Custom emoji by ID
]);
loadEvents(client);
loadConfig(client);
discordModals(client);
client.login(client.config.TOKEN);