fix alert volumes

This commit is contained in:
2025-09-28 15:03:22 +02:00
parent ec7fb705c8
commit e4cfa74130
5 changed files with 20 additions and 7 deletions

View File

@@ -54,13 +54,13 @@ import logger from "lib/logger";
const currentRedeems = new Map<string, string>;
await streamerApi.channelPoints.getCustomRewards(streamerId).then(a => a.map(b => currentRedeems.set(b.title, b.id)));
for (const [_, redeem] of Array.from(namedRedeems)) {
if (process.env.NODE_ENV !== 'production') continue; // If created with dev-app we won't be able to change it with prod app
const selection = currentRedeems.get(redeem.title);
if (selection) {
currentRedeems.delete(redeem.title);
idMap.set(redeem.name, selection);
activeRedeems.set(selection, redeem);
} else {
if (process.env.NODE_ENV !== 'production') continue; // If created with dev-app we won't be able to change it with prod app
const creation = await streamerApi.channelPoints.createCustomReward(streamerId, {
title: redeem.title,
prompt: redeem.prompt,

View File

@@ -2,9 +2,11 @@ import { grenadeExplosionAlert } from "web/alerts/types";
import { AlertRunner } from "./index";
const duration = 1000;
const volume = 0.1;
export default async function execute(alert: grenadeExplosionAlert): Promise<AlertRunner> {
const audio = new Audio("/alerts/public/explosion2.ogg");
audio.volume = volume;
const parentDiv = document.createElement('div');
parentDiv.className = 'grenadeExplosionAlert';

View File

@@ -2,6 +2,7 @@ import { tntExplosionAlert } from "web/alerts/types";
import { AlertRunner } from "./index";
const duration = 1500;
const volume = 0.1;
export default async function execute(alert: tntExplosionAlert): Promise<AlertRunner> {
const parentDiv = document.createElement('div');
@@ -16,11 +17,18 @@ export default async function execute(alert: tntExplosionAlert): Promise<AlertRu
text-align: center;
}
</style>
<video autoplay height="800" width="450">
<source src="/alerts/public/tnt.mp4">
</video>
`;
const video = document.createElement('video');
video.volume = volume;
video.src = "/alerts/public/tnt.mp4";
video.autoplay = true;
video.height = 800;
video.width = 450;
parentDiv.appendChild(video);
const randomX = Math.floor(Math.random() * (window.innerWidth - 450 - 300)) + 150;
const randomY = Math.floor(Math.random() * (window.innerHeight - 800 - 300)) + 150;

View File

@@ -2,9 +2,11 @@ import { userBlastAlert } from "web/alerts/types";
import { AlertRunner } from "./index";
const duration = 1000;
const volume = 0.1;
export default async function execute(alert: userBlastAlert): Promise<AlertRunner> {
const audio = new Audio("/alerts/public/explosion1.ogg");
audio.volume = volume;
const parentDiv = document.createElement('div');
parentDiv.className = 'userBlastAlert';

View File

@@ -2,6 +2,7 @@ import { userExecutionAlert } from "web/alerts/types";
import { AlertRunner } from "./index";
const duration = 3000;
const volume = 0.1;
export default async function execute(alert: userExecutionAlert): Promise<AlertRunner> {
const parentDiv = document.createElement('div');
@@ -57,9 +58,9 @@ export default async function execute(alert: userExecutionAlert): Promise<AlertR
const audio2 = new Audio("/alerts/public/explosion2.ogg");
const audio3 = new Audio("/alerts/public/explosion3.ogg");
audio1.volume = 1.0;
audio2.volume = 1.0;
audio3.volume = 1.0;
audio1.volume = volume;
audio2.volume = volume;
audio3.volume = volume;
audio1.play();
audio2.play();
audio3.play();