remove ping command, add backshot command, add nice font to chatwidget, add first time chatting warning

This commit is contained in:
2025-07-23 02:53:45 +01:00
parent cc3176ea2f
commit 7489c4f52d
9 changed files with 31 additions and 13 deletions

10
src/commands/backshot.ts Normal file
View File

@@ -0,0 +1,10 @@
import { Command, sendMessage } from ".";
import { User } from "../user";
import { redis } from "bun";
export default new Command('backshot', ['backshot'], 'chatter', async (msg, user) => {
const targets = await redis.keys(`user:*:haschatted`);
const selection = targets[Math.floor(Math.random() * targets.length)]!;
const target = await User.initUserId(selection.slice(5, -11));
await sendMessage(`${user.displayName} backshotted ${target?.displayName}`, msg.messageId);
});

View File

@@ -1,6 +0,0 @@
import { Command, sendMessage } from ".";
// This command is purely for testing
export default new Command('ping', ['ping'], 'chatter', async msg => {
await sendMessage('pong!', msg.messageId);
});

View File

@@ -7,7 +7,7 @@ import { isAdmin } from "../lib/admins";
import cheers from "../cheers";
import logger from "../lib/logger";
import { addMessageToChatWidget } from "../web/chatWidget/message";
import { isInvuln } from "../lib/invuln";
import { isInvuln, setTemporaryInvuln } from "../lib/invuln";
logger.info(`Loaded the following commands: ${commands.keys().toArray().join(', ')}`);
@@ -28,6 +28,12 @@ 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 redis.set(`user:${user?.id}:haschatted`, "1");
if (!streamerUsers.includes(msg.chatterId)) await setTemporaryInvuln(user?.id!); // This would set the invuln expiration lmao
};
if (!msg.isCheer && !msg.isRedemption) await handleChatMessage(msg, user!)
else if (msg.isCheer && !msg.isRedemption) await handleCheer(msg, msg.bits, user!);
};

View File

@@ -14,3 +14,7 @@ export async function addInvuln(userid: string) {
export async function removeInvuln(userid: string) {
return await redis.del(`user:${userid}:invulnerable`);
};
export async function setTemporaryInvuln(userid: string) {
await redis.set(`user:${userid}:invulnerable`, '1');
await redis.expire(`user:${userid}:invulnerable`, 600);
};

View File

@@ -1,4 +1,5 @@
import './style.css';
import '@fontsource/jersey-15';
import { type twitchEventData } from "../../websockettypes";
import { parseMessage } from './createMessage';

View File

@@ -1,7 +1,8 @@
:root {
font-family: system-ui, Avenir, Helvetica, Arial, sans-serif;
line-height: 1.5;
font-family: 'Jersey 15', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
line-height: 1;
font-weight: 400;
font-size: 5vmin;
color-scheme: light dark;
color: rgba(255, 255, 255, 0.87);
@@ -22,8 +23,6 @@ body {
#app {
max-width: 1280px;
margin: 0 auto;
padding: 2rem;
}
.message {
@@ -43,7 +42,7 @@ body {
img {
vertical-align: middle;
height: 18px;
height: 5vmin;
padding: 1px;
}