fixed help command

This commit is contained in:
SypherRed authored and GitHub committed 2021-11-25 01:51:56 +01:00
1 parent 31f6b9e08e
commit 0118b9e591
1 file changed
+56 -61
+56 -61
View File
@@ -25,82 +25,77 @@ module.exports = new Command({
permission: "SEND_MESSAGES", permission: "SEND_MESSAGES",
async run(interaction) { async run(interaction) {
let SupportStaff = let SupportStaff = interaction.guild.roles.cache.find(
interaction.guild.roles.cache.find( (SupportTeam) =>
(adminRole) => adminRole.name === supportbot.Staff SupportTeam.name === supportbot.Staff || SupportTeam.id === supportbot.Staff
) || );
interaction.guild.roles.cache.find( let Admins = interaction.guild.roles.cache.find(
(staffRole) => staffRole.id === supportbot.Staff (AdminUser) =>
); AdminUser.name === supportbot.Admin || AdminUser.id === supportbot.Admin
let AdminStaff = );
interaction.guild.roles.cache.find( if (!SupportStaff || !Admins)
(adminRole) => adminRole.name === supportbot.Admin return interaction.reply(
) || "Some roles seem to be missing!\nPlease check for errors when starting the bot."
interaction.guild.roles.cache.find(
(adminRole) => adminRole.id === supportbot.Admin
); );
let botCommands = "";
botCommands += `**/${cmdconfig.HelpCommand}** ${cmdconfig.HelpCommandDesc}\n`;
botCommands += `**/${cmdconfig.InfoCommand}** ${cmdconfig.InfoCommandDesc}\n`;
botCommands += `**/${cmdconfig.PingCommand}** ${cmdconfig.PingCommandDesc}\n`;
if (supportbot.HelpMenu) { let ticketCommands = "";
let botCommands = ""; ticketCommands += `**/${cmdconfig.OpenTicket}** ${cmdconfig.OpenTicketDesc}\n`;
botCommands += `**/${cmdconfig.HelpCommand}** ${cmdconfig.HelpCommandDesc}\n`; ticketCommands += `**/${cmdconfig.CloseTicket}** ${cmdconfig.CloseTicketDesc}\n`;
botCommands += `**/${cmdconfig.InfoCommand}** ${cmdconfig.InfoCommandDesc}\n`;
botCommands += `**/${cmdconfig.PingCommand}** ${cmdconfig.PingCommandDesc}\n`;
let ticketCommands = ""; let staffCommands = "";
ticketCommands += `**/${cmdconfig.OpenTicket}** ${cmdconfig.OpenTicketDesc}\n`; staffCommands += `**/${cmdconfig.TicketAdd}** ${cmdconfig.TicketAddDesc}\n`;
ticketCommands += `**/${cmdconfig.CloseTicket}** ${cmdconfig.CloseTicketDesc}\n`; staffCommands += `**/${cmdconfig.TicketRemove}** ${cmdconfig.TicketRemoveDesc}\n`;
let staffCommands = ""; const HelpEmbed1 = new Discord.MessageEmbed()
staffCommands += `**/${cmdconfig.TicketAdd}** ${cmdconfig.TicketAddDesc}\n`; .setTitle(supportbot.Name + " Commands")
staffCommands += `**/${cmdconfig.TicketRemove}** ${cmdconfig.TicketRemoveDesc}\n`; .setThumbnail(interaction.user.displayAvatarURL())
const HelpEmbed1 = new Discord.MessageEmbed() .addFields(
.setTitle(supportbot.Name + " Commands") {
.setThumbnail(interaction.user.displayAvatarURL()) name: "🖥️ General Commands\n",
value: `${botCommands}\n`,
inline: false,
},
{
name: "🎫 Support Commands\n",
value: `${ticketCommands}\n`,
inline: false,
}
)
.addFields( .setColor(supportbot.EmbedColour)
{ .setFooter(supportbot.EmbedFooter, interaction.user.displayAvatarURL());
name: "🖥️ General Commands\n",
value: `${botCommands}\n`,
inline: false,
},
{
name: "🎫 Support Commands\n",
value: `${ticketCommands}\n`,
inline: false,
}
)
.setColor(supportbot.EmbedColour) if (interaction.member.roles.cache.has(SupportStaff.id)) {
.setFooter(supportbot.EmbedFooter, interaction.user.displayAvatarURL()); HelpEmbed1.addFields({
name: "🔐 Staff Commands\n",
if (interaction.member.roles.cache.has(SupportStaff.id)) { value: `${staffCommands}\n`,
inline: false,
});
} else {
if (interaction.member.roles.cache.has(Admins.id)) {
HelpEmbed1.addFields({ HelpEmbed1.addFields({
name: "🔐 Staff Commands\n", name: "🔐 Staff Commands\n",
value: `${staffCommands}\n`, value: `${staffCommands}\n`,
inline: false, 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") { if (supportbot.SendHelpPage === "dm") {
interaction.user.reply({ interaction.user.reply({
embeds: [HelpEmbed1], embeds: [HelpEmbed1],
}); });
} }
if (supportbot.SendHelpPage === "channel") { if (supportbot.SendHelpPage === "channel") {
interaction.reply({ interaction.reply({
embeds: [HelpEmbed1], embeds: [HelpEmbed1],
}); });
}
} }
}, },
}); });