You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
2023-08-07 01:XX:XX W/Bot.*****: An exception occurred when processing event. Subscriber scope: '<unnamed>'. Broadcaster scope: 'Bot *****.EventDispatcher'
java.lang.UnsupportedOperationException: nudge is supported only with protocol ANDROID_PHONE or IPAD
at net.mamoe.mirai.internal.MiraiImpl.sendNudge$suspendImpl(MiraiImpl.kt:648)
at net.mamoe.mirai.internal.MiraiImpl.sendNudge(MiraiImpl.kt)
at net.mamoe.mirai.message.action.Nudge.sendTo(Nudge.kt:55)
at net.mamoe.mirai.message.action.Nudge$sendTo$2.invoke(Nudge.kt)
at net.mamoe.mirai.message.action.Nudge$sendTo$2.invoke(Nudge.kt)
尝试解决
我将以上代码改为了如下:
override suspend fun sendNudge(bot: Bot, nudge: Nudge, receiver: Contact): Boolean {
println(bot.configuration.protocol)
if ((bot.configuration.protocol != BotConfiguration.MiraiProtocol.ANDROID_PHONE)
&& (bot.configuration.protocol != BotConfiguration.MiraiProtocol.IPAD)
&& (bot.configuration.protocol != BotConfiguration.MiraiProtocol.ANDROID_PAD))
{
throw UnsupportedOperationException("nudge is supported only with protocol ANDROID_PHONE or IPAD")
}
bot.asQQAndroidBot()
问题描述
ANDROID_PAD协议是可以发出戳一戳信息的
问题来源
当Bot尝试在ANDROID_PAD协议下戳一戳时
mirai/mirai-core/src/commonMain/kotlin/MiraiImpl.kt
Lines 646 to 651 in fca4a3c
这一行代码阻止了非Ipad和手机QQ的戳一戳信息,但实际上8.9版本后的安卓平板QQ和安卓手机QQ其实并无什么差异(目前Mirai内置的ANDROID_PAD协议版本号为8.9.58,本人测试环境目前使用fix-protocol-version的ANDROID_PAD 8.9.63 协议),安卓平板上也能够正常使用戳一戳
于是客户端就会报错:
尝试解决
我将以上代码改为了如下:
此时Bot是可以正常发出戳一戳信息的
因此我认为在Mirai中,ANDROID_PAD也应该支持戳一戳信息
复现
mirai-core 版本
2.15.0
bot-protocol
ANDROID_PAD
其他组件版本
mirai-console:
2.15.0
fix-protocol-version:
1.9.10
PetPet:
5.4
系统日志
No response
网络日志
No response
补充信息
No response
The text was updated successfully, but these errors were encountered: