feat: add reaction other's message command

This commit is contained in:
2024-10-11 19:28:22 +08:00
parent 1b1a579f23
commit 5ac05f052a
2 files changed
+10 -4

No files matched your search

@@ -7,6 +7,7 @@
package cn.rtast.fancybot package cn.rtast.fancybot
import cn.rtast.fancybot.commands.misc.ReactionCommand
import cn.rtast.fancybot.commands.misc.ScanQRCodeCommand import cn.rtast.fancybot.commands.misc.ScanQRCodeCommand
import cn.rtast.fancybot.commands.misc.ShortLinkCommand.Companion.makeShortLink import cn.rtast.fancybot.commands.misc.ShortLinkCommand.Companion.makeShortLink
import cn.rtast.fancybot.commands.parse.* import cn.rtast.fancybot.commands.parse.*
@@ -81,7 +82,7 @@ class FancyBot : OneBotListener {
val getMsg = this.getMessage(replyId.toString().toLong()) val getMsg = this.getMessage(replyId.toString().toLong())
ImageURLCommand.callback(message, getMsg) ImageURLCommand.callback(message, getMsg)
} }
if (command.contains("reaction")) ReactionCommand.reaction(message)
if (command.contains("图床")) { if (command.contains("图床")) {
val getMsg = this.getMessage(replyId.toString().toLong()) val getMsg = this.getMessage(replyId.toString().toLong())
val imagesUrl = ImageURLCommand.getImageUrl(getMsg) val imagesUrl = ImageURLCommand.getImageUrl(getMsg)
@@ -17,9 +17,14 @@ import cn.rtast.rob.util.ob.OneBotListener
class ReactionCommand : BaseCommand() { class ReactionCommand : BaseCommand() {
override val commandNames = listOf("reaction", "回应") override val commandNames = listOf("reaction", "回应")
override suspend fun executeGroup(listener: OneBotListener, message: GroupMessage, args: List<String>) { companion object {
(0..29).forEach { _ -> suspend fun reaction(message: GroupMessage, limit: Int = 30) {
message.reaction(QQFace.entries.random()) (0..limit - 1).forEach { _ ->
message.reaction(QQFace.entries.random())
}
} }
} }
override suspend fun executeGroup(listener: OneBotListener, message: GroupMessage, args: List<String>) =
reaction(message)
} }