mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-09-05 09:26:10 +00:00
Add a special exception for required privileged intents
This commit is contained in:
@ -175,3 +175,27 @@ class ConnectionClosed(ClientException):
|
||||
self.reason = ''
|
||||
self.shard_id = shard_id
|
||||
super().__init__('Shard ID %s WebSocket closed with %s' % (self.shard_id, self.code))
|
||||
|
||||
class PrivilegedIntentsRequired(ClientException):
|
||||
"""Exception that's thrown when the gateway is requesting privileged intents
|
||||
but they're not ticked in the developer page yet.
|
||||
|
||||
Go to https://discord.com/developers/applications/ and enable the intents
|
||||
that are required. Currently these are as follows:
|
||||
|
||||
- :attr:`Intents.members`
|
||||
- :attr:`Intents.presences`
|
||||
|
||||
Attributes
|
||||
-----------
|
||||
shard_id: Optional[:class:`int`]
|
||||
The shard ID that got closed if applicable.
|
||||
"""
|
||||
|
||||
def __init__(self, shard_id):
|
||||
self.shard_id = shard_id
|
||||
msg = 'Shard ID %s is requesting privileged intents that have not been explicitly enabled in the ' \
|
||||
'developer portal. It is recommended to go to https://discord.com/developers/applications/ ' \
|
||||
'and explicitly enable the privileged intents within your application\'s page. If this is not ' \
|
||||
'possible, then consider disabling the privileged intents instead.'
|
||||
super().__init__(msg % shard_id)
|
||||
|
Reference in New Issue
Block a user