Adderd button to welcome message

imgbot
kieranrobson 2022-05-11 21:37:08 +01:00
parent 136cf912c5
commit 2adefc9388
3 changed files with 18 additions and 9 deletions

View File

@ -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] })
},
};

View File

@ -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);
});
};
};

View File

@ -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;