add roulette command

This commit is contained in:
2025-07-20 00:41:20 +01:00
parent 28be02c86e
commit 77a75a1eb9
2 changed files with 21 additions and 0 deletions

View File

@@ -64,6 +64,7 @@ COMMAND|FUNCTION|USER|ALIASES|DISABLEABLE
`ping`|Testing command|anyone|`ping`|:white_check_mark:
`yabai`|Random number|anyone|`yabai` `goon`|:white_check_mark:
`seiso`|Random number|anyone|`seiso`|: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:
### Qweribucks commands

20
src/commands/roulette.ts Normal file
View File

@@ -0,0 +1,20 @@
import { Command, sendMessage } from ".";
import { redis } from "bun";
import { timeout } from "../lib/timeout";
const barrelCount = 6;
export default new Command('roulette', ['roulette'], 'chatter', async (msg, user) => {
if (!await redis.exists('rouletteCount')) await redis.set('rouletteCount', "0");
const currentChamber = Number(await redis.get('rouletteCount'));
const shot = Math.random() < 1 / (barrelCount - currentChamber);
if (!shot) await Promise.all([
redis.incr('rouletteCount'),
sendMessage("SWEAT Click SWEAT", msg.messageId)
]);
else await Promise.all([
redis.set('rouletteCount', "0"),
sendMessage("wybuh BANG!! wybuh"),
timeout(user, "You lost at russian roulette!", 5 * 60)
]);
});