-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
32 lines (27 loc) · 1.12 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
const { AttachmentPayload, ChatInputCommandInteraction, Client, DiscordAPIError, GatewayIntentBits, Message, Partials, REST, Routes } = require("discord.js");
const { TOKEN: token, CLIENT_ID: clientID } = process.env;
if (!token || !clientID)
throw new Error("Missing environment variables");
const rest = new REST({ version: "10" }).setToken(token);
(async () => {
console.log("Started refreshing slash (/) commands.");
await rest.put(
Routes.applicationCommands(clientID),
// { body: commands.map(c => c.data) }
);
})()
.then(() => console.log(`Successfully refreshed slash (/) command`))
.catch((error) => console.error("An error has occurred in refreshing slash (/) command", error));
const discordClient = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.DirectMessages,
GatewayIntentBits.MessageContent,
],
partials: [
Partials.Channel,
],
});
discordClient.login(token).then(async () => console.log("Logged in as " + discordClient.user?.tag));