feat: add caculate parse

This commit is contained in:
2024-09-21 14:12:08 +08:00
parent d75fbb9daf
commit 60b41ead3b
4 files changed
+31 -13

No files matched your search

+3 -13
View File
@@ -35,6 +35,7 @@ import cn.rtast.fancybot.commands.misc.UnsetZiBiCommand
import cn.rtast.fancybot.commands.misc.ZiBiCommand
import cn.rtast.fancybot.commands.parse.AsciiArtCommand
import cn.rtast.fancybot.commands.parse.BVParseCommand
import cn.rtast.fancybot.commands.parse.CalculateCommand
import cn.rtast.fancybot.commands.parse.GitHubParseCommand
import cn.rtast.fancybot.commands.parse.ImageURLCommand
import cn.rtast.fancybot.commands.parse.ReverseGIFCommand
@@ -85,9 +86,8 @@ class FancyBot : OneBotListener {
val messageId = message.messageId
println("$sender($senderId: $groupId >>> $messageId): $msg")
if (message.rawMessage.contains("1+1")) {
message.reply("1+1=2")
}
val calculateResult = CalculateCommand.parse(message.rawMessage)
calculateResult?.let { message.reply(calculateResult) }
coroutineScope.launch {
message.message.forEach {
@@ -190,16 +190,6 @@ class FancyBot : OneBotListener {
.build()
this.sendGroupMessage(groupId, msg)
}
override suspend fun onPrivateMessage(message: PrivateMessage, json: String) {
if (message.rawMessage.contains("1+1")) {
message.reply("1+1=2")
}
if (message.rawMessage == "ping") {
message.reply("pong")
}
}
}
val configManager = ConfigManager()