minor bugfixes for singleusermode, added seiso command and basic item implementation

items need to check the inventory of the user themselves
also !iteminfo and !use commands should be super easy to make
i do wonder if there's a nicer way to create the Item objects
This commit is contained in:
2025-06-24 23:14:31 +02:00
parent 5728440fcd
commit c0ae6eee7e
5 changed files with 97 additions and 7 deletions

22
bot/items/grenade.ts Normal file
View File

@@ -0,0 +1,22 @@
import { redis } from "bun";
import { sendMessage } from "../commands";
import { timeout } from "../lib/timeout";
import { Item } from ".";
import { User } from "../user";
export default new Item('grenade', 'Grenade', 's',
'Give a random chatter a 60s timeout',
['grenade'],
['moderator:manage:banned_users'],
async (msg, user) => {
const targets = await redis.keys('vulnchatters:*');
if (targets.length === 0) { await sendMessage('No vulnerable chatters to blow up', msg.messageId); return; };
const selection = targets[Math.floor(Math.random() * targets.length)]!;
const target = await User.initUserId(selection.split(':')[1]!);
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`)
]);
}
);