auth softlock fixes, added shortcut to enable/disable redeem for sfx

This commit is contained in:
2025-09-30 22:36:56 +02:00
parent e4cfa74130
commit fdd9a34819
8 changed files with 42 additions and 4 deletions

View File

@@ -7,6 +7,7 @@ export type pointRedeemOptions = {
prompt?: string;
cost: number;
color?: string;
sfxredeem?: boolean;
execution: (message: EventSubChannelRedemptionAddEvent, sender: User) => Promise<void>;
};
@@ -17,6 +18,7 @@ export default class PointRedeem {
public readonly prompt?: string;
public readonly cost: number;
public readonly color?: string;
public readonly sfxredeem?: boolean;
public readonly execute: (message: EventSubChannelRedemptionAddEvent, sender: User) => Promise<void>;
constructor(options: pointRedeemOptions) {
this.name = options.name.toLowerCase();
@@ -25,6 +27,7 @@ export default class PointRedeem {
this.cost = options.cost;
this.color = options.color;
this.execute = options.execution;
this.sfxredeem = options.sfxredeem;
};
};
@@ -33,15 +36,18 @@ import { readdir } from 'node:fs/promises';
/** A map of all (including inactive) redeems mapped to names */
const namedRedeems = new Map<string, PointRedeem>;
const sfxRedeems = new Map<string, PointRedeem>;
const files = await readdir(import.meta.dir);
for (const file of files) {
if (!file.endsWith('.ts')) continue;
if (file === import.meta.file) continue;
const redeem: PointRedeem = await import(import.meta.dir + '/' + file.slice(0, -3)).then(a => a.default);
namedRedeems.set(redeem.name, redeem);
if (redeem.sfxredeem) sfxRedeems.set(redeem.name, redeem);
};
export { namedRedeems };
export { namedRedeems, sfxRedeems };
const activeRedeems = new Map<string, PointRedeem>;

View File

@@ -7,6 +7,7 @@ export default new PointRedeem({
cost: 100,
color: "#A020F0",
prompt: "Eddie screaming",
sfxredeem: true,
execution: async msg => await playAlert({
name: 'sound',
user: msg.userDisplayName,

View File

@@ -7,6 +7,7 @@ export default new PointRedeem({
cost: 100,
color: "#A020F0",
prompt: "mrockstar20 saying 'Welcome to the Madhouse'",
sfxredeem: true,
execution: async msg => await playAlert({
name: 'sound',
user: msg.userDisplayName,

View File

@@ -7,6 +7,7 @@ export default new PointRedeem({
cost: 500,
color: "#A020F0",
prompt: "Coffeezilla calls me a conman",
sfxredeem: true,
execution: async msg => await playAlert({
name: 'sound',
user: msg.userDisplayName,