Advertisement
FantasticFurries

Untitled

Sep 26th, 2022
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const { MessageEmbed, MessageActionRow, MessageButton } = require('discord.js');
  2. const { SlashCommandBuilder } = require('@discordjs/builders');
  3. const fs = require('fs');
  4. const { helpEmojis, urls } = require('../../config.json');
  5. const { getRoleColor } = require('../../Utils/getRoleColor');
  6.  
  7. module.exports = {
  8.   data: new SlashCommandBuilder()
  9.     .setName('help')
  10.     .setDescription(`Displays a list of all available commands along with their usage.`),
  11.   async execute(interaction) {
  12.     const { staffEmojiId, infoEmojiId, loggingEmojiId, welcomeEmojiId, funEmojiId, debugEmojiId } = helpEmojis;
  13.     const { botInviteLink, discordInviteLink, topgg, website, github } = urls;
  14.     let color = getRoleColor(interaction.guild);
  15.     let debugCmds = '';
  16.     let funCmds = '';
  17.     let infoCmds = '';
  18.     let roleCmds = '';
  19.     let staffCmds = '';
  20.     let welcomeCmds = '';
  21.     fs.readdirSync('./Commands/Debug').forEach((file) => {
  22.       debugCmds += `/${file.slice(0, file.lastIndexOf('.'))} `;
  23.     });
  24.     fs.readdirSync('./Commands/Fun').forEach((file) => {
  25.       funCmds += `/${file.slice(0, file.lastIndexOf('.'))} `;
  26.     });
  27.     fs.readdirSync('./Commands/Info').forEach((file) => {
  28.       infoCmds += `/${file.slice(0, file.lastIndexOf('.'))} `;
  29.     });
  30.     fs.readdirSync('./Commands/Roles').forEach((file) => {
  31.       roleCmds += `/${file.slice(0, file.lastIndexOf('.'))} `;
  32.     });
  33.     fs.readdirSync('./Commands/Moderation').forEach((file) => {
  34.       staffCmds += `/${file.slice(0, file.lastIndexOf('.'))} `;
  35.     });
  36.     fs.readdirSync('./Commands/Welcome').forEach((file) => {
  37.       welcomeCmds += `/${file.slice(0, file.lastIndexOf('.'))} `;
  38.     });
  39.  
  40.     const helpEmbed = new MessageEmbed()
  41.       .setColor(color)
  42.       .setTitle('Commands')
  43.       .addFields(
  44.         {
  45.           name: `${interaction.client.emojis.cache.get(staffEmojiId).toString()} Staff Commands`,
  46.           value: `${'```' + staffCmds + '```'}`, inline: true
  47.         },
  48.         {
  49.           name: `${interaction.client.emojis.cache.get(infoEmojiId).toString()} Info Commands`,
  50.           value: `${'```' + infoCmds + '```'}`, inline: true
  51.         },
  52.         {
  53.           name: `${interaction.client.emojis.cache.get(loggingEmojiId).toString()} Role Commands`,
  54.           value: `${'```' + roleCmds + '```'}`, inline: true
  55.         },
  56.         {
  57.           name: `${interaction.client.emojis.cache.get(welcomeEmojiId).toString()} Welcome Comamnds`,
  58.           value: `${'```' + welcomeCmds + '```'}`, inline: true
  59.         },
  60.         {
  61.           name: `${interaction.client.emojis.cache.get(funEmojiId).toString()} Fun Commands`,
  62.           value: `${'```' + funCmds + '```'}`, inline: true
  63.         },
  64.         {
  65.           name: `${interaction.client.emojis.cache.get(debugEmojiId).toString()} Debug Commands`,
  66.           value: `${'```' + debugCmds + '```'}`, inline: true
  67.         }
  68.       )
  69.       .setTimestamp();
  70.     const links = new MessageActionRow().addComponents(
  71.       new MessageButton()
  72.         .setLabel('Add me')
  73.         .setURL(botInviteLink)
  74.         .setStyle('LINK'),
  75.       new MessageButton()
  76.         .setLabel('Support')
  77.         .setURL(discordInviteLink)
  78.         .setStyle('LINK'),
  79.       new MessageButton()
  80.         .setLabel('Vote!')
  81.         .setURL(topgg)
  82.         .setStyle('LINK'),
  83.       new MessageButton()
  84.         .setLabel('Website')
  85.         .setURL(website)
  86.         .setStyle('LINK'),
  87.       new MessageButton()
  88.         .setLabel('Code')
  89.         .setURL(github)
  90.         .setStyle('LINK')
  91.     );
  92.     interaction.reply({ embeds: [helpEmbed], components: [links] });
  93.   }
  94. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement