project-mirai / mirai-demos Goto Github PK
View Code? Open in Web Editor NEWmirai-console的一些插件与教学
License: GNU Affero General Public License v3.0
mirai-console的一些插件与教学
License: GNU Affero General Public License v3.0
我执行了项目中BlockingTest.java那个文件,发生了一下异常
2020-07-18 09:35:16 E/Bot 498861397: An exception was thrown under a coroutine of Bot
java.lang.IllegalArgumentException: argument type mismatch
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at net.mamoe.mirai.event.Events__JvmMethodListenersKt$registerEvent$15$1.invokeSuspend(JvmMethodListeners.kt:368)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:56)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:738)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
mirai-core-1.1.3
之前使用一切正常
最近开始无法发送图片,可以发送文字
发送图片时报错如下
2020-12-13 15:20:07 V/Net 3532477954: Send: ImgStore.GroupPicUp
2020-12-13 15:20:07 V/Net 3532477954: Recv: RequireUpload(fileId=2850419775, uKey=[-15, 19, -41, 43, -125, 72, -11, -95, 28, 107, 83, 122, 60, 82, 105, -101, 104, -93, -45, -122, -70, 96, -102, -5, -37, 109, 70, -89, -58, 20, 7, 74, 111, 79, 23, -115, 56, -128, 8, 22, -116, -57, 17, -50, 47, 91, -83, 32, -42, -21, -124, -81, 99, 44, 83, -33, 14, -43, 101, 103, 124, -103, -61, 75, 111, -70, 43, 53, 1, -41, -119, -93, 109, 96, -96, -8, 48, -99, 120, -123, 16, -40, 62, 25, 94, 119, 40, 127, 1, 25, -81, 73, 26, -116, 123, -82, 14, -73, 117, -86, 92, -28, 48, 121, -23, -39, 28, -114, -54, -55, -108, 41, 46, 5, 94, 69, -70, 89, -34, -104, -97, -29, -93, 104, -73, -95, 120, -120])
2020-12-13 15:20:07 V/Net 3532477954: [Highway] Uploading group image to 120.241.186.254:443, size=242 B
2020-12-13 15:20:08 V/Net 3532477954: [Highway] Uploading group image to 113.96.232.87:8080, size=242 B
2020-12-13 15:20:08 V/Net 3532477954: [Highway] Uploading group image to 123.150.76.168:80, size=242 B
2020-12-13 15:20:08 V/Net 3532477954: [Highway] Uploading group image to 157.255.243.94:443, size=242 B
java.lang.IllegalStateException: cannot upload group image, failed on all servers.
at net.mamoe.mirai.qqandroid.network.highway.HighwayHelper.uploadImageToServers(HighwayHelper.kt:114)
at net.mamoe.mirai.qqandroid.network.highway.HighwayHelper$uploadImageToServers$2.invokeSuspend(HighwayHelper.kt)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.internal.ScopeCoroutine.afterResume(Scopes.kt:32)
at kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.kt:113)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
at kotlinx.coroutines.flow.internal.SafeCollector.invokeSuspend(SafeCollector.kt:37)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:56)
at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:274)
at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:84)
at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59)
at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source)
at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:38)
at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source)
at net.mamoe.mirai.contact.ContactJavaFriendlyAPI$DefaultImpls.uploadImage(ContactJavaFriendlyAPI.kt:379)
at net.mamoe.mirai.contact.Contact.uploadImage(Contact.kt:38)
at demo.BlockingTest$2.onGroupMessage(BlockingTest.java:309)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at net.mamoe.mirai.event.internal.EventInternalJvmKt$registerEvent$15$1.invokeSuspend(EventInternalJvm.kt:182)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:56)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:738)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
Caused by: java.lang.IllegalStateException: highway transfer failed, error 82
at net.mamoe.mirai.qqandroid.network.highway.HighwayHelper$uploadImage$$inlined$use$lambda$1.emit(Collect.kt:149)
at net.mamoe.mirai.qqandroid.network.highway.HighwayHelper$uploadImage$$inlined$use$lambda$1$1.invokeSuspend(Unknown Source)
... 22 more
2020-12-13 15:20:08 E/Bot 3532477954: An exception was thrown under a coroutine of Bot
java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at net.mamoe.mirai.event.internal.EventInternalJvmKt$registerEvent$15$1.invokeSuspend(EventInternalJvm.kt:182)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:56)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:738)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
Caused by: java.lang.NullPointerException: Parameter specified as non-null is null: method net.mamoe.mirai.contact.Contact.sendMessage, parameter message
at net.mamoe.mirai.contact.Contact.sendMessage(Contact.kt)
at demo.BlockingTest$2.onGroupMessage(BlockingTest.java:315)
... 11 more
请问是怎么回事,如何解决呢?
如果要在除 demo 给出的 BlockTesting 类以外的另一个类里也监听并执行一些操作,应该如何实现。?(Java)
W/System.err: java.lang.IllegalStateException: returnCode = -10008
at net.mamoe.mirai.qqandroid.network.protocol.packet.KnownPacketFactories.parseSsoFrame(PacketFactory.kt:308)
at net.mamoe.mirai.qqandroid.network.protocol.packet.KnownPacketFactories.parseIncomingPacket(PacketFactory.kt:215)
at net.mamoe.mirai.qqandroid.network.QQAndroidBotNetworkHandler.generifiedParsePacket(QQAndroidBotNetworkHandler.kt:434)
at net.mamoe.mirai.qqandroid.network.QQAndroidBotNetworkHandler.parsePacket(QQAndroidBotNetworkHandler.kt:429)
at net.mamoe.mirai.qqandroid.network.QQAndroidBotNetworkHandler$parsePacketAsync$1.invokeSuspend(QQAndroidBotNetworkHandler.kt:414)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:56)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:738)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
I/art: Background sticky concurrent mark sweep GC freed 339800(11MB) AllocSpace objects, 0(0B) LOS objects, 30% free, 18MB/27MB, paused 1.933ms total 132.511ms
W/System.err: java.lang.IllegalStateException: returnCode = -10008
at net.mamoe.mirai.qqandroid.network.protocol.packet.KnownPacketFactories.parseSsoFrame(PacketFactory.kt:308)
at net.mamoe.mirai.qqandroid.network.protocol.packet.KnownPacketFactories.parseIncomingPacket(PacketFactory.kt:215)
at net.mamoe.mirai.qqandroid.network.QQAndroidBotNetworkHandler.generifiedParsePacket(QQAndroidBotNetworkHandler.kt:434)
at net.mamoe.mirai.qqandroid.network.QQAndroidBotNetworkHandler.parsePacket(QQAndroidBotNetworkHandler.kt:429)
at net.mamoe.mirai.qqandroid.network.QQAndroidBotNetworkHandler$parsePacketAsync$1.invokeSuspend(QQAndroidBotNetworkHandler.kt:414)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:56)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:738)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
W/System.err: java.lang.IllegalStateException: returnCode = -10008
at net.mamoe.mirai.qqandroid.network.protocol.packet.KnownPacketFactories.parseSsoFrame(PacketFactory.kt:308)
W/System.err: at net.mamoe.mirai.qqandroid.network.protocol.packet.KnownPacketFactories.parseIncomingPacket(PacketFactory.kt:215)
at net.mamoe.mirai.qqandroid.network.QQAndroidBotNetworkHandler.generifiedParsePacket(QQAndroidBotNetworkHandler.kt:434)
at net.mamoe.mirai.qqandroid.network.QQAndroidBotNetworkHandler.parsePacket(QQAndroidBotNetworkHandler.kt:429)
at net.mamoe.mirai.qqandroid.network.QQAndroidBotNetworkHandler$parsePacketAsync$1.invokeSuspend(QQAndroidBotNetworkHandler.kt:414)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:56)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:738)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
W/System.err: java.lang.IllegalStateException: returnCode = -10008
W/System.err: at net.mamoe.mirai.qqandroid.network.protocol.packet.KnownPacketFactories.parseSsoFrame(PacketFactory.kt:308)
at net.mamoe.mirai.qqandroid.network.protocol.packet.KnownPacketFactories.parseIncomingPacket(PacketFactory.kt:215)
at net.mamoe.mirai.qqandroid.network.QQAndroidBotNetworkHandler.generifiedParsePacket(QQAndroidBotNetworkHandler.kt:434)
at net.mamoe.mirai.qqandroid.network.QQAndroidBotNetworkHandler.parsePacket(QQAndroidBotNetworkHandler.kt:429)
at net.mamoe.mirai.qqandroid.network.QQAndroidBotNetworkHandler$parsePacketAsync$1.invokeSuspend(QQAndroidBotNetworkHandler.kt:414)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:56)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:738)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
I/System.out: �[91mBot(778162278) 21:01:41 : Init failed. Retrying in 3s...
I/System.out: �[0mNetwork(778162278) 21:01:41 : Packet: WtLogin.Login.LoginPacketResponse.DeviceLockLogin
I/System.out: �[0mNetwork(778162278) 21:01:41 : Send done: wtlogin.login
I/System.out: �[0mNetwork(778162278) 21:01:42 : Packet: LoginPacketResponse.Success
I/System.out: �[92mNetwork(778162278) 21:01:42 : Login successful
I/System.out: �[0mNetwork(778162278) 21:01:42 : Send done: StatSvc.register
I/System.out: �[0mNetwork(778162278) 21:01:42 : Packet: Response(StatSvc.register)
I/System.out: �[92mBot(778162278) 21:01:42 : Reconnected successfully
I/System.out: �[92mNetwork(778162278) 21:01:44 : 开始加载好友信息
I/System.out: �[92mNetwork(778162278) 21:01:44 : 开始加载群组列表与群成员列表
W/System.err: java.lang.IllegalStateException: bot is dead therefore can't send any packet
at net.mamoe.mirai.qqandroid.network.QQAndroidBotNetworkHandler.sendAndExpect(QQAndroidBotNetworkHandler.kt:596)
at net.mamoe.mirai.qqandroid.network.QQAndroidBotNetworkHandler.sendAndExpect$default(QQAndroidBotNetworkHandler.kt:592)
at net.mamoe.mirai.qqandroid.network.QQAndroidBotNetworkHandler.reloadGroupList(QQAndroidBotNetworkHandler.kt:280)
at net.mamoe.mirai.qqandroid.network.QQAndroidBotNetworkHandler$init$2$4$2.invokeSuspend(QQAndroidBotNetworkHandler.kt:311)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:56)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:738)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
W/System.err: Suppressed: java.lang.IllegalStateException: bot is dead therefore can't send any packet
at net.mamoe.mirai.qqandroid.network.QQAndroidBotNetworkHandler.sendAndExpect(QQAndroidBotNetworkHandler.kt:596)
at net.mamoe.mirai.qqandroid.network.QQAndroidBotNetworkHandler.reloadFriendList(QQAndroidBotNetworkHandler.kt:217)
at net.mamoe.mirai.qqandroid.network.QQAndroidBotNetworkHandler$init$2$4$1.invokeSuspend(QQAndroidBotNetworkHandler.kt:310)
... 6 more
I/System.out: �[31mBot(778162278) 21:01:44 : Cannot init. some features may be affected
�[92mBot(778162278) 21:01:44 : Login successful
W/System.err: java.lang.Exception: Toast callstack! strTip=登录成功
W/System.err: at android.widget.Toast.show(Toast.java:130)
at net.mamoe.mirai.demo.MainActivity$onSuccess$2.invokeSuspend(MainActivity.kt:55)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:56)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6121)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:892)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:782)
D/EGL_adreno: eglMakeCurrent: 0xacc051e0: ver 3 1 (tinfo 0xacc031f0)
D/EGL_adreno: eglMakeCurrent: 0xacc051e0: ver 3 1 (tinfo 0xacc031f0)
E/EGL_adreno: tid 3217: eglSurfaceAttrib(1323): error 0x3009 (EGL_BAD_MATCH)
W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0x954958c0, error=EGL_BAD_MATCH
D/EGL_adreno: eglMakeCurrent: 0xacc051e0: ver 3 1 (tinfo 0xacc031f0)
D/EGL_adreno: eglMakeCurrent: 0xacc051e0: ver 3 1 (tinfo 0xacc031f0)
W/IInputConnectionWrapper: finishComposingText on inactive InputConnection
demo源码
package net.mamoe.mirai.simpleloader
import kotlinx.coroutines.*
import net.mamoe.mirai.Bot
import net.mamoe.mirai.alsoLogin
import net.mamoe.mirai.event.subscribeMessages
suspend fun main() {
val qqId = XXXXXXL//Bot的QQ号,需为Long类型,在结尾处添加大写L
val password = "XXX"//Bot的密码
val miraiBot = Bot(qqId, password).alsoLogin()//新建Bot并登录
miraiBot.subscribeMessages {
"你好" reply "你好!"
case("at me") {
reply(sender.at() + " 给爷爬 ")
}
(contains("test") or contains("刘老板")) {
"刘老板太强了".reply()
}
}
miraiBot.join() // 等待 Bot 离线, 避免主线程退出
}
能够正常登录,但是在接收群信息时,会出现下面的错误。同时无法根据demo里面的内容进行自动回复。日志如下:
Bot(358601743) 19:25:25 : Received: GroupMessage(group=XXXX, senderName=XXX, sender=XXX, permission=OWNER, message=tt)
Bot(358601743) 19:25:25 : An exception was thrown under a coroutine of Bot
Bot(358601743) 19:25:25 : An exception was thrown under a coroutine of Bot
Bot(358601743) 19:25:25 : An exception was thrown under a coroutine of Bot
java.lang.IllegalStateException: WeakRef is released
at net.mamoe.mirai.utils.UnsafeWeakRef.get-impl(WeakRef.kt:22)
at net.mamoe.mirai.utils.WeakRefKt.getValue-oCG-Uto(WeakRef.kt:33)
at net.mamoe.mirai.qqandroid.MemberImpl.getQq(ContactImpl.kt)
at net.mamoe.mirai.qqandroid.MemberImpl.getBot(ContactImpl.kt:264)
at net.mamoe.mirai.qqandroid.MemberImpl.getBot(ContactImpl.kt:183)
at net.mamoe.mirai.message.GroupMessage.getBot(GroupMessage.kt:38)
at net.mamoe.mirai.simpleloader.IndexKt$main$$inlined$subscribeMessages$1$2.invokeSuspend(subscriber.kt:212)
at net.mamoe.mirai.simpleloader.IndexKt$main$$inlined$subscribeMessages$1$2.invoke(subscriber.kt)
at net.mamoe.mirai.event.internal.Handler$onEvent$2.invokeSuspend(InternalEventListeners.kt:59)
at net.mamoe.mirai.event.internal.Handler$onEvent$2.invoke(InternalEventListeners.kt)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:91)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.withContext(Builders.common.kt:154)
at kotlinx.coroutines.BuildersKt.withContext(Unknown Source)
at net.mamoe.mirai.event.internal.Handler.onEvent(InternalEventListeners.kt:59)
at net.mamoe.mirai.event.internal.InternalEventListenersKt$callAndRemoveIfRequired$$inlined$forEachNode$lambda$1.invokeSuspend(InternalEventListeners.kt:165)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:56)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:561)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:727)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:667)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:655)
java.lang.IllegalStateException: WeakRef is released
at net.mamoe.mirai.utils.UnsafeWeakRef.get-impl(WeakRef.kt:22)
at net.mamoe.mirai.utils.WeakRefKt.getValue-oCG-Uto(WeakRef.kt:33)
at net.mamoe.mirai.qqandroid.MemberImpl.getQq(ContactImpl.kt)
at net.mamoe.mirai.qqandroid.MemberImpl.getBot(ContactImpl.kt:264)
at net.mamoe.mirai.qqandroid.MemberImpl.getBot(ContactImpl.kt:183)
at net.mamoe.mirai.message.GroupMessage.getBot(GroupMessage.kt:38)
at net.mamoe.mirai.simpleloader.IndexKt$main$$inlined$subscribeMessages$1$2.invokeSuspend(subscriber.kt:212)
at net.mamoe.mirai.simpleloader.IndexKt$main$$inlined$subscribeMessages$1$2.invoke(subscriber.kt)
at net.mamoe.mirai.event.internal.Handler$onEvent$2.invokeSuspend(InternalEventListeners.kt:59)
at net.mamoe.mirai.event.internal.Handler$onEvent$2.invoke(InternalEventListeners.kt)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:91)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.withContext(Builders.common.kt:154)
at kotlinx.coroutines.BuildersKt.withContext(Unknown Source)
at net.mamoe.mirai.event.internal.Handler.onEvent(InternalEventListeners.kt:59)
at net.mamoe.mirai.event.internal.InternalEventListenersKt$callAndRemoveIfRequired$$inlined$forEachNode$lambda$1.invokeSuspend(InternalEventListeners.kt:165)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:56)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:561)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:727)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:667)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:655)
java.lang.IllegalStateException: WeakRef is released
at net.mamoe.mirai.utils.UnsafeWeakRef.get-impl(WeakRef.kt:22)
at net.mamoe.mirai.utils.WeakRefKt.getValue-oCG-Uto(WeakRef.kt:33)
at net.mamoe.mirai.qqandroid.MemberImpl.getQq(ContactImpl.kt)
at net.mamoe.mirai.qqandroid.MemberImpl.getBot(ContactImpl.kt:264)
at net.mamoe.mirai.qqandroid.MemberImpl.getBot(ContactImpl.kt:183)
at net.mamoe.mirai.message.GroupMessage.getBot(GroupMessage.kt:38)
at net.mamoe.mirai.simpleloader.IndexKt$main$$inlined$subscribeMessages$1$2.invokeSuspend(subscriber.kt:212)
at net.mamoe.mirai.simpleloader.IndexKt$main$$inlined$subscribeMessages$1$2.invoke(subscriber.kt)
at net.mamoe.mirai.event.internal.Handler$onEvent$2.invokeSuspend(InternalEventListeners.kt:59)
at net.mamoe.mirai.event.internal.Handler$onEvent$2.invoke(InternalEventListeners.kt)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:91)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.withContext(Builders.common.kt:154)
at kotlinx.coroutines.BuildersKt.withContext(Unknown Source)
at net.mamoe.mirai.event.internal.Handler.onEvent(InternalEventListeners.kt:59)
at net.mamoe.mirai.event.internal.InternalEventListenersKt$callAndRemoveIfRequired$$inlined$forEachNode$lambda$1.invokeSuspend(InternalEventListeners.kt:165)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:56)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:561)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:727)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:667)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:655)
小白刚刚开始使用mirai框架,请问如何向群内发送本地图片呢?
如果可以的话,请问如何可以 随机 发送位于同一文件夹中的图片呢?
登陆后接收不到消息 log出这个 unknown PbGetMsg type 732
请问 JAVA 如何撤回一条群员消息?
使用 bot.recall(event.getMessage)
和 bot.recall(event.getSource)
都会报错
报错内容:No message meets the requirements
请更新一下安卓端,现在登陆后输入验证码就不进行了 一直卡在验证码这里也不进入一直换验证码 是协议的问题吧
我测试了那个Demo的代码,已经成功地登录了,也可以发送消息,到时我发现并不能监听到收到消息的事件
bot.login();
bot.getFriends().forEach(friend -> System.out.println(friend.getId() + ":" + friend.getNick()));
Events.registerEvents(bot, new SimpleListenerHost() {
@eventhandler
public ListeningStatus onGroupMessage(GroupMessageEvent event) {
System.out.println("你收到了新的群消息!");
return ListeningStatus.LISTENING;
}
@OverRide
public void handleException(@NotNull CoroutineContext context, @NotNull Throwable exception) {
throw new RuntimeException("在事件处理中发生异常", exception);
}
});
这个是代码
android项目用多少版本的sdk呢
或者是只能用IDEA跑这个demo吗?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.