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

gateway - received exception when parsing ActivityButton #166

Open
chrissound opened this issue Apr 6, 2023 · 3 comments
Open

gateway - received exception when parsing ActivityButton #166

chrissound opened this issue Apr 6, 2023 · 3 comments

Comments

@chrissound
Copy link

chrissound commented Apr 6, 2023

Using 1.12.5 (will try upgrade - just need to upgrade the all the code first)

gateway - received exception [Error in $: Error in $.activities[0].buttons[0]: parsing ActivityButton failed, expected Object, but encountered String] while decoding:

(I've redacted the sensitive values of a user).

{
  "t": "PRESENCE_UPDATE",
  "s": 91,
  "op": 0,
  "d": {
    "user": {
      "id": "****************"
    },
    "status": "online",
    "guild_id": "************************",
    "client_status": {
      "web": "idle",
      "mobile": "online",
      "desktop": "idle"
    },
    "activities": [
      {
        "type": 0,
        "timestamps": {
          "start": *********************8
        },
        "state": "🎮 Connected: ❌ | 🔋 N/A",
        "session_id": "*****************",
        "name": "*******",
        "id": "**********************",
        "details": "Home Page | v2.4.2",
        "created_at": **************8,
        "buttons": [
          "DSX - View On Steam",
          "DSX - Join Discord Server"
        ],
        "assets": {
          "large_image": "*********************"
        },
        "application_id": "*****************************"
      }
    ]
  }
}
@L0neGamer
Copy link
Contributor

I can see what the issue is, it's exactly as described; when sending a presence update, we need it to be an object of a label and a string, but when receiving it will just be a string. It's a simple thing to fix with a plaster but it'll require a bit more thinking to get a satisfying solution; will probably need different types for sending and receiving.

@chrissound
Copy link
Author

Hmmm, potentially ActivityButton becomes a sum type then? And then you'll have ActivityButtonIncoming String | ActivityButtonOutgoing ...?

@L0neGamer
Copy link
Contributor

The issue with that in my eyes is that it doesn't ensure what type you'll get on either the receiving end or what you can send; a library user should know that they can only receive one type, and they can only send the other. Not sure that we do this anywhere else though...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants