From 730ad225e9b50d2e173d8037f8619a27d8f83f0b Mon Sep 17 00:00:00 2001 From: KieranRobson Date: Mon, 21 Aug 2023 14:47:44 +0100 Subject: [PATCH] feat: Transition useful links to slash command --- src/commands/embeds/usefullinks.js | 53 --------------------- src/slashCommands/embeds/usefullinks.js | 61 +++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 53 deletions(-) delete mode 100644 src/commands/embeds/usefullinks.js create mode 100644 src/slashCommands/embeds/usefullinks.js diff --git a/src/commands/embeds/usefullinks.js b/src/commands/embeds/usefullinks.js deleted file mode 100644 index f2d9785..0000000 --- a/src/commands/embeds/usefullinks.js +++ /dev/null @@ -1,53 +0,0 @@ -const { MessageEmbed } = require('discord.js'); - -module.exports = { - name: 'usefullinks', - aliases: [''], - /** - * - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ - run: async (client, message) => { - const embed = new MessageEmbed() - .setColor('GREEN') - .setFooter({ text: `Called By: ${message.author.tag}` }) - .setTimestamp() - .setTitle('Useful Links!') - .setDescription( - `Below are a some useful links to communities and resources.` - ) - .setThumbnail('https://i.imgur.com/ww6wKwJ.png') - - .addField( - 'Free Stuff', - ` - - GitHub Student Developer Pack: https://education.github.com/pack\r\n - - Microsoft Azure Dev Tools for Teaching: https://azure.microsoft.com/en-gb/free/students/\r\n - - JetBrains IDE Package: https://www.jetbrains.com/community/education/#students\r\n` - ) - - .addField( - 'University of Hull Specific Features', - ` - - Freeside Student Resource List: https://github.com/FreesideHull/StudentResources\r\n - - Hull University Buddy: https://chrome.google.com/webstore/detail/hull-university-buddy/jnppmhcoifoohipnnhdabhnolnilncbk\r\n` - ) - - .addField( - 'Other Communities', - ` - - Freeside: https://freeside.co.uk/\r\n - - Unofficial University of Hull Discord Server: https://discord.gg/rm7r5wbYq2\r\n - - The Programmer's Hangout: https://discord.gg/programming\r\n` - ) - - .addField( - `Want to add a resource?`, - `Message an <@&427866208726155274> with your suggestion for consideration!` - ); - - message.channel.send({ embeds: [embed] }); - }, -}; diff --git a/src/slashCommands/embeds/usefullinks.js b/src/slashCommands/embeds/usefullinks.js new file mode 100644 index 0000000..8e29299 --- /dev/null +++ b/src/slashCommands/embeds/usefullinks.js @@ -0,0 +1,61 @@ +const { + SlashCommandBuilder, + PermissionFlagsBits, + EmbedBuilder, + ActionRowBuilder, + ButtonBuilder, +} = require('discord.js'); + +module.exports = { + ...new SlashCommandBuilder() + .setName('usefullinks') + .setDescription('Create the useful links embed') + .setDefaultMemberPermissions( + PermissionFlagsBits.KickMembers || PermissionFlagsBits.BanMembers + ), + + /** + * + * @param {Client} client + * @param {CommandInteraction} interaction + * @param {String[]} args + */ + run: async (client, interaction) => { + const embed = new EmbedBuilder() + .setColor(0x3fb618) + .setFooter({ text: `Called By: ${interaction.user.tag}` }) + .setTimestamp() + .setTitle('Useful Links!') + .setDescription( + `Below are a some useful links to communities and resources.` + ) + .setThumbnail('https://i.imgur.com/ww6wKwJ.png') + .addFields( + { + name: 'Free Stuff', + value: `- GitHub Student Developer Pack: https://education.github.com/pack\r\n + - Microsoft Azure Dev Tools for Teaching: https://azure.microsoft.com/en-gb/free/students/\r\n + - JetBrains IDE Package: https://www.jetbrains.com/community/education/#students\r\n` + }, + { + name: 'University of Hull Specifics', + value: `- Freeside Student Resource List: https://github.com/FreesideHull/StudentResources\r\n + - Hull University Buddy: https://chrome.google.com/webstore/detail/hull-university-buddy/jnppmhcoifoohipnnhdabhnolnilncbk\r\n` + }, + { + name: `Other Communities`, + value: `- Freeside: https://freeside.co.uk/ \r\n + - Unofficial University of Hull Discord Server: https://discord.gg/rm7r5wbYq2 \r\n + - The Programmers Hangout: https://discord.gg/programming` + }, + { + name: 'Want to add a resource?', + value: 'Message an <@&427866208726155274> with your suggestion for consideration!' + } + ) + + interaction.channel.send({ embeds: [embed] }); + interaction.reply({ content: 'Embed sent.', ephemeral: true }); + + }, +};