Total Complexity | 5 |
Total Lines | 88 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | # Copyright Pincer 2021-Present |
||
|
|||
2 | # Full MIT License can be found in `LICENSE` at the project root. |
||
3 | |||
4 | from __future__ import annotations |
||
5 | |||
6 | from enum import IntEnum |
||
7 | |||
8 | |||
9 | class Intents(IntEnum): |
||
10 | """Discord client intents. |
||
11 | |||
12 | These give your client more permissions. |
||
13 | |||
14 | .. note:: |
||
15 | The given Intents must also be enabled for your client on |
||
16 | the discord dashboard. |
||
17 | |||
18 | Attributes |
||
19 | ---------- |
||
20 | NONE: |
||
21 | No intents. |
||
22 | GUILDS: |
||
23 | Guilds intent. |
||
24 | GUILD_MEMBERS: |
||
25 | Members intent. |
||
26 | GUILD_BANS: |
||
27 | Bans intent. |
||
28 | GUILD_EMOJIS_AND_STICKERS: |
||
29 | Emoji and Sticker intent. |
||
30 | GUILD_INTEGRATIONS: |
||
31 | Integrations intent. |
||
32 | GUILD_WEBHOOKS: |
||
33 | Webhooks intent. |
||
34 | GUILD_INVITES: |
||
35 | Invites intent. |
||
36 | GUILD_VOICE_STATES: |
||
37 | Voice states intent. |
||
38 | GUILD_PRESENCES: |
||
39 | Presences intent. |
||
40 | GUILD_MESSAGES: |
||
41 | Message intent. |
||
42 | GUILD_MESSAGE_REACTIONS: |
||
43 | Reactions to messages intent. |
||
44 | GUILD_MESSAGE_TYPING: |
||
45 | Typing to messages intent. |
||
46 | DIRECT_MESSAGES: |
||
47 | DM messages intent. |
||
48 | DIRECT_MESSAGE_REACTIONS: |
||
49 | DM reaction to messages intent. |
||
50 | DIRECT_MESSAGE_TYPING: |
||
51 | DM typing to messages intent. |
||
52 | """ |
||
53 | NONE = 0 |
||
54 | GUILDS = 1 << 0 |
||
55 | GUILD_MEMBERS = 1 << 1 |
||
56 | GUILD_BANS = 1 << 2 |
||
57 | GUILD_EMOJIS_AND_STICKERS = 1 << 3 |
||
58 | GUILD_INTEGRATIONS = 1 << 4 |
||
59 | GUILD_WEBHOOKS = 1 << 5 |
||
60 | GUILD_INVITES = 1 << 6 |
||
61 | GUILD_VOICE_STATES = 1 << 7 |
||
62 | GUILD_PRESENCES = 1 << 8 |
||
63 | GUILD_MESSAGES = 1 << 9 |
||
64 | GUILD_MESSAGE_REACTIONS = 1 << 10 |
||
65 | GUILD_MESSAGE_TYPING = 1 << 11 |
||
66 | DIRECT_MESSAGES = 1 << 12 |
||
67 | DIRECT_MESSAGE_REACTIONS = 1 << 13 |
||
68 | DIRECT_MESSAGE_TYPING = 1 << 14 |
||
69 | |||
70 | @staticmethod |
||
71 | def all() -> int: |
||
72 | """ |
||
73 | :class:`~pincer.objects.app.intents.Intents`: |
||
74 | Method of all intents |
||
75 | """ |
||
76 | res = 0 |
||
77 | |||
78 | for intent in list(map(lambda itm: itm.value, Intents)): |
||
79 | res |= intent |
||
80 | |||
81 | return res |
||
82 | |||
83 | def __repr__(self): |
||
84 | return f"Intents({self.name})" |
||
85 | |||
86 | def __str__(self) -> str: |
||
87 | return self.name.lower().replace("_", " ") |
||
88 |