rework auth (i'm an idiot), add whisper commands, change whispercmds, back to webhook

This commit is contained in:
2025-11-20 20:23:24 +01:00
parent 977082f38e
commit 34fa80e292
20 changed files with 263 additions and 200 deletions

View File

@@ -56,10 +56,10 @@ const idMap = new Map<string, string>;
import { streamerId } from "main";
import logger from "lib/logger";
import { streamerApi } from "index";
import { api } from "index";
const currentRedeems = new Map<string, string>;
await streamerApi.channelPoints.getCustomRewards(streamerId).then(a => a.map(b => currentRedeems.set(b.title, b.id)));
await api.channelPoints.getCustomRewards(streamerId).then(a => a.map(b => currentRedeems.set(b.title, b.id)));
for (const [_, redeem] of Array.from(namedRedeems)) {
const selection = currentRedeems.get(redeem.title);
if (selection) {
@@ -68,7 +68,7 @@ for (const [_, redeem] of Array.from(namedRedeems)) {
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, {
const creation = await api.channelPoints.createCustomReward(streamerId, {
title: redeem.title,
prompt: redeem.prompt,
cost: redeem.cost,
@@ -82,14 +82,14 @@ for (const [_, redeem] of Array.from(namedRedeems)) {
Array.from(currentRedeems).map(async ([title, redeem]) => {
if (process.env.NODE_ENV !== 'production') return;
await streamerApi.channelPoints.deleteCustomReward(streamerId, redeem); logger.ok(`Deleted custom point redeem ${title}`);
await api.channelPoints.deleteCustomReward(streamerId, redeem); logger.ok(`Deleted custom point redeem ${title}`);
});
logger.ok("Successfully synced all custom point redeems");
export async function enableRedeem(redeem: PointRedeem, id: string) {
if (process.env.NODE_ENV !== 'production') return;
await streamerApi.channelPoints.updateCustomReward(streamerId, id, {
await api.channelPoints.updateCustomReward(streamerId, id, {
isEnabled: true
});
activeRedeems.set(id, redeem);
@@ -98,7 +98,7 @@ export async function enableRedeem(redeem: PointRedeem, id: string) {
export async function disableRedeem(redeem: PointRedeem, id: string) {
if (process.env.NODE_ENV !== 'production') return;
await streamerApi.channelPoints.updateCustomReward(streamerId, id, {
await api.channelPoints.updateCustomReward(streamerId, id, {
isEnabled: false
});
activeRedeems.delete(id);