From e68a2d61a7ac985dfac270ffab2cb32ea02cd569 Mon Sep 17 00:00:00 2001 From: duncte123 Date: Mon, 25 Nov 2024 15:35:59 +0100 Subject: [PATCH] Fix some io responses --- .../kotlin/me/duncte123/io/hirobs/ReactionHandler.kt | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/kotlin/me/duncte123/io/hirobs/ReactionHandler.kt b/src/main/kotlin/me/duncte123/io/hirobs/ReactionHandler.kt index b8388a8..30b239d 100644 --- a/src/main/kotlin/me/duncte123/io/hirobs/ReactionHandler.kt +++ b/src/main/kotlin/me/duncte123/io/hirobs/ReactionHandler.kt @@ -26,7 +26,8 @@ class ReactionHandler { private val limit = Bandwidth.simple(1, Duration.ofSeconds(300)) private val buckets = mutableMapOf() - private val ioRegex = ":(?:[^:]+)?io[^:]+?:".toRegex() + private val ioRegexIgnoreEmotes = ":(?:[^:]+)?io[^:]+?:".toRegex() + private val ioNameRegex = "\\bio".toRegex(RegexOption.IGNORE_CASE) // if you read this, the key is used for ratelimiting private val reactionMap = mapOf( @@ -68,8 +69,9 @@ class ReactionHandler { 5.0, true, { - ioRegex.find(it.message.contentRaw.lowercase()) == null || - it.message.contentRaw.contains("<@!?1215363445583646750>".toRegex()) + ioRegexIgnoreEmotes.find(it.message.contentRaw.lowercase()) == null || + it.message.contentRaw.contains("<@!?1215363445583646750>".toRegex()) || + ioNameRegex.find(it.message.contentRaw.lowercase()) != null } ), "oldlady" to StringReaction( @@ -121,9 +123,9 @@ class ReactionHandler { private val channelReactions = mapOf( GEN_CHAT_ID to StringReaction( - listOf("deadchat", "dead chat", "dead server", "ded chat", "ichirudeadchat"), + listOf("deadchat", "dead chat", "dead server", "ded chat", "ichirudeadchat", "rip chat"), { randomDeadChat().replace("_", "\\_") }, - 80.0, + 90.0, true, { // check if the last message was 20+ minutes ago