mirror of
https://gitlab.com/qwerinope/qweribot.git
synced 2026-02-04 12:26:57 +01:00
auth softlock fixes, added shortcut to enable/disable redeem for sfx
This commit is contained in:
@@ -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>;
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user