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

Gateway v9 allows enabling intents without access

Open MinnDevelopment opened this issue 1 year ago • 2 comments

Description

When using the V9 gateway, discord allows you to enable the MESSAGE_CONTENT intent without it being approved for the application.

Instead, this should still close the socket with a 4014: Disallowed Intents close code. However, it should allow you to enable it if you are approved.

This way, a library can already provide the intent before updating to v10, so bot devs can properly prepare and transition to the future versions smoothly. It doesn't really make sense for a library to switch to v10 before the deadline, since it enforces the intent before it's actually required.

Motivation:

I want to provide a warning for bot devs which have this intent disabled before the deadline arrives. Then the bot dev can try and enable it, notice that it would break, and look into verification properly. With the current setup however, they can enable the intent regardless and the library has no way to tell whether this is proper or not. The bot dev is then going to be surprised when the deadline arrives and suddenly everything breaks.

Also, when the library then updates to v10 and keeps sending the same intents, it will suddenly break.

Steps to Reproduce

  1. Disable the MESSAGE CONTENT INTENT flag in the dashboard image

  2. Connect to the v9 gateway with the intent enabled

  3. You still connect just fine and receive content like expected (you get content regardless of intent in v9)

Expected Behavior

The socket should close and tell you that you aren't allowed to use this intent, even if it doesn't do anything in v9.

Current Behavior

The gateway just ignores it and lets you use intents that aren't approved.

Screenshots/Videos

No response

Client and System Information

Gateway v9

MinnDevelopment avatar Jul 26 '22 12:07 MinnDevelopment

When trying to use the application.flags provided by the READY dispatch, I also noticed that these flags are incorrect on v9:

The application payload I receive on gateway v9 shows these flags:

{
  "flags" : 8691712,
  "id" : 420321485757087746
}

Which includes the GATEWAY_MESSAGE_CONTENT flag, since 8691712 & (1 << 18) == 1 << 18. However, I have this flag disabled:

image

So it seems that the gateway v9 incorrectly enables a flag it doesn't actually have access to.

MinnDevelopment avatar Aug 01 '22 15:08 MinnDevelopment

#4255

advaith1 avatar Aug 01 '22 15:08 advaith1

This should not be the case anymore now that the Message Content intent restriction has been launched. The flags should also be sending data back correctly now.

DV8FromTheWorld avatar Sep 09 '22 18:09 DV8FromTheWorld