help.js 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. const util = require("../util.js");
  2. const commands = [{
  3. pattern: "help",
  4. action: msg => {
  5. let isAuthed = util.isAuthorised(msg.member);
  6. let baseCommands = "\n";
  7. let modCommands = "\n";
  8. for(let command in util.documentation) {
  9. if(!util.documentation.hasOwnProperty(command))
  10. continue;
  11. let doc = util.documentation[command];
  12. if(isAuthed && doc.auth)
  13. modCommands = `${modCommands}${command} - ${doc.description}\n`;
  14. else if(!doc.auth)
  15. baseCommands = `${baseCommands}${command} - ${doc.description}\n`;
  16. }
  17. let message = `Hello! I am NoctBot! My job is to help with C(O)M-related problems!\nPing me with one of the following commands:\n\`\`\`${baseCommands}\`\`\``;
  18. if(isAuthed)
  19. message = `${msg.author.toString()} ${message}\n👑**Moderator commands**👑\n\`\`\`${modCommands}\`\`\``;
  20. msg.channel.send(message);
  21. }
  22. }];
  23. module.exports = {
  24. commands: commands
  25. };