-
Notifications
You must be signed in to change notification settings - Fork 0
/
bot.js
executable file
·78 lines (71 loc) · 1.68 KB
/
bot.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
import keepAlive from "./server.js";
import { config } from "dotenv";
import {
Client,
GatewayIntentBits,
Routes,
REST,
SlashCommandBuilder,
} from "discord.js";
import FanstayCommand from "./commands/fantasy.js";
import {
leaderboard,
score,
fixtureMenu,
aboutInt,
prevWinner,
} from "./interactions/interactionCom.js";
import { reminder } from "./commands/reminder.js";
/*
SYSTEM
*/
config();
const token = process.env.TOKEN;
const client_id = process.env.CLIENT_ID;
const guild_id = process.env.GUILD_ID;
const rest = new REST({ version: "10" }).setToken(token);
const about = new SlashCommandBuilder()
.setName("about")
.setDescription("About fantasy bot")
.toJSON();
export const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
],
});
client.on("ready", () => {
console.log(`Logged in as THE ${client.user.tag}!`);
setInterval(reminder, 60000);
keepAlive();
client.user.setPresence({
activities: [
{
name: "my code",
type: "WATCHING",
},
],
status: "idle",
});
});
(async () => {
const commands = [FanstayCommand, about];
try {
console.log("Started refreshing application (/) commands.");
await rest.put(Routes.applicationGuildCommands(client_id, guild_id), {
body: commands,
});
await client.login(token);
} catch (error) {
console.log(error);
}
})();
/*
INTERACTIONS
*/
client.on(leaderboard.name, leaderboard.execute);
client.on(score.name, score.execute);
client.on(fixtureMenu.name, fixtureMenu.execute);
client.on(prevWinner.name, prevWinner.execute);
client.on(aboutInt.name, aboutInt.execute);