mirror of
https://github.com/qwerinope/qweribot.git
synced 2025-12-19 05:31:38 +01:00
remove ping command, add backshot command, add nice font to chatwidget, add first time chatting warning
This commit is contained in:
@@ -62,9 +62,9 @@ The streamerbot (not that streamerbot) is the broadcaster. This bot needs them t
|
|||||||
|
|
||||||
COMMAND|FUNCTION|USER|ALIASES|DISABLEABLE
|
COMMAND|FUNCTION|USER|ALIASES|DISABLEABLE
|
||||||
-|-|-|-|-
|
-|-|-|-|-
|
||||||
`ping`|Testing command|anyone|`ping`|:white_check_mark:
|
|
||||||
`yabai`|Random number|anyone|`yabai` `goon`|:white_check_mark:
|
`yabai`|Random number|anyone|`yabai` `goon`|:white_check_mark:
|
||||||
`seiso`|Random number|anyone|`seiso`|:white_check_mark:
|
`seiso`|Random number|anyone|`seiso`|:white_check_mark:
|
||||||
|
`backshot`|'Backshot' a random previous chatter|anyone|`backshot`|:white_check_mark:
|
||||||
`roulette`|Play russian roulette for a 5 minute timeout|anyone|`roulette`|:white_check_mark:
|
`roulette`|Play russian roulette for a 5 minute timeout|anyone|`roulette`|:white_check_mark:
|
||||||
`timeout {target}`|Times targeted user out for 60 seconds (costs 100 qweribucks)|anyone|`timeout`|:white_check_mark:
|
`timeout {target}`|Times targeted user out for 60 seconds (costs 100 qweribucks)|anyone|`timeout`|:white_check_mark:
|
||||||
|
|
||||||
|
|||||||
3
bun.lock
3
bun.lock
@@ -4,6 +4,7 @@
|
|||||||
"": {
|
"": {
|
||||||
"name": "qweribot",
|
"name": "qweribot",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@fontsource/jersey-15": "^5.2.6",
|
||||||
"@twurple/auth": "^7.3.0",
|
"@twurple/auth": "^7.3.0",
|
||||||
"@twurple/eventsub-ws": "^7.3.0",
|
"@twurple/eventsub-ws": "^7.3.0",
|
||||||
"kleur": "^4.1.5",
|
"kleur": "^4.1.5",
|
||||||
@@ -38,6 +39,8 @@
|
|||||||
|
|
||||||
"@d-fischer/typed-event-emitter": ["@d-fischer/typed-event-emitter@3.3.3", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-OvSEOa8icfdWDqcRtjSEZtgJTFOFNgTjje7zaL0+nAtu2/kZtRCSK5wUMrI/aXtCH8o0Qz2vA8UqkhWUTARFQQ=="],
|
"@d-fischer/typed-event-emitter": ["@d-fischer/typed-event-emitter@3.3.3", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-OvSEOa8icfdWDqcRtjSEZtgJTFOFNgTjje7zaL0+nAtu2/kZtRCSK5wUMrI/aXtCH8o0Qz2vA8UqkhWUTARFQQ=="],
|
||||||
|
|
||||||
|
"@fontsource/jersey-15": ["@fontsource/jersey-15@5.2.6", "", {}, "sha512-3zkkEnu91esusWLqAK/AN1uc6jNtWT8idfO0UfYLqNlbMBKkbbiIVXtq6UbQsyegxnmRMppVV1J2t1zrJ36VgA=="],
|
||||||
|
|
||||||
"@twurple/api": ["@twurple/api@7.3.0", "", { "dependencies": { "@d-fischer/cache-decorators": "^4.0.0", "@d-fischer/cross-fetch": "^5.0.1", "@d-fischer/detect-node": "^3.0.1", "@d-fischer/logger": "^4.2.1", "@d-fischer/rate-limiter": "^1.1.0", "@d-fischer/shared-utils": "^3.6.1", "@d-fischer/typed-event-emitter": "^3.3.1", "@twurple/api-call": "7.3.0", "@twurple/common": "7.3.0", "retry": "^0.13.1", "tslib": "^2.0.3" }, "peerDependencies": { "@twurple/auth": "7.3.0" } }, "sha512-QtaVgYi50E3AB/Nxivjou/u6w1cuQ6g4R8lzQawYDaQNtlP2Ue8vvYuSp2PfxSpe8vNiKhgV8hZAs+j4V29sxQ=="],
|
"@twurple/api": ["@twurple/api@7.3.0", "", { "dependencies": { "@d-fischer/cache-decorators": "^4.0.0", "@d-fischer/cross-fetch": "^5.0.1", "@d-fischer/detect-node": "^3.0.1", "@d-fischer/logger": "^4.2.1", "@d-fischer/rate-limiter": "^1.1.0", "@d-fischer/shared-utils": "^3.6.1", "@d-fischer/typed-event-emitter": "^3.3.1", "@twurple/api-call": "7.3.0", "@twurple/common": "7.3.0", "retry": "^0.13.1", "tslib": "^2.0.3" }, "peerDependencies": { "@twurple/auth": "7.3.0" } }, "sha512-QtaVgYi50E3AB/Nxivjou/u6w1cuQ6g4R8lzQawYDaQNtlP2Ue8vvYuSp2PfxSpe8vNiKhgV8hZAs+j4V29sxQ=="],
|
||||||
|
|
||||||
"@twurple/api-call": ["@twurple/api-call@7.3.0", "", { "dependencies": { "@d-fischer/cross-fetch": "^5.0.1", "@d-fischer/qs": "^7.0.2", "@d-fischer/shared-utils": "^3.6.1", "@twurple/common": "7.3.0", "tslib": "^2.0.3" } }, "sha512-nx389kXjVphAeR3RfnzkRRf7Qa45wqHla067/mr3YxnUICCg4YOFv0Jb5UohQGHkj5h18mDZ3iUu/x2J49c1lA=="],
|
"@twurple/api-call": ["@twurple/api-call@7.3.0", "", { "dependencies": { "@d-fischer/cross-fetch": "^5.0.1", "@d-fischer/qs": "^7.0.2", "@d-fischer/shared-utils": "^3.6.1", "@twurple/common": "7.3.0", "tslib": "^2.0.3" } }, "sha512-nx389kXjVphAeR3RfnzkRRf7Qa45wqHla067/mr3YxnUICCg4YOFv0Jb5UohQGHkj5h18mDZ3iUu/x2J49c1lA=="],
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@fontsource/jersey-15": "^5.2.6",
|
||||||
"@twurple/auth": "^7.3.0",
|
"@twurple/auth": "^7.3.0",
|
||||||
"@twurple/eventsub-ws": "^7.3.0",
|
"@twurple/eventsub-ws": "^7.3.0",
|
||||||
"kleur": "^4.1.5",
|
"kleur": "^4.1.5",
|
||||||
|
|||||||
10
src/commands/backshot.ts
Normal file
10
src/commands/backshot.ts
Normal 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);
|
||||||
|
});
|
||||||
@@ -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);
|
|
||||||
});
|
|
||||||
@@ -7,7 +7,7 @@ import { isAdmin } from "../lib/admins";
|
|||||||
import cheers from "../cheers";
|
import cheers from "../cheers";
|
||||||
import logger from "../lib/logger";
|
import logger from "../lib/logger";
|
||||||
import { addMessageToChatWidget } from "../web/chatWidget/message";
|
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(', ')}`);
|
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 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!)
|
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!);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -14,3 +14,7 @@ export async function addInvuln(userid: string) {
|
|||||||
export async function removeInvuln(userid: string) {
|
export async function removeInvuln(userid: string) {
|
||||||
return await redis.del(`user:${userid}:invulnerable`);
|
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);
|
||||||
|
};
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import './style.css';
|
import './style.css';
|
||||||
|
import '@fontsource/jersey-15';
|
||||||
|
|
||||||
import { type twitchEventData } from "../../websockettypes";
|
import { type twitchEventData } from "../../websockettypes";
|
||||||
import { parseMessage } from './createMessage';
|
import { parseMessage } from './createMessage';
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
:root {
|
:root {
|
||||||
font-family: system-ui, Avenir, Helvetica, Arial, sans-serif;
|
font-family: 'Jersey 15', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
|
||||||
line-height: 1.5;
|
line-height: 1;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
|
font-size: 5vmin;
|
||||||
|
|
||||||
color-scheme: light dark;
|
color-scheme: light dark;
|
||||||
color: rgba(255, 255, 255, 0.87);
|
color: rgba(255, 255, 255, 0.87);
|
||||||
@@ -22,8 +23,6 @@ body {
|
|||||||
|
|
||||||
#app {
|
#app {
|
||||||
max-width: 1280px;
|
max-width: 1280px;
|
||||||
margin: 0 auto;
|
|
||||||
padding: 2rem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.message {
|
.message {
|
||||||
@@ -43,7 +42,7 @@ body {
|
|||||||
|
|
||||||
img {
|
img {
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
height: 18px;
|
height: 5vmin;
|
||||||
padding: 1px;
|
padding: 1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user