From c139c09b1a49a66fff7685e8fd9d3fd027e99665 Mon Sep 17 00:00:00 2001 From: RTAkland Date: Sun, 27 Oct 2024 18:42:30 +0800 Subject: [PATCH] fix: fix reaction target --- src/main/kotlin/cn/rtast/fancybot/FancyBot.kt | 6 +++++- .../cn/rtast/fancybot/commands/misc/ReactionCommand.kt | 7 ++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/main/kotlin/cn/rtast/fancybot/FancyBot.kt b/src/main/kotlin/cn/rtast/fancybot/FancyBot.kt index 529154c..f603c3e 100644 --- a/src/main/kotlin/cn/rtast/fancybot/FancyBot.kt +++ b/src/main/kotlin/cn/rtast/fancybot/FancyBot.kt @@ -123,8 +123,12 @@ class FancyBot : OneBotListener { .joinToString { it.data.text!! } if (command.contains("/倒放") || command.contains("/df")) ReverseGIFCommand.reverse(message, getMsg) if (command.contains("/图来") || command.contains("/图链")) ImageURLCommand.callback(message, getMsg) - if (command.contains("/reaction")) ReactionCommand.reaction(message) if (command.contains("/图床")) ImageBedCommand.execute(getMsg, message) + if (command.contains("/reaction")) ReactionCommand.reaction( + message.action, + message.groupId, + getMsg.messageId + ) if (command.contains("/sl") || command.contains("/short")) message.reply( plainTextContent.trim().makeShortLink() ) diff --git a/src/main/kotlin/cn/rtast/fancybot/commands/misc/ReactionCommand.kt b/src/main/kotlin/cn/rtast/fancybot/commands/misc/ReactionCommand.kt index e3ea9e8..92152cb 100644 --- a/src/main/kotlin/cn/rtast/fancybot/commands/misc/ReactionCommand.kt +++ b/src/main/kotlin/cn/rtast/fancybot/commands/misc/ReactionCommand.kt @@ -11,6 +11,7 @@ import cn.rtast.fancybot.annotations.CommandDescription import cn.rtast.rob.entity.GroupMessage import cn.rtast.rob.enums.QQFace import cn.rtast.rob.util.BaseCommand +import cn.rtast.rob.util.ob.OneBotAction import cn.rtast.rob.util.ob.OneBotListener @CommandDescription("让你的消息得到回应(reaction)!") @@ -18,11 +19,11 @@ class ReactionCommand : BaseCommand() { override val commandNames = listOf("reaction", "回应") companion object { - suspend fun reaction(message: GroupMessage, limit: Int = 30) { - (0..limit - 1).forEach { message.reaction(QQFace.entries.random()) } + suspend fun reaction(action: OneBotAction, groupId: Long, messageId: Long, limit: Int = 30) { + (0..limit - 1).forEach { action.reaction(groupId, messageId, QQFace.entries.random().id.toString()) } } } override suspend fun executeGroup(listener: OneBotListener, message: GroupMessage, args: List) = - reaction(message) + reaction(message.action, message.groupId, message.messageId) } \ No newline at end of file