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

Creating overwrite directly after creating a channel causes incorrect CHANNEL_UPDATE

Open MinnDevelopment opened this issue 1 year ago • 2 comments

Description

The recently introduced channel emoji experiment has introduced a new CHANNEL_UPDATE event, which fires directly after the channel is created. This causes problems when another update happens before that emoji is created.

This invalid state is cached persistently. You can fix this by editing the channel manually:

https://github.com/discord/discord-api-docs/assets/18090140/971cbfd5-40cd-4812-ac13-163953dcb91c

Steps to Reproduce

  1. Create a new text channel
  2. Immediately add a new overwrite using the PATCH endpoint
  3. Receive two CHANNEL_UPDATE events

The first CHANNEL_UPDATE adds the permission overwrites:

{
  ...
  "permission_overwrites" : [ {
    "allow" : "1024",
    "deny" : "0",
    "id" : "86699011792191488",
    "type" : 1
  } ],
  ...
}

The second CHANNEL_UPDATE removes it, but adds an icon emoji:

{
  ...
  "icon_emoji" : {
    "name" : "...",
    "id" : null
  },
  "permission_overwrites" : [],
  ...
}

Note that manually fetching the channel via the GET /channels/:channel_id endpoint returns the correct state that includes the overwrite.

Expected Behavior

The second update event should not remove the overwrite.

Current Behavior

The event removes the overwrite.

Screenshots/Videos

No response

Client and System Information

API v10

MinnDevelopment avatar Jul 03 '23 21:07 MinnDevelopment