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

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)
]);
});