如何获取一个陌生人的QQ等级?
-
如何通过QQ号获取一个陌生人(对方从未发过消息)的QQ等级?
我想通过此方法来判断申请进群的人等级是否大于指定值,避免小号。
我尝试使用此方法:getCurrentBot().getStranger(event.getFromId()).queryProfile().getQLevel()
但是会报错:
2021-08-17 16:02:25 E/main: Exception in coroutine <unnamed> java.lang.NullPointerException: Cannot invoke "net.mamoe.mirai.contact.Stranger.queryProfile()" because the return value of "net.mamoe.mirai.Bot.getStranger(long)" is null at com.jiajiaxd.EventHandler.lambda$new$3(EventHandler.java:241) at net.mamoe.mirai.event.EventChannel$subscribeAlways$2$1.invoke(EventChannel.kt:511) at net.mamoe.mirai.event.EventChannel$subscribeAlways$2$1.invoke(EventChannel.kt:60) at kotlinx.coroutines.InterruptibleKt.runInterruptibleInExpectedContext(Interruptible.kt:46) at kotlinx.coroutines.InterruptibleKt.access$runInterruptibleInExpectedContext(Interruptible.kt:1) at kotlinx.coroutines.InterruptibleKt$runInterruptible$2.invokeSuspend(Interruptible.kt:38) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
-
已经解决
https://github.com/mamoe/mirai/issues/1483
// Java
Mirai.getInstance().queryProfile// Kotlin
Mirai.queryProfile