This repository was archived by the owner on Oct 12, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
50 lines (46 loc) · 1.76 KB
/
index.js
File metadata and controls
50 lines (46 loc) · 1.76 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
require("dotenv").config();
const { Client, Events, GatewayIntentBits, ActivityType } = require("discord.js");
const client = new Client({intents: [GatewayIntentBits.GuildMembers]});
client.login(process.env.TOKEN);
const setup = require("./bot/setup.js");
const state = require("./lib/state.js");
state.set("client", client);
client.on(Events.ClientReady, () => {
console.log("Bot connected to Discord");
client.user.setActivity("the SE comp scene", { type: ActivityType.Competing });
})
client.on(Events.InteractionCreate, async interaction => {
if (interaction.isChatInputCommand()) {
switch (interaction.commandName) {
case "pug":
await setup.createPug(interaction);
break;
case "register":
await setup.register(interaction);
break;
case "unregister":
await setup.unregister(interaction);
break;
default:
await interaction.reply("Sorry, this command isn't working at the moment.");
}
}
else if (interaction.isButton()) {
switch (interaction.customId) {
case "register":
await setup.register(interaction);
break;
default:
await interaction.reply({ content: "Sorry, this button isn't working at the moment.", ephemeral: true })
}
}
else if (interaction.isStringSelectMenu) {
switch (interaction.customId) {
case "registrationRegionSelect":
await setup.registerWithRegion(interaction);
break;
default:
await interaction.reply({ content: "Sorry, this select menu isn't working at the moment.", ephemeral: true })
}
}
});