feat: support translate image to zdjd
This commit is contained in:
1 file changed
+6
-2
@@ -11,8 +11,10 @@ import cn.rtast.fancybot.annotations.CommandDescription
|
||||
import cn.rtast.fancybot.util.str.decodeToString
|
||||
import cn.rtast.fancybot.util.str.encodeToBase64
|
||||
import cn.rtast.rob.entity.GroupMessage
|
||||
import cn.rtast.rob.enums.ArrayMessageType
|
||||
import cn.rtast.rob.util.BaseCommand
|
||||
import cn.rtast.rob.util.ob.OneBotListener
|
||||
import java.net.URI
|
||||
|
||||
@CommandDescription("将人类的语言翻译成尊嘟假嘟语还能将尊嘟假嘟语翻译成人类的语言!")
|
||||
class ZDJDCommand : BaseCommand() {
|
||||
@@ -72,13 +74,15 @@ class ZDJDCommand : BaseCommand() {
|
||||
return try {
|
||||
zdjd2human(this)
|
||||
true
|
||||
} catch (e: Exception) {
|
||||
} catch (_: Exception) {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun executeGroup(listener: OneBotListener, message: GroupMessage, args: List<String>) {
|
||||
val text = args.joinToString(" ")
|
||||
val text = if (message.message.any { it.type == ArrayMessageType.image }) {
|
||||
message.message.find { it.type == ArrayMessageType.image }!!.data.file!!
|
||||
} else args.joinToString(" ")
|
||||
if (text.isZdjd()) {
|
||||
message.reply(zdjd2human(text))
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user