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

Improve gateway logging #169

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

biqqles
Copy link
Contributor

@biqqles biqqles commented Jul 20, 2022

Summary

Clarifies logging in the gateway code to explain what's happening and what went wrong. Fixes #168.

The below snippets contrast the output in the case that identify is unsuccessful.

New:

[INFO : websocket @ 2022-07-21 19:34:12.376] Connecting to gateway
[ERROR : websocket @ 2022-07-21 19:34:13.066] The gateway connection has closed: 
[ERROR : websocket @ 2022-07-21 19:34:13.066] Websocket close frame received!
[ERROR : websocket @ 2022-07-21 19:34:13.066] Code: 4014
[ERROR : websocket @ 2022-07-21 19:34:13.066] Message: Disallowed intent(s).
[ERROR : websocket @ 2022-07-21 19:34:13.066] 
Your bot attempted to identify with privileged intents that it is not authorized to use.
You must either enable these for your application on the Discord Developer Portal, or
set the intents: parameter of Bot#initialize to request only the intents that you need.
Read more here: https://discord.com/developers/docs/topics/gateway#privileged-intents
                https://drb.shardlab.dev/main/Discordrb/Bot.html#initialize-instance_method

Process finished with exit code 0

Old:

[ERROR : websocket @ 2022-07-21 19:38:37.361] The websocket connection has closed: (no information)
[ERROR : websocket @ 2022-07-21 19:38:37.361] Websocket close frame received!
[ERROR : websocket @ 2022-07-21 19:38:37.361] Code: 4014
[ERROR : websocket @ 2022-07-21 19:38:37.361] Message: Disallowed intent(s).
[ERROR : websocket @ 2022-07-21 19:38:37.361] You attempted to identify with privileged intents that your bot is not authorized to use
Please enable the privileged intents on the bot page of your application on the discord developer page.
Read more here https://discord.com/developers/docs/topics/gateway#privileged-intents
[WARN : websocket @ 2022-07-21 19:38:37.361] The WS loop exited! Not sure if this is a good thing

Process finished with exit code 0

Changed

  • Improved the message printed after attempting to identify with disallowed intents. The new message informs the user that they can either enable all privileged intents on the Portal or request only the ones they need.
  • Swapped a couple of logging calls between LOGGER.debug and LOGGER.info (and vice-versa) based on their relevance to the general user in understanding what the chain of events is

@biqqles biqqles changed the title Improve help message for disallowed intents Improve gateway logging Jul 21, 2022
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

Successfully merging this pull request may close these issues.

API v9 and backwards compatibility
1 participant