about summary refs log tree commit diff stats
path: root/discord/intents.py
diff options
context:
space:
mode:
authormjk134 <57556877+mjk134@users.noreply.github.com>2022-07-09 14:13:38 +0000
committerGitHub <noreply@github.com>2022-07-09 14:13:38 +0000
commit526f88d3356cfc7272d97e4087e87b6cb9bf6e8b (patch)
tree3dc0309367d0d9acef64f8c3ab395811b69291f1 /discord/intents.py
parent56cff43ab5e5c6f0f0bd8ce714f830cb6e129327 (diff)
parent8bf5e835ff7fc6ddc315717a42a31fde1f024b92 (diff)
downloaddiscobra-526f88d3356cfc7272d97e4087e87b6cb9bf6e8b.tar.gz
Merge branch 'master' of https://github.com/mounderfod/discobra
Diffstat (limited to 'discord/intents.py')
-rw-r--r--discord/intents.py56
1 files changed, 33 insertions, 23 deletions
diff --git a/discord/intents.py b/discord/intents.py
index 2e993ea..f538fb6 100644
--- a/discord/intents.py
+++ b/discord/intents.py
@@ -15,28 +15,28 @@ class Intents(Enum):
 
     See more at: https://discord.com/developers/docs/topics/gateway#gateway-intents
     """
-    GUILDS = 0
-    GUILD_MEMBERS = 1
-    GUILD_BANS = 2
-    GUILD_EMOJIS_AND_STICKERS = 3
-    GUILD_INTEGRATIONS = 4
-    GUILD_WEBHOOKS = 5
-    GUILD_INVITES = 6
-    GUILD_VOICE_STATES = 7
-    GUILD_PRESENCES = 8
-    GUILD_MESSAGES = 9
-    GUILD_MESSAGE_REACTIONS = 10
-    GUILD_MESSAGE_TYPING = 11
-    DIRECT_MESSAGES = 12
-    DIRECT_MESSAGE_REACTIONS = 13
-    DIRECT_MESSAGE_TYPING = 14
-    MESSAGE_CONTENT = 15
-    GUILD_SCHEDULED_EVENTS = 16
-    AUTO_MODERATION_CONFIGURATION = 20
-    AUTO_MODERATION_EXECUTION = 21
-
-
-def gen_number(intents: list[Intents]):
+    GUILDS = 1
+    GUILD_MEMBERS = 2
+    GUILD_BANS = 4
+    GUILD_EMOJIS_AND_STICKERS = 8
+    GUILD_INTEGRATIONS = 16
+    GUILD_WEBHOOKS = 32
+    GUILD_INVITES = 64
+    GUILD_VOICE_STATES = 128
+    GUILD_PRESENCES = 256
+    GUILD_MESSAGES = 512
+    GUILD_MESSAGE_REACTIONS = 1024
+    GUILD_MESSAGE_TYPING = 2048
+    DIRECT_MESSAGES = 4096
+    DIRECT_MESSAGE_REACTIONS = 8192
+    DIRECT_MESSAGE_TYPING = 16384
+    MESSAGE_CONTENT = 32768
+    GUILD_SCHEDULED_EVENTS = 65536
+    AUTO_MODERATION_CONFIGURATION = 1048576
+    AUTO_MODERATION_EXECUTION = 2097152
+
+
+def get_number(intents: list[Intents]):
     """
     Generates the number used to tell the gateway which intents are active.
 
@@ -48,5 +48,15 @@ def gen_number(intents: list[Intents]):
     """
     number = 1
     for i in intents:
-        number << i.value
+        number += i.value
     return number
+
+
+def get_intents(number: int):
+    intents = []
+    while number != 0:
+        for i in Intents:
+            if number >= i.value:
+                intents.append(i)
+                number -= i.value
+    return intents