Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hang Status is not handled #661

Closed
dmbaranov opened this issue Jun 5, 2024 · 5 comments · Fixed by #665
Closed

Hang Status is not handled #661

dmbaranov opened this issue Jun 5, 2024 · 5 comments · Fixed by #665
Labels
bug Something isn't working
Milestone

Comments

@dmbaranov
Copy link

dmbaranov commented Jun 5, 2024

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:

  • If you have Hang Status feature enabled for your account:
    • Join voice channel and set Hang status;
    • Start bot with Nyxx.conntectGateway call, use GatewayIntents.all;
    • Observe thrown exception - FormatException: Unknown activity type
  • If you don't have new Hang status feature enabled for your account:
    • Remove dnd key from UserStatus;
    • Set Do not disturb status on the account;
    • Start bot with Nyxx.conntectGateway call, use GatewayIntents.all;
    • Observe thrown exception - FormatException: Unknown user status (which essentially leads to the same issue);

Expected behavior
Library correctly handles Hang status for the users.

Desktop (please complete the following information):

  • OS: Any;
  • Dart version: 3.3.4
  • Nyxx version: 6.2.1
@dmbaranov dmbaranov added the bug Something isn't working label Jun 5, 2024
@abitofevrything
Copy link
Member

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
Copy link
Author

dmbaranov commented Jun 5, 2024

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
Copy link
Member

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

@Rapougnac
Copy link
Member

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

@dmbaranov
Copy link
Author

Thank you so much, appreciate it! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants