1
0

invite.js 817 B

1234567891011121314151617181920212223242526272829
  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. } else {
  14. msg.client.generateInvite({
  15. permissions: defaultPermissions
  16. }).then( invite => {
  17. msg.sendChannel( lang.get('invite.bot') + '\n<' + invite + '>' );
  18. }, log_error );
  19. }
  20. }
  21. module.exports = {
  22. name: 'invite',
  23. everyone: true,
  24. pause: false,
  25. owner: false,
  26. run: cmd_invite
  27. };