discord-api-docs icon indicating copy to clipboard operation
discord-api-docs copied to clipboard

Activity gateway event may contain invalid snowflakes

Open TomWright opened this issue 3 months ago • 5 comments

Description

I've witnessed the GUILD_CREATE event sending through an activity with an application_id of 1. Note that this is a numerical 1, not a string.

The docs show that the data type here should be a snowflake, and the snowflake docs say that this should always be a string.

Out of 1142 activities found on my GUILD_CREATE event, the following is the one and only activity with a non-string application_id.

{
  "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
  "type": 1,
  "timestamps": {
    "start": 1711557036583
  },
  "state": "Playing Single Player",
  "session_id": "cedf635683339917672bc194bf59b35d",
  "name": "Grand Theft Auto 6",
  "id": "876e03ca62d9cfc2",
  "flags": 1,
  "details": "Grand Theft Auto VI",
  "created_at": 1711557037898,
  "assets": {
    "small_image": "mp:external/ruoyEd5pgWX_V3GB4FWCzMZyRVJZFedojHrb07B-nJA/https/media.tenor.com/ByYRHA88z_8AAAAj/bottas-crash.gif",
    "large_image": "mp:attachments/812394872392122390/1218155883431858207/gtavi.png?ex=6606a312&is=65f42e12&hm=8a29b83a446c91ea04500d265ee317709a0c3aff971e04807ee48e1b2b3b5da2&"
  },
  "application_id": 1
}

Steps to Reproduce

Sorry but I'm not sure on this one.

I assume it's related the the way the activity was created but I have no visibility of that.

This was happening for a specific guild 517776987419574272.

I am using the standard wsapi in discordgo (links further on under client and system information), listening for GUILD_CREATE events.

Expected Behavior

String values to be sent across for any fields with a snowflake data type.

Current Behavior

A numerical 1 being sent as a value for a snowflake data type, in one out of many cases.

Screenshots/Videos

No response

Client and System Information

I am using https://github.com/bwmarrin/discordgo v0.27.1.

I have adjusted to use a fork (https://github.com/TomWright/discordgo) which gets around this issue with this change:

https://github.com/TomWright/discordgo/commit/2d4dd73f645e5a23de1630c6b9129799d4fdccbf

The client is runner under go version go1.22.1

TomWright avatar Mar 28 '24 11:03 TomWright

Related to https://github.com/discord/discord-api-docs/issues/6609.

TomWright avatar Mar 28 '24 11:03 TomWright

The type difference is explained here (#1078), but does conflict with the "always" language that you quoted.

Edit: This exception applies to user provided input, so maybe it's irrelevant.

SinisterRectus avatar Mar 28 '24 13:03 SinisterRectus

This will never happen with IDs that come from Discord.

It's possible that discordgo is requesting this data, but as I understand it the data is coming from discord in response to a READY request.

TomWright avatar Mar 28 '24 13:03 TomWright

"1" is not valid application_id tho, curious how you got it ><

lsdimagine avatar Mar 29 '24 23:03 lsdimagine

@lsdimagine I wish I could give you more information on that. I'm developing a bot for a discord server that I don't own and this activity exists there

TomWright avatar Mar 30 '24 20:03 TomWright