Compare commits

...

2 Commits

Author SHA1 Message Date
Emily 83a9a1f65c WIP: help 2022-12-18 16:21:07 +11:00
Emily f2aadf4953 different symbol for about + remove useless usage 2022-12-18 16:20:57 +11:00
3 changed files with 90 additions and 5 deletions

View File

@ -9,8 +9,7 @@ module.exports = class About extends Command {
super (name, category);
this.name = name,
this.description = 'Bot information and statistics',
this.category = category,
this.usage = '/about';
this.category = category;
}
async run (client, interaction, data) { //eslint-disable-line no-unused-vars
@ -42,12 +41,12 @@ module.exports = class About extends Command {
.addFields([
{
name: 'General',
value: `• Users: \`${userCount}\`\n Servers: \`${client.guilds.cache.size}\`\n Commands: \`${client.commands.size}\`\n Uptime: \`${uptime}\``,
value: `» Users: \`${userCount}\`\n» Servers: \`${client.guilds.cache.size}\`\n» Commands: \`${client.commands.size}\`\n» Uptime: \`${uptime}\``,
inline: true
},
{
name: 'Technical',
value: ` RAM Usage: \`${(process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2)} MB\`\n Woomy version: \`v${client.version} ${build}\`\n discord.js version: \`v${version}\`\n node.js version: \`${process.version}\``,
value: `» RAM Usage: \`${(process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2)} MB\`\n» Woomy version: \`v${client.version} ${build}\`\n» discord.js version: \`v${version}\`\n» node.js version: \`${process.version}\``,
inline: true
}
])

87
bot/commands/Bot/help.js Normal file
View File

@ -0,0 +1,87 @@
const Command = require('../../base/Command.js');
module.exports = class Help extends Command {
constructor (name, category) {
super (name, category);
this.name = name,
this.description = 'Lists all the commands you can use',
this.options = [
{
type: 3,
name: 'command',
description: 'The command to get information on'
},
],
this.usage = '/help [command]',
this.friendlyOptions = '`command` - The command to get information on',
this.category = category;
}
async run (client, interaction, data) { //eslint-disable-line no-unused-vars
const input = await interaction.options.get('command');
const bot = await interaction.guild.members.fetch(client.user.id, {force: true});
const categories = [];
client.commands.forEach(cmd => {
if (!categories.includes(cmd.category)) {
if (cmd.category === 'Developer' && !client.config.devIds.includes(interaction.user.id)) return;
categories.push(cmd.category);
}
});
if (!input) {
const fields = [];
const embed = new client.EmbedBuilder()
.setTitle('Command list')
.setColor(bot.displayHexColor)
.setDescription(
`
» Use \`/help [command]\` to get full information on a specific command.
» [Click here](https://discord.gg/HCF8mdv) to join my support server if you need help!
» [Click here](https://discord.com/oauth2/authorize?client_id=${client.user.id}&permissions=2134240503&scope=bot) to invite me to your server!
`
)
.setFooter({text: 'Thank you for using Woomy! 🦑'});
categories.forEach(cat => {
let cmds = '`';
const filteredCmds = client.commands.filter(cmd => cmd.category === cat);
filteredCmds.forEach(cmd => {
cmds += (cmd.name + '`, `');
});
cmds = cmds.substr(0, cmds.length - 3);
fields.push({name: cat.toProperCase() + ':', value: cmds});
});
embed.addFields(fields);
return interaction.reply({ embeds: [embed] });
} else if (client.commands.has(input.value)) {
const command = await client.commands.get(input.value);
const embed = new client.EmbedBuilder()
.setTitle(`${command.category} -> ${command.name.toProperCase()}`)
.setColor(bot.user.hexAccentColor ?? bot.displayHexColor)
.setDescription(command.description)
.setFooter({ text: '<> = required, / = either/or, [] = optional'});
const fields = [];
if (command.usage !== 'No usage information provided.') {
fields.push({name: 'Usage:', value: command.usage});
}
if (command.friendlyOptions !== 'No options provided.') {
fields.push({name: 'Options', value: command.friendlyOptions});
}
if (fields.length > 0) embed.addFields(fields);
return interaction.reply({ embeds: [embed] });
}
return interaction.reply(`${client.config.emojis.userError} A command of that name could not be found.`);
}
};

View File

@ -6,7 +6,6 @@ module.exports = class Avatar extends Command {
super (name, category);
this.name = name,
this.description = 'View information on this server.',
this.usage = '/server',
this.category = category;
}