1
0

command.js 1.2 KB

1234567891011121314151617181920212223242526272829
  1. const Wiki = require('../../util/wiki.js');
  2. /**
  3. * Processes Minecraft commands.
  4. * @param {import('../../util/i18n.js')} lang - The user language.
  5. * @param {import('discord.js').Message} msg - The Discord message.
  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 {URLSearchParams} querystring - The querystring for the link.
  10. * @param {String} fragment - The section for the link.
  11. * @param {import('discord.js').MessageReaction} reaction - The reaction on the message.
  12. * @param {String} spoiler - If the response is in a spoiler.
  13. */
  14. function minecraft_command(lang, msg, args, title, cmd, querystring, fragment, reaction, spoiler) {
  15. if ( args.join('') ) {
  16. if ( args[0].startsWith( '/' ) ) this.SYNTAX(lang, msg, args[0].substring(1), args.slice(1), title, cmd, querystring, fragment, reaction, spoiler);
  17. else this.SYNTAX(lang, msg, args[0], args.slice(1), title, cmd, querystring, fragment, reaction, spoiler);
  18. }
  19. else {
  20. msg.notMinecraft = true;
  21. this.WIKI.general(lang, msg, title, new Wiki(lang.get('minecraft.link')), cmd, reaction, spoiler, querystring, fragment);
  22. }
  23. }
  24. module.exports = {
  25. name: 'command',
  26. run: minecraft_command
  27. };