// SupportBot | Emerald Services // Close Ticket Command const fs = require("fs"); const Discord = require("discord.js"); const yaml = require('js-yaml'); const supportbot = yaml.load(fs.readFileSync('./Data/supportbot.yml', 'utf8')); const cmdconfig = yaml.load(fs.readFileSync('./Data/commands.yml', 'utf8')); const Command = require("../Structures/Command.js"); const TicketNumberID = require('../Structures/TicketID.js'); async function asyncForEach(array, callback) { for (let index = 0; index < array.length; index++) { await callback(array[index], index, array); } } module.exports = new Command({ name: cmdconfig.HelpCommand, description: cmdconfig.HelpCommandDesc, type: "BOTH", slashCommandOptions: [], permission: "SEND_MESSAGES", async run(message, args, client) { let SupportStaff = message.guild.roles.cache.find(adminRole => adminRole.name === supportbot.Staff) || message.guild.roles.cache.find(staffRole => staffRole.id === supportbot.Staff); let AdminStaff = message.guild.roles.cache.find(adminRole => adminRole.name === supportbot.Admin) || message.guild.roles.cache.find(adminRole => adminRole.id === supportbot.Admin); if (supportbot.HelpMenu) { let botCommands = ""; botCommands += `**${supportbot.Prefix}${cmdconfig.HelpCommand}** ${cmdconfig.HelpCommandDesc}\n`; botCommands += `**${supportbot.Prefix}${cmdconfig.InfoCommand}** ${cmdconfig.InfoCommandDesc}\n`; botCommands += `**${supportbot.Prefix}${cmdconfig.PingCommand}** ${cmdconfig.PingCommandDesc}\n` let ticketCommands = ""; ticketCommands += `**${supportbot.Prefix}${cmdconfig.OpenTicket}** ${cmdconfig.OpenTicketDesc}\n`; ticketCommands += `**${supportbot.Prefix}${cmdconfig.CloseTicket}** ${cmdconfig.CloseTicketDesc}\n` let staffCommands = ""; staffCommands += `**${supportbot.Prefix}${cmdconfig.TicketAdd}** ${cmdconfig.TicketAddDesc}\n` staffCommands += `**${supportbot.Prefix}${cmdconfig.TicketRemove}** ${cmdconfig.TicketRemoveDesc}\n` const HelpEmbed1 = new Discord.MessageEmbed() .setTitle(supportbot.Name) .setThumbnail(message.author.displayAvatarURL()) .addFields( { name: '🖥️ General Commands\n', value: `${botCommands}\n`, inline: false }, { name: '🎫 Support Commands\n', value: `${ticketCommands}\n`, inline: false }, ) .setColor(supportbot.EmbedColour) .setFooter(supportbot.EmbedFooter, message.author.displayAvatarURL()); if (message.member.roles.cache.has(SupportStaff.id)) { HelpEmbed1.addFields( { name: '🔐 Staff Commands\n', value: `${staffCommands}\n`, inline: false }, ) } else { if ((message.member.roles.cache.has(AdminStaff.id))) { HelpEmbed1.addFields( { name: '🔐 Staff Commands\n', value: `${staffCommands}\n`, inline: false }, ) } } if (supportbot.SendHelpPage === "dm") { message.author.send({ embeds: [HelpEmbed1] }); } if (supportbot.SendHelpPage === "channel") { message.channel.send({ embeds: [HelpEmbed1] }); } } } });