Kaaz / DiscordBot

A Java Discord bot using JDA
Apache License 2.0
130 stars 53 forks source link

Error on launching #7

Closed yukukotani closed 7 years ago

yukukotani commented 7 years ago

An error is occurred when launching. I think GuildSettings.settings is empty. GuildSettings.id is 0 and guilds table is also empty.

`[05:04:26] [Fatal] [JDA]: One of the EventListeners had an uncaught exception [05:04:26] [Fatal] [JDA]: Encountered an exception:

at discordbot.role.RoleRankings.fixRoles(RoleRankings.java:172)
at discordbot.main.DiscordBot.markReady(DiscordBot.java:190)
at discordbot.event.JDAEvents.onReady(JDAEvents.java:128)
at net.dv8tion.jda.hooks.ListenerAdapter.onEvent(ListenerAdapter.java:151)
at net.dv8tion.jda.hooks.InterfacedEventManager.handle(InterfacedEventManager.java:64)
at net.dv8tion.jda.requests.WebSocketClient.ready(WebSocketClient.java:121)
at net.dv8tion.jda.handle.ReadyHandler.finishReady(ReadyHandler.java:146)
at net.dv8tion.jda.handle.ReadyHandler.onGuildInit(ReadyHandler.java:123)
at net.dv8tion.jda.handle.GuildJoinHandler.lambda$handleInternally$51(GuildJoinHandler.java:44)
at net.dv8tion.jda.handle.EntityBuilder.createGuildFirstPass(EntityBuilder.java:250)
at net.dv8tion.jda.handle.GuildJoinHandler.handleInternally(GuildJoinHandler.java:38)
at net.dv8tion.jda.handle.SocketHandler.handle(SocketHandler.java:38)
at net.dv8tion.jda.requests.WebSocketClient.handleEvent(WebSocketClient.java:629)
at net.dv8tion.jda.requests.WebSocketClient.onTextMessage(WebSocketClient.java:324)
at net.dv8tion.jda.requests.WebSocketClient.onBinaryMessage(WebSocketClient.java:705)
at com.neovisionaries.ws.client.ListenerManager.callOnBinaryMessage(ListenerManager.java:368)
at com.neovisionaries.ws.client.ReadingThread.callOnBinaryMessage(ReadingThread.java:243)
at com.neovisionaries.ws.client.ReadingThread.handleBinaryFrame(ReadingThread.java:937)
at com.neovisionaries.ws.client.ReadingThread.handleFrame(ReadingThread.java:696)
at com.neovisionaries.ws.client.ReadingThread.main(ReadingThread.java:102)
at com.neovisionaries.ws.client.ReadingThread.run(ReadingThread.java:61)`
yukukotani commented 7 years ago

Sorry, i added some debug code. discordbot.role.RoleRankings.fixRoles(RoleRankings.java:172) -> discordbot.role.RoleRankings.fixRoles(RoleRankings.java:170)

Kaaz commented 7 years ago

I'm trying to reproduce it, started with empty database + new bot with no guilds added 1 guild but I don't get that error. Do you have the latest version? And how did you get the error?

edit: nevermind I got it!

Kaaz commented 7 years ago

Can you try again with eee9ac56aecba1100c42f09afcf23cc86ad7408a (or later) I think the issue was if a the bot joined a guild when the bot was offline, the bot didn't get the GuildJoinEvent which registered the guild, now it checks in GuildSettings if the guild exists too.