Bot core (operationel)

This commit is contained in:
RoyaLProg 2022-02-16 16:06:25 +01:00
parent 5c3a40598e
commit 01e10e4506
2 changed files with 15 additions and 13 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
.vscode

26
bot.js
View File

@ -1,21 +1,20 @@
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";
const TOKEN = "OTQzNTA2NTgxMjkzNzc2OTQ3.Yg0C-g.XOjFinUc-Gt1gwtrSILPb0Mlspo";
const GUILD = "42CTFDEV";
const commands = [{
name: 'connect',
description: 'connect to discord'
description: 'connect to discord',
}];
const roles = new Map([
['top1', 798638767359524875],
['top10', 801787467064672286],
['top50', 803729539145924649]
['top1', "798638767359524875"],
['top10', "801787467064672286"],
['top50', "803729539145924649"]
]);
const rest = new REST({ version: '9' }).setToken(TOKEN);
@ -25,7 +24,7 @@ const rest = new REST({ version: '9' }).setToken(TOKEN);
console.log('Started refreshing application (/) commands.');
await rest.put(
Routes.applicationGuildCommands(CLIENT_ID, GUILD_ID),
Routes.applicationGuildCommands('943506581293776947', '943459216901955604'),
{ body: commands },
);
@ -35,12 +34,13 @@ const rest = new REST({ version: '9' }).setToken(TOKEN);
}
})();
Client.on('ready', () => {
console.log(`Logged in as ${Client.user.tag}!`);
guild = Utils.get(Client.guilds, Guild.name=GUILD);
var guild;
CLIENT.on('ready', () => {
console.log(`Logged in as ${CLIENT.user.tag}!`);
guild = CLIENT.guilds.resolve(GUILD);
});
Client.on('interactionCreate', async interaction => {
CLIENT.on('interactionCreate', async interaction => {
if (!interaction.isCommand()) return;
if (interaction.commandName === 'connect') {
@ -48,4 +48,4 @@ Client.on('interactionCreate', async interaction => {
}
});
Client.login(TOKEN);
CLIENT.login(TOKEN);