add grenade cheer, minor tnt cheer fix

This commit is contained in:
2025-07-20 13:31:55 +01:00
parent 77a75a1eb9
commit 41bad3dbd1
3 changed files with 28 additions and 1 deletions

View File

@@ -41,6 +41,7 @@ Every user has a wallet with qweribucks, and an inventory. There is no limit to
When using/giving an item or qbucks the itemlock will be set at the start of the transaction and cleared when it ends. This is to prevent items being duplicated.
Admins can toggle the itemlock on chatters with the [`itemlock`](#administrative-commands) command. This will stop a chatter from giving, receiving and using items and qweribucks.
It will NOT stop them from using items by cheering, but if that cheer item usage fails, they will not be given an equivalent item as compensation.
Items can be used with the alias as a command (example: `blast qwerinope`) or with the [`use` command](#item-commands).
@@ -119,6 +120,7 @@ TNT|`tnt`|Give 5-10 random chatters 60 second timeouts|`tnt`
NAME|AMOUNT|USAGE|FUNCTION
-|-|-|-
`grenade`|99|`cheer99`|Times a random vulnerable chatter out for 60 seconds. Of failure gives cheerer a grenade
`timeout`|100|`cheer100 {target}`|Times specified user out for 1 minute. On failure gives cheerer a blaster
`tnt`|1000|`cheer1000`|Gives 5-10 random vulnerable chatters 60 second timeouts. On failure gives cheerer a TNT
`execute`|6666|`cheer6666 {target}`|Times specified user out for 24 hours. On failure gives cheerer a silver bullet

25
src/cheers/grenade.ts Normal file
View File

@@ -0,0 +1,25 @@
import { redis } from "bun";
import { sendMessage } from "../commands";
import { timeout } from "../lib/timeout";
import { User } from "../user";
import { getUserRecord } from "../db/dbUser";
import { createTimeoutRecord } from "../db/dbTimeouts";
import { Cheer, handleNoTarget } from ".";
const ITEMNAME = 'grenade';
export default new Cheer(ITEMNAME, 99, async (msg, user) => {
const targets = await redis.keys(`user:*:vulnerable`);
if (targets.length === 0) { await sendMessage('No vulnerable chatters to blow up!', msg.messageId); await handleNoTarget(msg, user, ITEMNAME); return; };
const selection = targets[Math.floor(Math.random() * targets.length)]!;
const target = await User.initUserId(selection.slice(5, -11));
await getUserRecord(target!); // make sure the user record exist in the database
await Promise.all([
timeout(target!, `You got hit by ${user.displayName}'s grenade!`, 60),
redis.del(selection),
sendMessage(`wybuh ${target?.displayName} got hit by ${user.displayName}'s grenade wybuh`),
createTimeoutRecord(user, target!, ITEMNAME)
]);
});

View File

@@ -11,7 +11,7 @@ const ITEMNAME = 'tnt';
export default new Cheer('tnt', 1000, async (msg, user) => {
const vulntargets = await redis.keys('user:*:vulnerable').then(a => a.map(b => b.slice(5, -11)));
if (vulntargets.length === 0) { await sendMessage('No vulnerable chatters to blow up', msg.messageId); handleNoTarget(msg, user, ITEMNAME); return; };
if (vulntargets.length === 0) { await sendMessage('No vulnerable chatters to blow up', msg.messageId); await handleNoTarget(msg, user, ITEMNAME); return; };
const targets = getTNTTargets(vulntargets);
await Promise.all(targets.map(async targetid => {