command.js 1.1 KB

123456789101112131415161718192021222324252627
  1. /**
  2. * Processes Minecraft commands.
  3. * @param {import('../../util/i18n.js').default} lang - The user language.
  4. * @param {import('discord.js').Message} msg - The Discord message.
  5. * @param {import('../../util/wiki.js').default} 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. * @param {Boolean} noEmbed - If the response should be without an embed.
  12. */
  13. function minecraft_command(lang, msg, wiki, args, title, cmd, reaction, spoiler, noEmbed) {
  14. if ( args.join('') ) {
  15. if ( args[0].startsWith( '/' ) ) this.SYNTAX(lang, msg, wiki, args[0].substring(1), args.slice(1), title, cmd, reaction, spoiler, noEmbed);
  16. else this.SYNTAX(lang, msg, wiki, args[0], args.slice(1), title, cmd, reaction, spoiler, noEmbed);
  17. }
  18. else {
  19. msg.notMinecraft = true;
  20. this.WIKI.general(lang, msg, title, wiki, cmd, reaction, spoiler, noEmbed);
  21. }
  22. }
  23. export default {
  24. name: 'command',
  25. run: minecraft_command
  26. };