This commit is contained in:
osmarks 2021-07-07 18:17:26 +01:00
parent d932447591
commit 04805ca1d5
1 changed files with 3 additions and 1 deletions

View File

@ -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)
}