From ba2a52036964197da8f7469c6eeb1374f481674b Mon Sep 17 00:00:00 2001 From: qwerinope Date: Mon, 8 Sep 2025 20:30:15 +0200 Subject: [PATCH] fixed that @ sign breaks data from redis, minor rephrasing, tnt cheer now plays alert --- .gitignore | 2 ++ README.md | 2 ++ src/cheers/tnt.ts | 10 +++++----- src/events/message.ts | 2 +- src/user.ts | 7 ++++--- 5 files changed, 14 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index 9607f6b..0907968 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,8 @@ report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json # dotenv environment variable files .env +.env.production +.env.development .env.development.local .env.test.local .env.production.local diff --git a/README.md b/README.md index 616353a..55041bb 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ ## Concepts +#### Note: Cheering functionality is working but as I don't have affiliate you can't cheer. You can safely ignore all mentions of cheering. + ### Admins Admins are defined by the streamer and can use special administrative commands on the bot. diff --git a/src/cheers/tnt.ts b/src/cheers/tnt.ts index 78cacc9..a3403e2 100644 --- a/src/cheers/tnt.ts +++ b/src/cheers/tnt.ts @@ -25,13 +25,13 @@ export default new Cheer('tnt', 1000, async (msg, user) => { sendMessage(`wybuh ${target?.displayName} got hit by ${user.displayName}'s TNT wybuh`), createTimeoutRecord(user, target!, ITEMNAME), createCheerEventRecord(user, ITEMNAME), - playAlert({ - name: 'tntExplosion', - user: user.displayName, - targets - }) ]); })); + await playAlert({ + name: 'tntExplosion', + user: user.displayName, + targets + }) await sendMessage(`RIPBOZO ${user.displayName} exploded ${targets.length} chatter${targets.length === 1 ? '' : 's'} with their TNT RIPBOZO`); }); diff --git a/src/events/message.ts b/src/events/message.ts index e1743cf..497a923 100644 --- a/src/events/message.ts +++ b/src/events/message.ts @@ -31,7 +31,7 @@ async function parseChatMessage(msg: EventSubChannelChatMessageEvent) { if (!await isInvuln(user?.id!)) user?.setVulnerable(); // Make the user vulnerable to explosions if not marked as invuln if (!await redis.exists(`user:${user?.id}:haschatted`)) { - await sendMessage(`Welcome ${user?.displayName}. Please note: This chat has PvP, if you get timed out that's part of the qwerinope experience. You have 10 minutes of invincibility. A full list of commands, cheer events and items can be found here: https://github.com/qwerinope/qweribot/#qweribot`); + await sendMessage(`Welcome ${user?.displayName}. Please note: This chat has PvP, if you get timed out that's part of the qwerinope experience. You have 10 minutes of invincibility. A full list of commands and items can be found here: https://github.com/qwerinope/qweribot/#qweribot`); await redis.set(`user:${user?.id}:haschatted`, "1"); if (!streamerUsers.includes(msg.chatterId)) await setTemporaryInvuln(user?.id!); // This would set the invuln expiration lmao }; diff --git a/src/user.ts b/src/user.ts index 0be2647..a531557 100644 --- a/src/user.ts +++ b/src/user.ts @@ -20,10 +20,11 @@ export default class User { public id!: string; public displayName!: string; - static async initUsername(username: string): Promise { + static async initUsername(dirtyUsername: string): Promise { try { const userObj = new User(); - userObj.username = username.replaceAll(/[@]/g, ''); + const username = dirtyUsername.replaceAll(/@/gi, ''); + userObj.username = username; const userid = await redis.get(`userlookup:${username}`); if (!userid) { const userdata = await chatterApi.users.getUserByName(username); @@ -39,7 +40,7 @@ export default class User { }; return userObj; } catch { - logger.err(`Failed to initialize user with name: ${username}`); + logger.err(`Failed to initialize user with name: ${dirtyUsername}`); return null; }; };