mirror of
https://github.com/qwerinope/qweribot.git
synced 2025-12-19 07:01:38 +01:00
prompt injection fix
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import { EventSubChannelChatMessageEvent } from "@twurple/eventsub-base"
|
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 User from "user";
|
||||||
import commands, { Command, sendMessage, specialAliasCommands } from "commands";
|
import commands, { Command, sendMessage, specialAliasCommands } from "commands";
|
||||||
import { redis } from "bun";
|
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)
|
// 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
|
// 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) {
|
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`);
|
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(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!)
|
if (!msg.isCheer && !msg.isRedemption) await handleChatMessage(msg, user!)
|
||||||
else if (msg.isCheer && !msg.isRedemption) await handleCheer(msg, msg.bits, user!);
|
else if (msg.isCheer && !msg.isRedemption) await handleCheer(msg, msg.bits, user!);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user