From 2adefc938805ff4c026d0fe91237d68604d1680b Mon Sep 17 00:00:00 2001 From: kieranrobson Date: Wed, 11 May 2022 21:37:08 +0100 Subject: [PATCH] Adderd button to welcome message --- commands/embeds/welcome.js | 15 ++++++++++++--- handler/index.js | 10 +++++----- index.js | 2 +- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/commands/embeds/welcome.js b/commands/embeds/welcome.js index 8932c74..524613e 100644 --- a/commands/embeds/welcome.js +++ b/commands/embeds/welcome.js @@ -1,4 +1,4 @@ -const { Message, Client, MessageEmbed } = require("discord.js"); +const discord = require("discord.js"); module.exports = { name: "welcome", @@ -10,7 +10,7 @@ module.exports = { * @param {String[]} args */ run: async (client, message, args) => { - const embed = new MessageEmbed() + const embed = new discord.MessageEmbed() .setColor('GREEN') .setFooter(`Called By: ${message.author.tag}`) .setTimestamp() @@ -21,6 +21,15 @@ module.exports = { .addField('Our Links', `https://hullcss.org/links`) .addField('Gain Access', `To gain access to the server, you will need to have a read of the code of conduct, found here: https://github.com/hullcss/conduct/ and react to the check mark below.\r\n \r\n **All Members, including Community are required to read this policy to access the server.**`) .addField('Confirmation', 'By reacting with the check mark, you confirm that you have read the #hullcss Code of Conduct') - message.channel.send({ embeds: [embed] }) + + const row = new discord.MessageActionRow() + .addComponents( + new discord.MessageButton() + .setCustomId('codeOfConduct') + .setLabel('✅ I have read the code of conduct!') + .setStyle('SUCCESS'), + ); + + message.channel.send({ embeds: [embed], components: [row] }) }, }; diff --git a/handler/index.js b/handler/index.js index 547d683..b9f74be 100644 --- a/handler/index.js +++ b/handler/index.js @@ -1,6 +1,7 @@ const { glob } = require("glob"); const { promisify } = require("util"); const { Client } = require("discord.js"); + const globPromise = promisify(glob); /** @@ -24,6 +25,8 @@ module.exports = async (client) => { const eventFiles = await globPromise(`${process.cwd()}/events/*.js`); eventFiles.map((value) => require(value)); + // Slash Commands + const slashCommands = await globPromise(`${process.cwd()}/SlashCommands/*/*.js`); const arrayOfSlashCommands = []; slashCommands.map((value) => { const file = require(value); @@ -36,10 +39,7 @@ module.exports = async (client) => { client.on("ready", async () => { // Register for a single guild await client.guilds.cache - .get("744586833135927366") + .get("427865794467069962") .commands.set(arrayOfSlashCommands); - - // Register for all the guilds the bot is in - // await client.application.commands.set(arrayOfSlashCommands); }); -}; +}; \ No newline at end of file diff --git a/index.js b/index.js index c4e9fe6..67733f0 100644 --- a/index.js +++ b/index.js @@ -4,7 +4,7 @@ const { Client, Collection } = require("discord.js"); const client = new Client({ - intents: ["GUILDS", "GUILD_MESSAGES", "GUILD_SCHEDULED_EVENTS"], + intents: 32767, }); module.exports = client;