stop.js 1.0 KB

1234567891011121314151617181920212223242526272829
  1. /**
  2. * Processes the "stop" command.
  3. * @param {import('../util/i18n.js')} lang - The user language.
  4. * @param {import('discord.js').Message} msg - The Discord message.
  5. * @param {String[]} args - The command arguments.
  6. * @param {String} line - The command as plain text.
  7. * @param {import('../util/wiki.js')} wiki - The wiki for the message.
  8. * @async
  9. */
  10. async function cmd_stop(lang, msg, args, line, wiki) {
  11. if ( args[0] === 'force' && args.slice(1).join(' ').split('\n')[0].isMention(msg.guild) ) {
  12. await msg.replyMsg( 'I\'ll destroy myself now!', {}, true );
  13. await msg.client.shard.send('SIGKILL');
  14. } else if ( args.join(' ').split('\n')[0].isMention(msg.guild) ) {
  15. await msg.replyMsg( 'I\'ll restart myself now!', {}, true );
  16. console.log( '\n- Restarting all shards!\n\n' );
  17. await msg.client.shard.respawnAll();
  18. } else if ( !msg.channel.isGuild() || !pause[msg.guild.id] ) {
  19. this.LINK(lang, msg, line, wiki);
  20. }
  21. }
  22. module.exports = {
  23. name: 'stop',
  24. everyone: false,
  25. pause: false,
  26. owner: true,
  27. run: cmd_stop
  28. };