adiscord_intents/lib.rs
1#[repr(u32)]
2pub enum Intent {
3 /// Exhaustive list of events included:
4 ///
5 /// - GUILD_UPDATE
6 /// - GUILD_DELETE
7 /// - GUILD_ROLE_CREATE
8 /// - GUILD_ROLE_UPDATE
9 /// - GUILD_ROLE_DELETE
10 /// - CHANNEL_CREATE
11 /// - CHANNEL_UPDATE
12 /// - CHANNEL_DELETE
13 /// - CHANNEL_PINS_UPDATE
14 /// - THREAD_CREATE
15 /// - THREAD_UPDATE
16 /// - THREAD_DELETE
17 /// - THREAD_LIST_SYNC
18 /// - THREAD_MEMBER_UPDATE
19 /// - THREAD_MEMBERS_UPDATE *
20 /// - STAGE_INSTANCE_CREATE
21 /// - STAGE_INSTANCE_UPDATE
22 /// - STAGE_INSTANCE_DELETE
23 Guilds = 1 << 0,
24
25 /// Exhaustive list of events included:
26 ///
27 /// - GUILD_MEMBER_ADD
28 /// - GUILD_MEMBER_UPDATE
29 /// - GUILD_MEMBER_REMOVE
30 /// - THREAD_MEMBERS_UPDATE *
31 GuildMembers = 1 << 1,
32
33 /// Exhaustive list of events included:
34 ///
35 /// - GUILD_AUDIT_LOG_ENTRY_CREATE
36 /// - GUILD_BAN_ADD
37 /// - GUILD_BAN_REMOVE
38 GuildModeration = 1 << 2,
39
40 /// Exhaustive list of events included:
41 ///
42 /// - GUILD_EMOJIS_UPDATE
43 /// - GUILD_STICKERS_UPDATE
44 GuildEmojisAndStickers = 1 << 3,
45
46 /// Exhaustive list of events included:
47 ///
48 /// - GUILD_INTEGRATIONS_UPDATE
49 /// - INTEGRATION_CREATE
50 /// - INTEGRATION_UPDATE
51 /// - INTEGRATION_DELETE
52 GuildIntegrations = 1 << 4,
53
54 /// Exhaustive list of events included:
55 ///
56 /// - WEBHOOKS_UPDATE
57 GuildWebhooks = 1 << 5,
58
59 /// Exhaustive list of events included:
60 ///
61 /// - INVITE_CREATE
62 /// - INVITE_DELETE
63 GuildInvites = 1 << 6,
64
65 /// Exhaustive list of events included:
66 ///
67 /// - VOICE_STATE_UPDATE
68 GuildVoiceStates = 1 << 7,
69
70 /// Exhaustive list of events included:
71 ///
72 /// - PRESENCE_UPDATE
73 GuildPresences = 1 << 8,
74
75 /// Exhaustive list of events included:
76 ///
77 /// - MESSAGE_CREATE
78 /// - MESSAGE_UPDATE
79 /// - MESSAGE_DELETE
80 /// - MESSAGE_DELETE_BULK
81 GuildMessages = 1 << 9,
82
83 /// Exhaustive list of events included:
84 ///
85 /// - MESSAGE_REACTION_ADD
86 /// - MESSAGE_REACTION_REMOVE
87 /// - MESSAGE_REACTION_REMOVE_ALL
88 /// - MESSAGE_REACTION_REMOVE_EMOJI
89 GuildMessageReactions = 1 << 10,
90
91 /// Exhaustive list of events included:
92 ///
93 /// - TYPING_START
94 GuildMessageTyping = 1 << 11,
95
96 /// Exhaustive list of events included:
97 ///
98 /// - MESSAGE_CREATE
99 /// - MESSAGE_UPDATE
100 /// - MESSAGE_DELETE
101 /// - CHANNEL_PINS_UPDATE
102 DirectMessages = 1 << 12,
103
104 /// Exhaustive list of events included:
105 ///
106 /// - MESSAGE_REACTION_ADD
107 /// - MESSAGE_REACTION_REMOVE
108 /// - MESSAGE_REACTION_REMOVE_ALL
109 /// - MESSAGE_REACTION_REMOVE_EMOJI
110 DirectMessageReactions = 1 << 13,
111
112 /// Exhaustive list of events included:
113 ///
114 /// - TYPING_START
115 DirectMessageTyping = 1 << 14,
116
117 MessageContent = 1 << 15,
118
119 /// Exhaustive list of events included:
120 ///
121 /// - GUILD_SCHEDULED_EVENT_CREATE
122 /// - GUILD_SCHEDULED_EVENT_UPDATE
123 /// - GUILD_SCHEDULED_EVENT_DELETE
124 /// - GUILD_SCHEDULED_EVENT_USER_ADD
125 /// - GUILD_SCHEDULED_EVENT_USER_REMOVE
126 GuildScheduledEvents = 1 << 16,
127
128 /// Exhaustive list of events included:
129 ///
130 /// - AUTO_MODERATION_RULE_CREATE
131 /// - AUTO_MODERATION_RULE_UPDATE
132 /// - AUTO_MODERATION_RULE_DELETE
133 AutoModerationConfiguration = 1 << 20,
134
135 /// Exhaustive list of events included:
136 ///
137 /// - AUTO_MODERATION_RULE_CREATE
138 /// - AUTO_MODERATION_RULE_UPDATE
139 /// - AUTO_MODERATION_RULE_DELETE
140 AutoModerationExecution = 1 << 21,
141}
142
143/// Generate the number of itents from an intent list
144pub fn generate_intent_number(intents: Vec<Intent>) -> u32 {
145 let mut intent_number: u32 = 0;
146 for intent in intents {
147 intent_number += intent as u32;
148 }
149
150 intent_number
151}