Bot never fully logs out on 3.x versions, shows up in channel for a while before disappearing #2377
-
I've noticed with even a simple bot, it appears to remain in the channel upon logging out on 3.x versions of the library, where this doesn't happen with the same code on 2.x versions. I'm wondering if others have experienced this. I've written three bots and encountered this each time. I can certainly supply a working example and submit this as a bug. This happens even if I do not use any events other than Log and Ready. Also, I do not call any Discord functions during a Ready event (which apparently hangs things up in 3.x). The bot remains logged in with its current status. private async Task RunAsync()
{
// log in
await discord.LoginAsync(TokenType.Bot, BotConfiguration.BotToken);
await discord.StartAsync();
// wait until ready
await Task.Run(() => readyEvent.WaitOne());
// set initial status
await discord.SetStatusAsync(UserStatus.Online);
// wait until interrupted
await Task.Run(() => interruptEvent.WaitOne());
// log out
await discord.StopAsync();
await discord.LogoutAsync(); // doesn't actually log out on 3.x, works fine on 2.x
} This sometimes it can get confusing for testing and it suggests that the client isn't logging out cleanly. Thanks! -Dave |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
It's got nothing to do with the bot, it's to do with discord caching |
Beta Was this translation helpful? Give feedback.
-
With the latest release v3.12.0, this got fixed (#2714). Now if a bot logs out it appears as offline immediately, noticed it in my own bot. |
Beta Was this translation helpful? Give feedback.
With the latest release v3.12.0, this got fixed (#2714). Now if a bot logs out it appears as offline immediately, noticed it in my own bot.