command.js 1.0 KB

1234567891011121314151617181920212223242526
  1. /**
  2. * Processes Minecraft commands.
  3. * @param {import('../../util/i18n.js')} lang - The user language.
  4. * @param {import('discord.js').Message} msg - The Discord message.
  5. * @param {import('../../util/wiki.js')} wiki - The wiki.
  6. * @param {String[]} args - The command arguments.
  7. * @param {String} title - The page title.
  8. * @param {String} cmd - The command at this point.
  9. * @param {import('discord.js').MessageReaction} reaction - The reaction on the message.
  10. * @param {String} spoiler - If the response is in a spoiler.
  11. */
  12. function minecraft_command(lang, msg, wiki, args, title, cmd, reaction, spoiler) {
  13. if ( args.join('') ) {
  14. if ( args[0].startsWith( '/' ) ) this.SYNTAX(lang, msg, wiki, args[0].substring(1), args.slice(1), title, cmd, reaction, spoiler);
  15. else this.SYNTAX(lang, msg, wiki, args[0], args.slice(1), title, cmd, reaction, spoiler);
  16. }
  17. else {
  18. msg.notMinecraft = true;
  19. this.WIKI.general(lang, msg, title, wiki, cmd, reaction, spoiler);
  20. }
  21. }
  22. module.exports = {
  23. name: 'command',
  24. run: minecraft_command
  25. };