mirror of
https://github.com/qwerinope/qweribot.git
synced 2025-12-19 08:41:39 +01:00
fix alert volumes
This commit is contained in:
@@ -54,13 +54,13 @@ import logger from "lib/logger";
|
|||||||
const currentRedeems = new Map<string, string>;
|
const currentRedeems = new Map<string, string>;
|
||||||
await streamerApi.channelPoints.getCustomRewards(streamerId).then(a => a.map(b => currentRedeems.set(b.title, b.id)));
|
await streamerApi.channelPoints.getCustomRewards(streamerId).then(a => a.map(b => currentRedeems.set(b.title, b.id)));
|
||||||
for (const [_, redeem] of Array.from(namedRedeems)) {
|
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);
|
const selection = currentRedeems.get(redeem.title);
|
||||||
if (selection) {
|
if (selection) {
|
||||||
currentRedeems.delete(redeem.title);
|
currentRedeems.delete(redeem.title);
|
||||||
idMap.set(redeem.name, selection);
|
idMap.set(redeem.name, selection);
|
||||||
activeRedeems.set(selection, redeem);
|
activeRedeems.set(selection, redeem);
|
||||||
} else {
|
} 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, {
|
const creation = await streamerApi.channelPoints.createCustomReward(streamerId, {
|
||||||
title: redeem.title,
|
title: redeem.title,
|
||||||
prompt: redeem.prompt,
|
prompt: redeem.prompt,
|
||||||
|
|||||||
@@ -2,9 +2,11 @@ import { grenadeExplosionAlert } from "web/alerts/types";
|
|||||||
import { AlertRunner } from "./index";
|
import { AlertRunner } from "./index";
|
||||||
|
|
||||||
const duration = 1000;
|
const duration = 1000;
|
||||||
|
const volume = 0.1;
|
||||||
|
|
||||||
export default async function execute(alert: grenadeExplosionAlert): Promise<AlertRunner> {
|
export default async function execute(alert: grenadeExplosionAlert): Promise<AlertRunner> {
|
||||||
const audio = new Audio("/alerts/public/explosion2.ogg");
|
const audio = new Audio("/alerts/public/explosion2.ogg");
|
||||||
|
audio.volume = volume;
|
||||||
|
|
||||||
const parentDiv = document.createElement('div');
|
const parentDiv = document.createElement('div');
|
||||||
parentDiv.className = 'grenadeExplosionAlert';
|
parentDiv.className = 'grenadeExplosionAlert';
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { tntExplosionAlert } from "web/alerts/types";
|
|||||||
import { AlertRunner } from "./index";
|
import { AlertRunner } from "./index";
|
||||||
|
|
||||||
const duration = 1500;
|
const duration = 1500;
|
||||||
|
const volume = 0.1;
|
||||||
|
|
||||||
export default async function execute(alert: tntExplosionAlert): Promise<AlertRunner> {
|
export default async function execute(alert: tntExplosionAlert): Promise<AlertRunner> {
|
||||||
const parentDiv = document.createElement('div');
|
const parentDiv = document.createElement('div');
|
||||||
@@ -16,11 +17,18 @@ export default async function execute(alert: tntExplosionAlert): Promise<AlertRu
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
</style>
|
</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 randomX = Math.floor(Math.random() * (window.innerWidth - 450 - 300)) + 150;
|
||||||
const randomY = Math.floor(Math.random() * (window.innerHeight - 800 - 300)) + 150;
|
const randomY = Math.floor(Math.random() * (window.innerHeight - 800 - 300)) + 150;
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,11 @@ import { userBlastAlert } from "web/alerts/types";
|
|||||||
import { AlertRunner } from "./index";
|
import { AlertRunner } from "./index";
|
||||||
|
|
||||||
const duration = 1000;
|
const duration = 1000;
|
||||||
|
const volume = 0.1;
|
||||||
|
|
||||||
export default async function execute(alert: userBlastAlert): Promise<AlertRunner> {
|
export default async function execute(alert: userBlastAlert): Promise<AlertRunner> {
|
||||||
const audio = new Audio("/alerts/public/explosion1.ogg");
|
const audio = new Audio("/alerts/public/explosion1.ogg");
|
||||||
|
audio.volume = volume;
|
||||||
|
|
||||||
const parentDiv = document.createElement('div');
|
const parentDiv = document.createElement('div');
|
||||||
parentDiv.className = 'userBlastAlert';
|
parentDiv.className = 'userBlastAlert';
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { userExecutionAlert } from "web/alerts/types";
|
|||||||
import { AlertRunner } from "./index";
|
import { AlertRunner } from "./index";
|
||||||
|
|
||||||
const duration = 3000;
|
const duration = 3000;
|
||||||
|
const volume = 0.1;
|
||||||
|
|
||||||
export default async function execute(alert: userExecutionAlert): Promise<AlertRunner> {
|
export default async function execute(alert: userExecutionAlert): Promise<AlertRunner> {
|
||||||
const parentDiv = document.createElement('div');
|
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 audio2 = new Audio("/alerts/public/explosion2.ogg");
|
||||||
const audio3 = new Audio("/alerts/public/explosion3.ogg");
|
const audio3 = new Audio("/alerts/public/explosion3.ogg");
|
||||||
|
|
||||||
audio1.volume = 1.0;
|
audio1.volume = volume;
|
||||||
audio2.volume = 1.0;
|
audio2.volume = volume;
|
||||||
audio3.volume = 1.0;
|
audio3.volume = volume;
|
||||||
audio1.play();
|
audio1.play();
|
||||||
audio2.play();
|
audio2.play();
|
||||||
audio3.play();
|
audio3.play();
|
||||||
|
|||||||
Reference in New Issue
Block a user