stop.js 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. /**
  2. * Processes the "stop" command.
  3. * @param {import('../util/i18n.js').default} 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').default} 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. shardDelay: 5_000,
  19. respawnDelay: 500,
  20. timeout: 60_000
  21. } );
  22. } else if ( !msg.inGuild() || !pausedGuilds.has(msg.guildId) ) {
  23. this.LINK(lang, msg, line, wiki);
  24. }
  25. }
  26. export default {
  27. name: 'stop',
  28. everyone: false,
  29. pause: false,
  30. owner: true,
  31. run: cmd_stop
  32. };