Update Help Command

- Added new parameters to commands for privileged commands
- Updated message to take new parameters into account
This commit is contained in:
Logan Cusano
2023-02-24 20:16:21 -05:00
parent 485c0ed569
commit d9a924e5f5

View File

@@ -1,43 +1,30 @@
var libFlayer = require("../libFlayer.js"); const fs = require('fs');
const path = require('node:path');
const prefix = process.env.prefix; const prefix = process.env.PREFIX;
module.exports = { module.exports = {
name: 'help', name: 'help',
description: 'Help', description: 'Display this help message',
example: "help",
execute(message) { execute(message) {
message.reply( messageText = "";
`**${prefix}help** - *Lists the available commands* const commandsPath = path.resolve('./commands'); // Resolves from either working dir or __dirname
const commandFiles = fs.readdirSync(commandsPath).filter(file => file.endsWith('.js'));
for (const file of commandFiles) {
const filePath = path.join(commandsPath, file);
const command = require(filePath);
**${prefix}add** - Add a new RSS Source: *${prefix}add http://www.engadget.com/rss.xml* if (!command.isPrivileged){ // TODO - Need to add middleware for admins
**${prefix}alert** - Gets weather alerts for an area: *${prefix}alert TX* if (messageText.length > 1 && messageText.slice(-2) != `\n`){
**${prefix}answer** - Answers for a question above: *${prefix}answer 1* messageText += `\n`;
}
**${prefix}chat** - Queries OpenAI: *${prefix}chat what is a pizza*
**${prefix}calc** - Do math: *${prefix}calc 2 + 2* messageText += `**${prefix}${command.name}** - *${command.description}*`;
**${prefix}categories** - Displays Categories: *${prefix}categories*
**${prefix}code** - Searches for code snippets: *${prefix}code python loop* if (command.example) messageText += `\n\t\t***Usage:*** \`${command.example}\``
}
**${prefix}find** - Searches the RSS Sources: *${prefix}find google* }
**${prefix}food** - Selects a random recipe: *${prefix}food* message.reply(messageText);
**${prefix}get** - Retrieves Search By Index: *${prefix}get 25*
**${prefix}key** - Testing key from storage: *${prefix}key keyName*
**${prefix}npm** - Gets NPM info from repository: *${prefix}npm axios*
**${prefix}quote** - Selects a random quote: *${prefix}quote*
**${prefix}random** - Selects a random article: *${prefix}random*
**${prefix}random category** - Selects a random article by category: *${prefix}random sports*
**${prefix}search** - Instant Live Search: *${prefix}search salesforce*
**${prefix}slang** - Urban Dictionary Search: *${prefix}slang slang*
**${prefix}stock** - AlphaVantage Stock Search: *${prefix}stock IBM*
**${prefix}update** - Updates all current RSS Feeds: *${prefix}update*
`
);
} }
}; };