invite.js 840 B

123456789101112131415161718192021222324252627282930
  1. const {defaultPermissions} = require('../util/default.json');
  2. /**
  3. * Processes the "invite" command.
  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} line - The command as plain text.
  8. * @param {import('../util/wiki.js')} wiki - The wiki for the message.
  9. */
  10. function cmd_invite(lang, msg, args, line, wiki) {
  11. if ( args.join('') ) {
  12. this.LINK(lang, msg, line, wiki);
  13. }
  14. else {
  15. let invite = msg.client.generateInvite({
  16. scopes: ['bot', 'applications.commands'],
  17. permissions: defaultPermissions
  18. });
  19. msg.sendChannel( lang.get('invite.bot') + '\n<' + invite + '>' );
  20. }
  21. }
  22. module.exports = {
  23. name: 'invite',
  24. everyone: true,
  25. pause: false,
  26. owner: false,
  27. run: cmd_invite
  28. };