clean text before haiku
This commit is contained in:
parent
04805ca1d5
commit
5849342584
|
@ -6,7 +6,7 @@ const pluralize = require("pluralize")
|
||||||
|
|
||||||
const { DB, SQL } = require("./db")
|
const { DB, SQL } = require("./db")
|
||||||
|
|
||||||
var client = new irc.Client(process.argv[2] || "207:1473:146:ae77:a3be:d39f:8e59:d256", "testbot", {
|
var client = new irc.Client(process.argv[2] || "irc.osmarks.net", "testbot", {
|
||||||
channels: ["#a", "#botrobots", "#b"],
|
channels: ["#a", "#botrobots", "#b"],
|
||||||
userName: "testbot",
|
userName: "testbot",
|
||||||
encoding: "utf8",
|
encoding: "utf8",
|
||||||
|
@ -117,8 +117,9 @@ client.addListener("message", (nick, channel, message, ev) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sylhist = R.takeLast(3, R.append(syllables(message), sylhist))
|
const messageContent = message.replace(/^(\s*[<\[][A-Za-z0-9_-]+[>\]]\s*)+/, "")
|
||||||
mhist = R.takeLast(50, R.append(message, mhist))
|
sylhist = R.takeLast(3, R.append(syllables(messageContent), sylhist))
|
||||||
|
mhist = R.takeLast(50, R.append(messageContent, mhist))
|
||||||
if (R.equals(sylhist, [5, 7, 5])) {
|
if (R.equals(sylhist, [5, 7, 5])) {
|
||||||
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"))
|
||||||
|
|
Loading…
Reference in New Issue