Skip to content

Commit

Permalink
fix(twitch): slow down validation to be able to pick up changes
Browse files Browse the repository at this point in the history
  • Loading branch information
sogehige committed Dec 11, 2021
1 parent 3a554fd commit a442604
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 17 deletions.
24 changes: 13 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -16,7 +16,7 @@
"author": "Michal Orlik <sogehige@gmail.com>",
"license": "MIT",
"dependencies": {
"@sogebot/ui-admin": "^31.0.1",
"@sogebot/ui-admin": "^31.2.0",
"@sogebot/ui-helpers": "^2.8.0",
"@sogebot/ui-oauth": "~2.2.0",
"@sogebot/ui-overlay": "^14.0.1",
Expand Down Expand Up @@ -183,4 +183,4 @@
"npx jsonlint"
]
}
}
}
8 changes: 6 additions & 2 deletions src/services/twitch.ts
Expand Up @@ -181,7 +181,9 @@ class Twitch extends Service {
emitter.emit('set', '/services/twitch', 'broadcasterUsername', '');
tmiEmitter.emit('part', 'broadcaster');
} else {
validate('broadcaster', 0, true);
setTimeout(() => {
validate('broadcaster', 0, true);
}, 5000);
}
break;
case 'botAccessToken':
Expand All @@ -190,7 +192,9 @@ class Twitch extends Service {
emitter.emit('set', '/services/twitch', 'botUsername', '');
tmiEmitter.emit('part', 'bot');
} else {
validate('bot');
setTimeout(() => {
validate('bot', 0, true);
}, 5000);
}
break;
}
Expand Down
4 changes: 3 additions & 1 deletion src/services/twitch/calls/getChannelId.ts
Expand Up @@ -40,7 +40,9 @@ export const getChannelId = async () => {
info('Channel ID set to ' + userFromTwitch.id);
tmiEmitter.emit('reconnect', 'bot');
tmiEmitter.emit('reconnect', 'broadcaster');
updateChannelViewsAndBroadcasterType();
setTimeout(() => {
updateChannelViewsAndBroadcasterType();
}, 10000);
toWait = 10;
} else {
throw new Error('Channel not found on Twitch.');
Expand Down
4 changes: 3 additions & 1 deletion src/services/twitch/chat.ts
Expand Up @@ -169,7 +169,9 @@ class Chat {
this.botWarning = true;
}
refresh(type).then(() => {
this.initClient(type);
setTimeout(() => {
this.initClient(type);
}, 10000);
});
}
}
Expand Down

0 comments on commit a442604

Please sign in to comment.