Skip to content

Commit

Permalink
feat: lgzbotcommand: check: support reply
Browse files Browse the repository at this point in the history
  • Loading branch information
guimc233 committed Feb 24, 2024
1 parent 62dc2b6 commit 5937b0d
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/main/kotlin/ltd/guimc/lgzbot/command/LGZBotCommand.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import ltd.guimc.lgzbot.counter.VLManager
import ltd.guimc.lgzbot.files.ModuleStateConfig
import ltd.guimc.lgzbot.listener.message.MessageFilter
import ltd.guimc.lgzbot.utils.LL4JUtils
import ltd.guimc.lgzbot.utils.MessageUtils.getPlainText
import ltd.guimc.lgzbot.utils.OverflowUtils
import ltd.guimc.lgzbot.word.WordUtils
import net.mamoe.mirai.console.command.CommandSender
Expand All @@ -25,6 +26,7 @@ import net.mamoe.mirai.contact.NormalMember
import net.mamoe.mirai.message.data.At
import net.mamoe.mirai.message.data.MessageChainBuilder
import net.mamoe.mirai.message.data.PlainText
import net.mamoe.mirai.message.data.QuoteReply
import top.mrxiaom.overflow.contact.Updatable
import kotlin.math.roundToInt
import kotlin.time.Duration
Expand Down Expand Up @@ -133,4 +135,14 @@ object LGZBotCommand : CompositeCommand(
LL4JUtils.learn(type, string)
sendMessage("Done.")
}

@SubCommand("check")
@Description("使用模型检测一段文本是否合规")
suspend fun CommandSender.iI1I1i1I1i1I(string: QuoteReply) {
if (LL4JUtils.predict(string.source.originalMessage.getPlainText())) {
sendMessage("不合规")
} else {
sendMessage("合规")
}
}
}

0 comments on commit 5937b0d

Please sign in to comment.