Skip to content

Commit

Permalink
Fix some io responses
Browse files Browse the repository at this point in the history
  • Loading branch information
duncte123 committed Nov 25, 2024
1 parent 3d1d00a commit e68a2d6
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/main/kotlin/me/duncte123/io/hirobs/ReactionHandler.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ class ReactionHandler {
private val limit = Bandwidth.simple(1, Duration.ofSeconds(300))
private val buckets = mutableMapOf<String, Bucket>()

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(
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit e68a2d6

Please sign in to comment.