1
0

🐛 Remove calls to broadcast

Broadcasting is handled in "onRedemption" listener
This commit is contained in:
2022-01-06 01:27:39 +01:00
parent 213fb9d390
commit 0832c5ad6b
2 changed files with 9 additions and 7 deletions

View File

@@ -2,7 +2,6 @@ import { say, timeout } from "../../chatClient/clientActions";
import { LOG_PREFIX } from ".."; import { LOG_PREFIX } from "..";
import { RedemptionMessage } from "../../../interfaces/RedemptionMessage"; import { RedemptionMessage } from "../../../interfaces/RedemptionMessage";
import { broadcast } from "../../helpers/webServer";
import { getUsernameFromId } from "../../helpers/twitch"; import { getUsernameFromId } from "../../helpers/twitch";
import { randomInt } from "crypto"; import { randomInt } from "crypto";
@@ -38,8 +37,6 @@ async function russianRoulette(
msg.message = win ? "" : "got shot"; msg.message = win ? "" : "got shot";
broadcast(JSON.stringify(msg));
const promises: Array<Promise<unknown>> = []; const promises: Array<Promise<unknown>> = [];
if (!win) { if (!win) {
@@ -56,7 +53,15 @@ async function russianRoulette(
promises.push(say(channel, `rdCool Clap ${userDisplayName}`)); promises.push(say(channel, `rdCool Clap ${userDisplayName}`));
} }
await Promise.all(promises); try {
await Promise.allSettled(promises);
} catch (e) {
if (e instanceof Error) {
console.log(`${LOG_PREFIX}${e.message}`);
}
}
return msg;
} }
export { russianRoulette }; export { russianRoulette };

View File

@@ -1,6 +1,5 @@
import { LOG_PREFIX } from ".."; import { LOG_PREFIX } from "..";
import { RedemptionMessage } from "../../../interfaces/RedemptionMessage"; import { RedemptionMessage } from "../../../interfaces/RedemptionMessage";
import { broadcast } from "../../helpers/webServer";
import { getUsernameFromId } from "../../helpers/twitch"; import { getUsernameFromId } from "../../helpers/twitch";
import { timeout } from "../../chatClient/clientActions"; import { timeout } from "../../chatClient/clientActions";
@@ -29,8 +28,6 @@ async function timeoutFriend(
await timeout(channel, msg.message, time, reason); await timeout(channel, msg.message, time, reason);
msg.message = `@${userDisplayName} ha expulsado a @${message} por ${time} segundos`; msg.message = `@${userDisplayName} ha expulsado a @${message} por ${time} segundos`;
broadcast(JSON.stringify(msg));
} catch (e) { } catch (e) {
// user can not be timed out // user can not be timed out
if (e instanceof Error) { if (e instanceof Error) {