From 0118b9e59196870072e4bbf6d374e30b46608110 Mon Sep 17 00:00:00 2001 From: SypherRed <64218204+SypherRed@users.noreply.github.com> Date: Thu, 25 Nov 2021 01:51:56 +0100 Subject: [PATCH 1/2] fixed help command --- Commands/help.js | 117 +++++++++++++++++++++++------------------------ 1 file changed, 56 insertions(+), 61 deletions(-) diff --git a/Commands/help.js b/Commands/help.js index bc02091..bb0db61 100644 --- a/Commands/help.js +++ b/Commands/help.js @@ -25,82 +25,77 @@ module.exports = new Command({ permission: "SEND_MESSAGES", async run(interaction) { - let SupportStaff = - interaction.guild.roles.cache.find( - (adminRole) => adminRole.name === supportbot.Staff - ) || - interaction.guild.roles.cache.find( - (staffRole) => staffRole.id === supportbot.Staff - ); - let AdminStaff = - interaction.guild.roles.cache.find( - (adminRole) => adminRole.name === supportbot.Admin - ) || - interaction.guild.roles.cache.find( - (adminRole) => adminRole.id === supportbot.Admin + let SupportStaff = interaction.guild.roles.cache.find( + (SupportTeam) => + SupportTeam.name === supportbot.Staff || SupportTeam.id === supportbot.Staff + ); + let Admins = interaction.guild.roles.cache.find( + (AdminUser) => + AdminUser.name === supportbot.Admin || AdminUser.id === supportbot.Admin + ); + if (!SupportStaff || !Admins) + return interaction.reply( + "Some roles seem to be missing!\nPlease check for errors when starting the bot." ); + let botCommands = ""; + botCommands += `**/${cmdconfig.HelpCommand}** ${cmdconfig.HelpCommandDesc}\n`; + botCommands += `**/${cmdconfig.InfoCommand}** ${cmdconfig.InfoCommandDesc}\n`; + botCommands += `**/${cmdconfig.PingCommand}** ${cmdconfig.PingCommandDesc}\n`; - if (supportbot.HelpMenu) { - let botCommands = ""; - botCommands += `**/${cmdconfig.HelpCommand}** ${cmdconfig.HelpCommandDesc}\n`; - botCommands += `**/${cmdconfig.InfoCommand}** ${cmdconfig.InfoCommandDesc}\n`; - botCommands += `**/${cmdconfig.PingCommand}** ${cmdconfig.PingCommandDesc}\n`; + let ticketCommands = ""; + ticketCommands += `**/${cmdconfig.OpenTicket}** ${cmdconfig.OpenTicketDesc}\n`; + ticketCommands += `**/${cmdconfig.CloseTicket}** ${cmdconfig.CloseTicketDesc}\n`; - let ticketCommands = ""; - ticketCommands += `**/${cmdconfig.OpenTicket}** ${cmdconfig.OpenTicketDesc}\n`; - ticketCommands += `**/${cmdconfig.CloseTicket}** ${cmdconfig.CloseTicketDesc}\n`; + let staffCommands = ""; + staffCommands += `**/${cmdconfig.TicketAdd}** ${cmdconfig.TicketAddDesc}\n`; + staffCommands += `**/${cmdconfig.TicketRemove}** ${cmdconfig.TicketRemoveDesc}\n`; - let staffCommands = ""; - staffCommands += `**/${cmdconfig.TicketAdd}** ${cmdconfig.TicketAddDesc}\n`; - staffCommands += `**/${cmdconfig.TicketRemove}** ${cmdconfig.TicketRemoveDesc}\n`; + const HelpEmbed1 = new Discord.MessageEmbed() + .setTitle(supportbot.Name + " Commands") + .setThumbnail(interaction.user.displayAvatarURL()) - const HelpEmbed1 = new Discord.MessageEmbed() - .setTitle(supportbot.Name + " Commands") - .setThumbnail(interaction.user.displayAvatarURL()) + .addFields( + { + name: "🖥️ General Commands\n", + value: `${botCommands}\n`, + inline: false, + }, + { + name: "🎫 Support Commands\n", + value: `${ticketCommands}\n`, + inline: false, + } + ) - .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, interaction.user.displayAvatarURL()); - .setColor(supportbot.EmbedColour) - .setFooter(supportbot.EmbedFooter, interaction.user.displayAvatarURL()); - - if (interaction.member.roles.cache.has(SupportStaff.id)) { + if (interaction.member.roles.cache.has(SupportStaff.id)) { + HelpEmbed1.addFields({ + name: "🔐 Staff Commands\n", + value: `${staffCommands}\n`, + inline: false, + }); + } else { + if (interaction.member.roles.cache.has(Admins.id)) { HelpEmbed1.addFields({ name: "🔐 Staff Commands\n", value: `${staffCommands}\n`, inline: false, }); - } else { - if (interaction.member.roles.cache.has(AdminStaff.id)) { - HelpEmbed1.addFields({ - name: "🔐 Staff Commands\n", - value: `${staffCommands}\n`, - inline: false, - }); - } } + } - if (supportbot.SendHelpPage === "dm") { - interaction.user.reply({ - embeds: [HelpEmbed1], - }); - } + if (supportbot.SendHelpPage === "dm") { + interaction.user.reply({ + embeds: [HelpEmbed1], + }); + } - if (supportbot.SendHelpPage === "channel") { - interaction.reply({ - embeds: [HelpEmbed1], - }); - } + if (supportbot.SendHelpPage === "channel") { + interaction.reply({ + embeds: [HelpEmbed1], + }); } }, }); From e7dcc2ab291acac1930c00e12d6efeb941adc9a7 Mon Sep 17 00:00:00 2001 From: Noah Date: Fri, 26 Nov 2021 12:56:21 -0600 Subject: [PATCH 2/2] Update help.js --- Commands/help.js | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/Commands/help.js b/Commands/help.js index bb0db61..1b41fcf 100644 --- a/Commands/help.js +++ b/Commands/help.js @@ -70,20 +70,12 @@ module.exports = new Command({ .setColor(supportbot.EmbedColour) .setFooter(supportbot.EmbedFooter, interaction.user.displayAvatarURL()); - if (interaction.member.roles.cache.has(SupportStaff.id)) { + if (interaction.member.roles.cache.has(SupportStaff.id) || interaction.member.roles.cache.has(Admins.id)) { HelpEmbed1.addFields({ name: "🔐 Staff Commands\n", value: `${staffCommands}\n`, inline: false, }); - } else { - if (interaction.member.roles.cache.has(Admins.id)) { - HelpEmbed1.addFields({ - name: "🔐 Staff Commands\n", - value: `${staffCommands}\n`, - inline: false, - }); - } } if (supportbot.SendHelpPage === "dm") {