Fix Delay Script

This commit is contained in:
Daniel Odendahl Jr
2017-08-28 10:43:01 +00:00
parent eed39c5ec1
commit f9f862d0bc
2 changed files with 11 additions and 6 deletions
+10 -5
View File
@@ -8,7 +8,7 @@ const client = new CommandoClient({
disableEveryone: true, disableEveryone: true,
unknownCommandResponse: false, unknownCommandResponse: false,
disabledEvents: ['TYPING_START'], disabledEvents: ['TYPING_START'],
messageCacheLifetime: 60, messageCacheLifetime: 600,
messageSweepInterval: 120 messageSweepInterval: 120
}); });
const { carbon, dBots, dBotsOrg, filterTopics, parseTopic } = require('./structures/Util'); const { carbon, dBots, dBotsOrg, filterTopics, parseTopic } = require('./structures/Util');
@@ -107,12 +107,17 @@ client.on('guildDelete', async guild => {
const { wait } = require('./structures/Util'); const { wait } = require('./structures/Util');
client.setTimeout(async () => { client.setTimeout(async () => {
const battle = client.registry.resolveCommand('games:battle').fighting.size; let battle = client.registry.resolveCommand('games:battle').fighting.size;
const hangman = client.registry.resolveCommand('games:hangman').playing.size; let hangman = client.registry.resolveCommand('games:hangman').playing.size;
const gunfight = client.registry.resolveCommand('games:gunfight').fighting.size; let gunfight = client.registry.resolveCommand('games:gunfight').fighting.size;
while (battle > 0 || hangman > 0 || gunfight > 0) { // eslint-disable-line no-unmodified-loop-condition let lockdown = client.registry.resolveCommand('moderation:lockdown').channels.size;
while (battle > 0 || hangman > 0 || gunfight > 0 || lockdown > 0) {
console.log('[RESTART] A game is going on, delaying...'); console.log('[RESTART] A game is going on, delaying...');
await wait(5000); await wait(5000);
battle = client.registry.resolveCommand('games:battle').fighting.size;
hangman = client.registry.resolveCommand('games:hangman').playing.size;
gunfight = client.registry.resolveCommand('games:gunfight').fighting.size;
lockdown = client.registry.resolveCommand('moderation:lockdown').channels.size;
} }
console.log(`[RESTART] Shard ${client.shard.id} Restarted.`); console.log(`[RESTART] Shard ${client.shard.id} Restarted.`);
process.exit(0); process.exit(0);
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "xiaobot", "name": "xiaobot",
"version": "31.2.6", "version": "31.2.7",
"description": "Your personal server companion.", "description": "Your personal server companion.",
"main": "Shard.js", "main": "Shard.js",
"scripts": { "scripts": {