chore: remove sensitive word filter

This commit is contained in:
2024-11-07 18:34:59 +08:00
parent 42c215420a
commit 760aeeca82
2 files changed
-24

No files matched your search

@@ -75,10 +75,6 @@ class FancyBot : OneBotListener {
logger.info("$sender($senderId: $groupId >>> $messageId): $msg") logger.info("$sender($senderId: $groupId >>> $messageId): $msg")
logger.trace("$sender($senderId: $groupId >>> $messageId: $json") logger.trace("$sender($senderId: $groupId >>> $messageId: $json")
if (SensitiveWord.containsSensitiveWords(message.text)) {
message.reply("你似乎说了一个不能说的词(?)")
}
if (message.message.any { it.type == ArrayMessageType.face && it.data.id.toString() == "419" }) { if (message.message.any { it.type == ArrayMessageType.face && it.data.id.toString() == "419" }) {
message.reply("你发牛魔的火车呢, 我直接就是打断") message.reply("你发牛魔的火车呢, 我直接就是打断")
} }
@@ -281,5 +277,4 @@ suspend fun main() {
initSetuIndex() initSetuIndex()
initItems() initItems()
initBackgroundTasks(instance) initBackgroundTasks(instance)
} }
@@ -1,19 +0,0 @@
/*
* Copyright © 2024 RTAkland
* Author: RTAkland
* Date: 2024/11/7
*/
package cn.rtast.fancybot.util
import cn.rtast.fancybot.util.str.proxy
object SensitiveWord {
private val SENSITIVE_WORD_URL =
"https://raw.githubusercontent.com/cjh0613/tencent-sensitive-words/refs/heads/main/sensitive_words.txt".proxy
private const val SEPARATOR = ""
private val sensitiveWords = Http.get(SENSITIVE_WORD_URL).split(SEPARATOR)
fun containsSensitiveWords(input: String): Boolean = sensitiveWords.contains(input)
}