nyxx-discord / nyxx

Wrapper around Discord API for Dart
Apache License 2.0
326 stars 49 forks source link

Hang Status is not handled #661

Closed dmbaranov closed 4 months ago

dmbaranov commented 4 months ago

Describe the bug Discord rolled out new feature called Hang Status for some users. Unfortunately, I wasn't able to find official docs for it, but there are a lot of articles in Google about it.

Apparently, this new status is not handled by ActivityType and whenever someone sets it, an exception is thrown. Now here comes another problem. After trying many different options to catch this exception, none of them actually worked (I tried adding onError callbacks, handleError calls, try/catch in different places, runZoneGuarded, etc., all this with and without ignoreExceptions plugin). Eventually, once this error occurs, bot stops listening to other commands and the only way to fix it is to restart the bot.

To Reproduce Steps to reproduce the behavior:

Expected behavior Library correctly handles Hang status for the users.

Desktop (please complete the following information):

abitofevrything commented 4 months ago

Thanks for reporting this! This is an issue we are aware of and will be fixed in the next version, but this gives us a nice reminder to fix it.

For now, you can use a patched version of nyxx with support for hang status by adding this to your pubspec.yaml:

dependency_overrides:
  nyxx:
    git:
      url: https://github.com/abitofevrything/nyxx.git
      ref: patch/hang-status
dmbaranov commented 4 months ago

Works like a charm, thanks a lot for quick reply and awesome library! :)

I'll leave it to you to decide whether to close this issue now (since there's a solution to the problem) or you'll do it when this fix is released.

Rapougnac commented 4 months ago

We'll leave it open to keep track of it.

Rapougnac commented 4 months ago

Hello @dmbaranov the issue is now fixed on the dev branch, you can switch to the main repo in your dependency_overrides :)

dmbaranov commented 4 months ago

Thank you so much, appreciate it! :)