Files
SupportBot/commands/help.js
T

83 lines
3.9 KiB
JavaScript
Raw Normal View History

2020-12-18 13:37:56 +00:00
// SupportBot, Created by Emerald Services
2020-06-15 23:58:37 +01:00
// Help Command
2019-06-09 23:52:41 +01:00
const Discord = require("discord.js");
2020-06-15 23:58:37 +01:00
const fs = require("fs");
2019-06-09 23:52:41 +01:00
2020-01-26 22:35:45 +00:00
const yaml = require('js-yaml');
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
2019-06-09 23:52:41 +01:00
2020-06-15 23:58:37 +01:00
module.exports = {
name: supportbot.HelpCommand,
2020-07-14 19:42:46 +01:00
description: supportbot.HelpDesc,
2020-06-15 23:58:37 +01:00
execute(message, args) {
2021-05-23 10:39:31 +02:00
if (supportbot.DeleteMessages) message.delete();
2021-05-22 23:13:16 +02:00
2021-06-15 21:04:32 +01:00
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);
2021-02-02 17:01:58 +00:00
2021-06-30 21:30:41 +01:00
if (supportbot.HelpMenu) {
2020-06-15 23:58:37 +01:00
let generalCommands = "";
2020-07-14 19:42:46 +01:00
generalCommands += `**${supportbot.Prefix}${supportbot.HelpCommand}** ${supportbot.HelpDesc}\n`;
2021-05-22 23:13:16 +02:00
generalCommands += `**${supportbot.Prefix}${supportbot.LinksCommand}** ${supportbot.LinksDesc}\n`;
2020-07-14 19:42:46 +01:00
generalCommands += `**${supportbot.Prefix}${supportbot.SuggestCommand}** ${supportbot.SuggestionDesc}\n`;
generalCommands += `**${supportbot.Prefix}${supportbot.PingCommand}** ${supportbot.PingDesc}\n`;
2020-06-15 23:58:37 +01:00
let supportCommands = "";
2020-07-14 19:42:46 +01:00
supportCommands += `**${supportbot.Prefix}${supportbot.NewTicket} [reason]** ${supportbot.NewTicketDesc}\n`
supportCommands += `**${supportbot.Prefix}${supportbot.CloseTicket} [reason]** ${supportbot.CloseTicketDesc}\n`
2020-06-15 23:58:37 +01:00
let staffCommands = "";
2020-07-14 19:42:46 +01:00
staffCommands += `**${supportbot.Prefix}${supportbot.AddUser} <user#0000>** ${supportbot.AddUserDesc}\n`
staffCommands += `**${supportbot.Prefix}${supportbot.RemoveUser} <user#0000>** ${supportbot.RemoveUserDesc}\n`
2020-07-23 20:16:32 +01:00
staffCommands += `**${supportbot.Prefix}${supportbot.BotSay}** ${supportbot.BotSayDesc}\n`
2021-03-27 16:22:19 +00:00
staffCommands += `**${supportbot.Prefix}${supportbot.PurgeMessage}** ${supportbot.PurgeDesc}\n`
2021-06-15 21:04:32 +01:00
let adminCommands = "";
adminCommands += `**${supportbot.Prefix}${supportbot.AnnounceCommand}** ${supportbot.AnnounceDesc} \`Admin Only\`\n`
adminCommands += `**${supportbot.Prefix}${supportbot.BanUser}** ${supportbot.BanDesc} \`Admin Only\` \n`
adminCommands += `**${supportbot.Prefix}${supportbot.KickUser}** ${supportbot.KickDesc} \`Admin Only\` \n`
adminCommands += `**${supportbot.Prefix}${supportbot.BlacklistUser}** ${supportbot.BlacklistDesc} \`Admin Only\` \n`
2020-06-15 23:58:37 +01:00
2021-03-27 16:22:19 +00:00
const HelpEmbed1 = new Discord.MessageEmbed()
2020-06-15 23:58:37 +01:00
.setTitle(supportbot.Bot_Name)
.setThumbnail(message.author.displayAvatarURL())
.addFields(
2021-03-27 16:22:19 +00:00
{ name: '🖥️ General Commands\n', value: `${generalCommands}\n`, inline: false },
{ name: '🎫 Support Commands\n', value: `${supportCommands}\n`, inline: false },
2020-06-15 23:58:37 +01:00
)
.setColor(supportbot.EmbedColour)
.setFooter(supportbot.EmbedFooter, message.author.displayAvatarURL());
2021-05-22 23:13:16 +02:00
if (message.member.roles.cache.has(SupportStaff.id)) {
2021-03-27 16:22:19 +00:00
HelpEmbed1.addFields(
{ name: '🔐 Staff Commands\n', value: `${staffCommands}\n`, inline: false },
2020-07-14 19:42:46 +01:00
)
}
2021-06-15 21:04:32 +01:00
if (message.member.roles.cache.has(AdminStaff.id)) {
HelpEmbed1.addFields(
{ name: '🔐 Admin Commands\n', value: `${adminCommands}\n`, inline: false },
)
}
2020-07-14 19:42:46 +01:00
2021-06-30 21:30:41 +01:00
if (supportbot.SendHelpPage === "dm") {
message.author.send({
embed: HelpEmbed1
});
}
if (supportbot.SendHelpPage === "channel") {
message.channel.send({
embed: HelpEmbed1
});
}
2021-03-27 16:22:19 +00:00
}
2020-06-15 23:58:37 +01:00
}
2020-07-23 20:16:32 +01:00
};