added invulnerable chatters, completely reworked the way vulnerable chatters and admins is stored

This commit is contained in:
2025-07-17 22:05:56 +02:00
parent 0ebc3d7cf6
commit dcd2eda439
16 changed files with 142 additions and 23 deletions

View File

@@ -15,10 +15,10 @@ export default new Item(ITEMNAME, 'Grenade', 's',
async (msg, user) => {
const userObj = await getUserRecord(user);
if (userObj.inventory[ITEMNAME]! < 1) { await sendMessage(`You don't have any grenades!`, msg.messageId); return; };
const targets = await redis.keys('vulnchatters:*');
const targets = await redis.keys(`user:*:vulnerable`);
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]!);
const target = await User.initUserId(selection.slice(5, -11));
await getUserRecord(target!); // make sure the user record exist in the database