chore: chore: chore: chore: chore: chore: chore

This commit is contained in:
2024-09-27 15:22:24 +08:00
parent cc30d8e1c0
commit 9762d8d566
4 files changed
+37 -42

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
[versions]
kotlinVersion = "2.0.10"
ronebotVersion = "1.11.1"
ronebotVersion = "1.11.2"
shadowVersion = "8.3.0"
okhttpVersion = "5.0.0-alpha.14"
exposedVersion = "0.53.0"
@@ -7,12 +7,7 @@
package cn.rtast.fancybot
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
import cn.rtast.fancybot.commands.parse.*
import cn.rtast.fancybot.entity.bili.CardShare
import cn.rtast.fancybot.entity.enums.WSType
import cn.rtast.fancybot.util.initDatabase
@@ -55,6 +50,7 @@ class FancyBot : OneBotListener {
ReverseGIFCommand.callback(message)
AsciiArtCommand.callback(message)
if (message.message.any { it.type == ArrayMessageType.reply }) { // Image url parse
val command = message.message.reversed().find { it.type == ArrayMessageType.text }!!.data.text!!
val replyId = message.message.find { it.type == ArrayMessageType.reply }!!.data.id!!
@@ -87,7 +87,8 @@ class AsciiArtCommand : BaseCommand() {
}
suspend fun callback(message: GroupMessage) {
if (message.sender.userId in waitingList) {
if (message.sender.userId !in waitingList) return
waitingList.removeIf { it == message.sender.userId }
if (message.message.any { it.type == ArrayMessageType.image }
|| message.message.any { it.type == ArrayMessageType.mface }) {
val url = if (message.message.any { it.type == ArrayMessageType.image })
@@ -121,8 +122,6 @@ class AsciiArtCommand : BaseCommand() {
} else {
message.reply("回复错误已取消本次操作")
}
waitingList.removeIf { it == message.sender.userId }
}
}
}
@@ -36,6 +36,7 @@ class ReverseGIFCommand : BaseCommand() {
suspend fun callback(message: GroupMessage) {
if (message.sender.userId !in waitingList) return
waitingList.removeIf { it == message.sender.userId }
val gifUrl = if (message.message.find { it.type == ArrayMessageType.mface } == null) {
message.message.find { it.type == ArrayMessageType.image }!!.data.file!!
} else {
@@ -44,14 +45,13 @@ class ReverseGIFCommand : BaseCommand() {
val base64String = this.reverseGif(gifUrl)
val msg = MessageChain.Builder().addImage(base64String, true).build()
message.reply(msg)
waitingList.removeIf { it == message.sender.userId }
}
}
override suspend fun executeGroup(listener: OneBotListener, message: GroupMessage, args: List<String>) {
if (message.sender.userId !in waitingList) {
waitingList.add(message.sender.userId)
message.reply("发送一张动图来继续操作")
waitingList.add(message.sender.userId)
} else {
message.reply("发送错误本次操作已取消")
waitingList.removeIf { it == message.sender.userId }