help.js 1.0 KB

1234567891011121314151617181920212223242526272829303132
  1. const util = require("../util.js");
  2. const commands = {
  3. "help": msg => {
  4. let isAuthed = util.isAuthorised(msg.member);
  5. let baseCommands = "\n";
  6. let modCommands = "\n";
  7. for(let command in util.documentation) {
  8. if(!util.documentation.hasOwnProperty(command))
  9. continue;
  10. let doc = util.documentation[command];
  11. if(isAuthed && doc.auth)
  12. modCommands = `${modCommands}${command} - ${doc.description}\n`;
  13. else if(!doc.auth)
  14. baseCommands = `${baseCommands}${command} - ${doc.description}\n`;
  15. }
  16. 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}\`\`\``;
  17. if(isAuthed)
  18. message = `${msg.author.toString()} ${message}\n👑**Moderator commands**👑\n\`\`\`${modCommands}\`\`\``;
  19. msg.channel.send(message);
  20. }
  21. };
  22. module.exports = {
  23. commands: commands
  24. };