new bridge nick format
This commit is contained in:
		| @@ -144,10 +144,10 @@ const singularizer = deriveLLMMapping(PLURALS.map(([a, b]) => ([b, a])), SINGULA | |||||||
| const renderItem = async x => x.quantity === 1 ? x.thing : `${x.quantity} ${await pluralizer(x.thing)}` | const renderItem = async x => x.quantity === 1 ? x.thing : `${x.quantity} ${await pluralizer(x.thing)}` | ||||||
|  |  | ||||||
| client.addListener("message", async (nick, channel, message, ev) => { | client.addListener("message", async (nick, channel, message, ev) => { | ||||||
|     const e = /^<([^>]+)> (.*)$/.exec(message) |     const e = /^(?:<([^>]+)>|\x03\d{1,2}([^\[]+)\[[a-z]\]:\x0f) (.*)$/.exec(message) | ||||||
|     if (e) { |     if (e) { | ||||||
|         nick = e[1] |         nick = e[1] || e[2] | ||||||
|         message = e[2] |         message = e[3] | ||||||
|     } |     } | ||||||
|     const allStatsRaw = SQL`SELECT * FROM stats`.all().map(x => [x.stat, x.value]) |     const allStatsRaw = SQL`SELECT * FROM stats`.all().map(x => [x.stat, x.value]) | ||||||
|     const origStats = new Map(allStatsRaw) |     const origStats = new Map(allStatsRaw) | ||||||
| @@ -169,9 +169,9 @@ client.addListener("message", async (nick, channel, message, ev) => { | |||||||
|             console.log(nick, cmd, channel) |             console.log(nick, cmd, channel) | ||||||
|             allStats.set("commands", (allStats.get("commands") ?? 0) + 1) |             allStats.set("commands", (allStats.get("commands") ?? 0) + 1) | ||||||
|             if (cmd === "starch") { |             if (cmd === "starch") { | ||||||
|                 client.say(channel, `Starch exists (${Math.random() * 20 + 80}% confidence).`) |                 client.say(channel, `Starch has been cancelled. We apologize to our valued customers for any inconvenience this may have caused.`) | ||||||
|             } else if (cmd === "stats") { |             } else if (cmd === "stats") { | ||||||
|                 client.say(channel, `${allStats.get("commands")} run, ${allStats.get("messages")} messages seen, about ${Math.floor(uniqueUsersCounter.count())} nicks seen, about ${Math.floor(uniqueMessagesCounter.count())} unique messages seen.`) |                 client.say(channel, `${allStats.get("commands")} commands run, ${allStats.get("messages")} messages seen, about ${Math.floor(uniqueUsersCounter.count())} nicks seen, about ${Math.floor(uniqueMessagesCounter.count())} unique messages seen.`) | ||||||
|             } else if (cmd === "help") { |             } else if (cmd === "help") { | ||||||
|                 client.say(channel, "Nobody can help you now.") |                 client.say(channel, "Nobody can help you now.") | ||||||
|             } else if (cmd === "fortune") { |             } else if (cmd === "fortune") { | ||||||
| @@ -214,7 +214,9 @@ client.addListener("message", async (nick, channel, message, ev) => { | |||||||
|                 } |                 } | ||||||
|             } else if (cmd.startsWith("inv")) { |             } else if (cmd.startsWith("inv")) { | ||||||
|                 const inv = SQL`SELECT * FROM inventory ORDER BY obtained_at DESC LIMIT 10`.all() |                 const inv = SQL`SELECT * FROM inventory ORDER BY obtained_at DESC LIMIT 10`.all() | ||||||
|                 client.say(channel, inv.map(renderItem).join("\n")) |                 for (const i of inv) { | ||||||
|  |                     client.say(channel, await renderItem(i)) | ||||||
|  |                 } | ||||||
|             } else if (cmd === "deploy") { |             } else if (cmd === "deploy") { | ||||||
|                 client.say(channel, `Deploying ${args}.`) |                 client.say(channel, `Deploying ${args}.`) | ||||||
|             } |             } | ||||||
| @@ -228,7 +230,6 @@ client.addListener("message", async (nick, channel, message, ev) => { | |||||||
|         client.say(channel, "Haiku detected!") |         client.say(channel, "Haiku detected!") | ||||||
|         logEv("haiku", R.takeLast(3, mhist).join("\n")) |         logEv("haiku", R.takeLast(3, mhist).join("\n")) | ||||||
|     } |     } | ||||||
|     console.log(sylhist) |  | ||||||
|  |  | ||||||
|     DB.transaction(() => { |     DB.transaction(() => { | ||||||
|         for (const [k, v] of allStats) { |         for (const [k, v] of allStats) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 osmarks
					osmarks