diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..161e891 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ + +.vscode \ No newline at end of file diff --git a/bot.js b/bot.js index b1837e2..28c9a38 100644 --- a/bot.js +++ b/bot.js @@ -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);