NAFF
NAFF copied to clipboard
[BUG] bot.is_ready not reset during reconnect
NAFF Version
latest
Describe the Bug
When a session is, "Gateway has invalidated session! Reconnecting..."
bot.is_ready
is not set to false and will spam you with all the join things
Expected Results
What should happen during a reconnect is is_ready is set back to false and then true once it is connected
Minimal Reproducible Code
import naff
bot = naff.Client(sync_interactions=True, debug_scope=701347683591389185)
@naff.slash_command(name="trip_reconnect")
async def trip_reconnect(ctx):
await ctx.send("Session invalidated")
await bot.ws.dispatch_opcode(None, naff.WebSocketOPCodes.INVALIDATE_SESSION)
@naff.listen(naff.events.GuildJoin)
async def join(event: naff.events.GuildJoin):
if bot.is_ready:
print("This should not happen within the testing period")
bot.start("token")
Traceback
No response
Checklist
- [X] I have searched the open issues for duplicates.
- [X] I have shown the entire traceback, if possible.
- [X] I have removed my token from display, if visible.
Additional Information
I think that this is where is ready should be set back to false https://github.com/NAFTeam/NAFF/blob/13aeb1af865e6296137764701410f6daac7b64c9/naff/api/gateway/websocket.py#L239-L260