From 25103681ba18ea365fb7425cf74df3cfb6a4ac00 Mon Sep 17 00:00:00 2001 From: Joonas Date: Mon, 13 Feb 2023 11:57:20 +0200 Subject: [PATCH] removed coinflip --- commands/megis.js | 84 ----------------------------------------------- 1 file changed, 84 deletions(-) diff --git a/commands/megis.js b/commands/megis.js index f90ac99..e23e17c 100644 --- a/commands/megis.js +++ b/commands/megis.js @@ -167,90 +167,6 @@ const command = { break; } - case "cf": { - if ( - (isNaN(splitted[3]) && splitted[3] !== "all") || - splitted[3] === 0 - ) { - await client.say( - msg.channelName, - `${msg.displayName}, arg needs to be a valid number or 'all'` - ); - - return; - } - - if (splitted[3] !== "all") { - if (parseInt(splitted[3]) > user.megis.megis) { - await client.say( - msg.channelName, - `${msg.displayName}, you don't have that much megis!` - ); - return; - } - } - - const takeBet = await prisma.user.update({ - where: { - userId: msg.senderUserID, - }, - data: { - megis: { - update: { - megis: { - decrement: - splitted[3] === "all" - ? parseInt(user.megis.megis) - : parseInt(splitted[3]), - }, - }, - }, - }, - include: { - megis: true, - }, - }); - - const flip = Math.floor(Math.random() * 2); - let result; - - if (flip === 1) { - result = await prisma.user.update({ - where: { - userId: msg.senderUserID, - }, - data: { - megis: { - update: { - megis: { - increment: - splitted[3] === "all" - ? user.megis.megis * 3 - : splitted[3] * 3, - }, - }, - }, - }, - include: { - megis: true, - }, - }); - } - - await client.say( - msg.channelName, - result - ? `${msg.displayName}, you won! +${ - splitted[3] === "all" ? user.megis.megis * 2 : splitted[3] * 2 - } Current megis: ${result.megis.megis}` - : `${msg.displayName}, you lost! -${ - splitted[3] === "all" ? user.megis.megis : splitted[3] - } Current megis: ${takeBet.megis.megis}` - ); - - break; - } - case "lb": { const allMegisers = await prisma.user.findMany({ take: 3,