2021-10-21 19:28:23 +01:00
|
|
|
// SupportBot | Emerald Services
|
2021-10-24 22:41:46 +01:00
|
|
|
// Help Command
|
2021-10-21 19:28:23 +01:00
|
|
|
|
|
|
|
|
const fs = require("fs");
|
|
|
|
|
|
|
|
|
|
const Discord = require("discord.js");
|
2021-10-24 22:41:46 +01:00
|
|
|
const yaml = require("js-yaml");
|
2021-10-27 19:30:10 -05:00
|
|
|
const supportbot = yaml.load(
|
|
|
|
|
fs.readFileSync("./Configs/supportbot.yml", "utf8")
|
|
|
|
|
);
|
|
|
|
|
const cmdconfig = yaml.load(fs.readFileSync("./Configs/commands.yml", "utf8"));
|
2021-10-21 19:28:23 +01:00
|
|
|
|
|
|
|
|
const Command = require("../Structures/Command.js");
|
|
|
|
|
|
|
|
|
|
module.exports = new Command({
|
2021-10-24 22:41:46 +01:00
|
|
|
name: cmdconfig.HelpCommand,
|
|
|
|
|
description: cmdconfig.HelpCommandDesc,
|
2021-12-18 18:57:26 -06:00
|
|
|
options: [],
|
|
|
|
|
permissions: ["SEND_MESSAGES"],
|
2021-10-21 19:28:23 +01:00
|
|
|
|
2021-10-24 22:41:46 +01:00
|
|
|
async run(interaction) {
|
2022-01-30 00:07:04 -06:00
|
|
|
const { getRole } = interaction.client;
|
2021-12-15 00:19:40 -06:00
|
|
|
let SupportStaff = await getRole(supportbot.Staff, interaction.guild);
|
|
|
|
|
let Admin = await getRole(supportbot.Admin, interaction.guild);
|
|
|
|
|
if (!SupportStaff || !Admin)
|
2021-11-25 01:51:56 +01:00
|
|
|
return interaction.reply(
|
|
|
|
|
"Some roles seem to be missing!\nPlease check for errors when starting the bot."
|
2021-10-24 22:41:46 +01:00
|
|
|
);
|
2021-12-04 20:58:19 -06:00
|
|
|
|
2021-11-25 01:51:56 +01:00
|
|
|
let botCommands = "";
|
|
|
|
|
botCommands += `**/${cmdconfig.HelpCommand}** ${cmdconfig.HelpCommandDesc}\n`;
|
|
|
|
|
botCommands += `**/${cmdconfig.InfoCommand}** ${cmdconfig.InfoCommandDesc}\n`;
|
|
|
|
|
botCommands += `**/${cmdconfig.PingCommand}** ${cmdconfig.PingCommandDesc}\n`;
|
2021-10-21 19:28:23 +01:00
|
|
|
|
2021-11-25 01:51:56 +01:00
|
|
|
let ticketCommands = "";
|
|
|
|
|
ticketCommands += `**/${cmdconfig.OpenTicket}** ${cmdconfig.OpenTicketDesc}\n`;
|
|
|
|
|
ticketCommands += `**/${cmdconfig.CloseTicket}** ${cmdconfig.CloseTicketDesc}\n`;
|
2021-10-24 22:41:46 +01:00
|
|
|
|
2021-11-25 01:51:56 +01:00
|
|
|
let staffCommands = "";
|
|
|
|
|
staffCommands += `**/${cmdconfig.TicketAdd}** ${cmdconfig.TicketAddDesc}\n`;
|
|
|
|
|
staffCommands += `**/${cmdconfig.TicketRemove}** ${cmdconfig.TicketRemoveDesc}\n`;
|
2021-10-24 22:41:46 +01:00
|
|
|
|
2021-11-25 01:51:56 +01:00
|
|
|
const HelpEmbed1 = new Discord.MessageEmbed()
|
|
|
|
|
.setTitle(supportbot.Name + " Commands")
|
|
|
|
|
.setThumbnail(interaction.user.displayAvatarURL())
|
2021-10-24 22:41:46 +01:00
|
|
|
|
2021-11-25 01:51:56 +01:00
|
|
|
.addFields(
|
|
|
|
|
{
|
|
|
|
|
name: "🖥️ General Commands\n",
|
|
|
|
|
value: `${botCommands}\n`,
|
|
|
|
|
inline: false,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: "🎫 Support Commands\n",
|
|
|
|
|
value: `${ticketCommands}\n`,
|
|
|
|
|
inline: false,
|
|
|
|
|
}
|
|
|
|
|
)
|
2021-10-24 22:41:46 +01:00
|
|
|
|
2021-11-25 01:51:56 +01:00
|
|
|
.setColor(supportbot.EmbedColour)
|
2022-02-25 21:55:33 -06:00
|
|
|
.setFooter({
|
|
|
|
|
text: supportbot.EmbedFooter,
|
|
|
|
|
iconURL: interaction.user.displayAvatarURL(),
|
|
|
|
|
});
|
2021-10-24 22:41:46 +01:00
|
|
|
|
2021-12-04 20:58:19 -06:00
|
|
|
if (
|
|
|
|
|
interaction.member.roles.cache.has(SupportStaff.id) ||
|
2021-12-15 00:19:40 -06:00
|
|
|
interaction.member.roles.cache.has(Admin.id)
|
2021-12-04 20:58:19 -06:00
|
|
|
) {
|
2021-11-25 01:51:56 +01:00
|
|
|
HelpEmbed1.addFields({
|
|
|
|
|
name: "🔐 Staff Commands\n",
|
|
|
|
|
value: `${staffCommands}\n`,
|
|
|
|
|
inline: false,
|
|
|
|
|
});
|
|
|
|
|
}
|
2021-10-24 22:41:46 +01:00
|
|
|
|
2021-11-25 01:51:56 +01:00
|
|
|
if (supportbot.SendHelpPage === "dm") {
|
2022-02-11 23:41:02 -06:00
|
|
|
interaction.user.send({
|
2021-11-25 01:51:56 +01:00
|
|
|
embeds: [HelpEmbed1],
|
|
|
|
|
});
|
|
|
|
|
}
|
2021-10-24 22:41:46 +01:00
|
|
|
|
2021-11-25 01:51:56 +01:00
|
|
|
if (supportbot.SendHelpPage === "channel") {
|
|
|
|
|
interaction.reply({
|
|
|
|
|
embeds: [HelpEmbed1],
|
|
|
|
|
});
|
2021-10-24 22:41:46 +01:00
|
|
|
}
|
|
|
|
|
},
|
2021-12-04 20:58:19 -06:00
|
|
|
});
|