From 04805ca1d58253ce0c4bd94b19d4f33a86faa6b3 Mon Sep 17 00:00:00 2001 From: osmarks Date: Wed, 7 Jul 2021 18:17:26 +0100 Subject: [PATCH] whatever --- src/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index 0630bd2..4c99454 100644 --- a/src/index.js +++ b/src/index.js @@ -85,7 +85,7 @@ client.addListener("message", (nick, channel, message, ev) => { const things = args.split(/(,| and )/).map(x => x.trim().replace(",", "").replace(/^(an?|the) /, "")).filter(x => x !== "" && x !== "and") for (let thing of things) { let qty = 1 - const res = /^([-0-9.]+|some|many)\b\s*(.*)$/iu.exec(thing) + const res = /^([-0-9.]+|some|many|half)\b\s*(.*)$/iu.exec(thing) if (res) { const [_, rrqty, rthing] = res thing = rthing @@ -94,6 +94,8 @@ client.addListener("message", (nick, channel, message, ev) => { qty = Math.floor(Math.random() * 17) } else if (rqty === "many") { qty = Math.floor(Math.random() * 2300) + } else if (rqty === "half") { + qty = 0.5 } else { qty = parseFloat(rqty) }