已解决 Groups获取失败
-
mirai版本 2.7.0
使用了如下代码获取群列表
public static ContactList<Group> getAllQQGroups() { return MinecraftPing.getCurrentBot().getGroups(); }
控制台报错
java.lang.NullPointerException at com.ycitus.framework.BotManager.getAllQQGroups(BotManager.java:13) at com.ycitus.MinecraftPing.onEnable(MinecraftPing.java:68) at net.mamoe.mirai.console.internal.plugin.JvmPluginInternal.internalOnEnable$mirai_console(JvmPluginInternal.kt:113) at net.mamoe.mirai.console.internal.plugin.BuiltInJvmPluginLoaderImpl.enable(BuiltInJvmPluginLoaderImpl.kt:122) at net.mamoe.mirai.console.plugin.jvm.JvmPluginLoader$BuiltIn.enable(JvmPluginLoader.kt) at net.mamoe.mirai.console.plugin.jvm.JvmPluginLoader$BuiltIn.enable(JvmPluginLoader.kt:36) at net.mamoe.mirai.console.plugin.PluginManager.enablePlugin(PluginManager.kt:129) at net.mamoe.mirai.console.internal.plugin.PluginManagerImpl.enableAllLoadedPlugins$mirai_console(PluginManagerImpl.kt:172) at net.mamoe.mirai.console.internal.MiraiConsoleImplementationBridge.doStart$mirai_console(MiraiConsoleImplementationBridge.kt:208) at net.mamoe.mirai.console.MiraiConsoleImplementation$Companion.start(MiraiConsoleImplementation.kt:276) at net.mamoe.mirai.console.terminal.MiraiConsoleTerminalLoader.startAsDaemon(MiraiConsoleTerminalLoader.kt:152) at net.mamoe.mirai.console.terminal.MiraiConsoleTerminalLoader.startAsDaemon$default(MiraiConsoleTerminalLoader.kt:151) at net.mamoe.mirai.console.terminal.MiraiConsoleTerminalLoader.main(MiraiConsoleTerminalLoader.kt:47)
机器人是加了群的
有没有大佬知道是为什么
-
MinecraftPing.getCurrentBot returning null
-
@karlatemp 哦哦,那应该是我初始化出问题了,谢谢大佬