botJS #1
21
bot.js
21
bot.js
|
@ -1,6 +1,9 @@
|
|||
const { REST } = require('@discordjs/rest');
|
||||
const { Routes } = require('discord-api-types/v9');
|
||||
|
||||
const { Client, Intents } = require('discord.js');
|
||||
const CLIENT = new Client({ intents: [Intents.FLAGS.GUILDS] });
|
||||
|
||||
const TOKEN = process.env.TOKEN;
|
||||
const GUILD = "42ctf";
|
||||
|
||||
|
@ -9,6 +12,12 @@ const commands = [{
|
|||
description: 'connect to discord'
|
||||
}];
|
||||
|
||||
const roles = new Map([
|
||||
['top1', 798638767359524875],
|
||||
['top10', 801787467064672286],
|
||||
['top50', 803729539145924649]
|
||||
]);
|
||||
|
||||
const rest = new REST({ version: '9' }).setToken(TOKEN);
|
||||
|
||||
(async () => {
|
||||
|
@ -26,14 +35,12 @@ const rest = new REST({ version: '9' }).setToken(TOKEN);
|
|||
}
|
||||
})();
|
||||
|
||||
const { Client, Intents } = require('discord.js');
|
||||
const client = new Client({ intents: [Intents.FLAGS.GUILDS] });
|
||||
|
||||
client.on('ready', () => {
|
||||
console.log(`Logged in as ${client.user.tag}!`);
|
||||
Client.on('ready', () => {
|
||||
console.log(`Logged in as ${Client.user.tag}!`);
|
||||
guild = Utils.get(Client.guilds, Guild.name=GUILD);
|
||||
});
|
||||
|
||||
client.on('interactionCreate', async interaction => {
|
||||
Client.on('interactionCreate', async interaction => {
|
||||
if (!interaction.isCommand()) return;
|
||||
|
||||
if (interaction.commandName === 'connect') {
|
||||
|
@ -41,4 +48,4 @@ client.on('interactionCreate', async interaction => {
|
|||
}
|
||||
});
|
||||
|
||||
client.login('token');
|
||||
Client.login(TOKEN);
|
||||
|
|
Loading…
Reference in New Issue