Compare commits

...

2 Commits

Author SHA1 Message Date
04487d3aae remove ! from args 2025-09-14 22:01:23 +02:00
56aa677fe0 prompt injection fix 2025-09-14 21:58:00 +02:00
2 changed files with 5 additions and 3 deletions

View File

@@ -1,5 +1,5 @@
import { EventSubChannelChatMessageEvent } from "@twurple/eventsub-base"
import { streamerId, eventSub, commandPrefix, streamerUsers } from "main";
import { streamerId, eventSub, commandPrefix, streamerUsers, chatterId } from "main";
import User from "user";
import commands, { Command, sendMessage, specialAliasCommands } from "commands";
import { redis } from "bun";
@@ -27,7 +27,7 @@ async function parseChatMessage(msg: EventSubChannelChatMessageEvent) {
// and both are usable to target the same user (id is the same)
// The only problem would be if a user changed their name and someone else took their name right after
if (!await isInvuln(user?.id!)) user?.setVulnerable(); // Make the user vulnerable to explosions if not marked as invuln
if (msg.chatterId === chatterId) return;
if (!await redis.exists(`user:${user?.id}:haschatted`) && !msg.sourceMessageId) {
const message = 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`);
@@ -37,6 +37,8 @@ async function parseChatMessage(msg: EventSubChannelChatMessageEvent) {
if (!await isInvuln(msg.chatterId)) await setTemporaryInvuln(user?.id!); // This would set the invuln expiration lmao
};
if (!await isInvuln(user?.id!)) user?.setVulnerable(); // Make the user vulnerable to explosions if not marked as invuln
if (!msg.isCheer && !msg.isRedemption) await handleChatMessage(msg, user!)
else if (msg.isCheer && !msg.isRedemption) await handleCheer(msg, msg.bits, user!);
};

View File

@@ -10,7 +10,7 @@ export default function parseCommandArgs(input: string, specialAlias?: string) {
nice = input.toLowerCase().slice(commandPrefix.length).trim();
sliceLength = nice.startsWith('use') ? 2 : 1;
}
return nice.split(' ').slice(sliceLength);
return nice.split(' ').slice(sliceLength).map(a => a.replaceAll(/!/gi, ''));
};
export function parseCheerArgs(input: string) {