1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
use serde::{Deserialize, Serialize};
use super::{
AvatarDecorationDataApiType, EmojiApiType, RoleApiType, UserApiType, WelcomeScreenApiType,
};
use crate::resources::StickerApiType;
/// <https://discord.com/developers/docs/resources/guild#guild-object>
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct GuildApiType {
/// guild id
pub id: String,
/// guild name (2-100 characters, excluding trailing and leading whitespace)
pub name: String,
/// icon hash
#[serde(skip_serializing_if = "Option::is_none")]
pub icon: Option<String>,
/// icon hash, returned when in the template object
#[serde(skip_serializing_if = "Option::is_none")]
pub icon_hash: Option<String>,
/// splash hash
#[serde(skip_serializing_if = "Option::is_none")]
pub splash: Option<String>,
/// discovery splash hash; only present for guilds with the "DISCOVERABLE" feature
#[serde(skip_serializing_if = "Option::is_none")]
pub discovery_splash: Option<String>,
/// true if the user is the owner of the guild
#[serde(skip_serializing_if = "Option::is_none")]
pub owner: Option<bool>,
/// id of owner
pub owner_id: String,
/// total permissions for the user in the guild (excludes overwrites)
#[serde(skip_serializing_if = "Option::is_none")]
pub permissions: Option<String>,
/// voice region id for the guild (deprecated)
#[serde(skip_serializing_if = "Option::is_none")]
pub region: Option<String>,
/// id of afk channel
#[serde(skip_serializing_if = "Option::is_none")]
pub afk_channel_id: Option<String>,
/// afk timeout in seconds
pub afk_timeout: u32,
/// true if the server widget is enabled
#[serde(skip_serializing_if = "Option::is_none")]
pub widget_enabled: Option<bool>,
/// the channel id that the widget will generate an invite to, or null if set to no invite
#[serde(skip_serializing_if = "Option::is_none")]
pub widget_channel_id: Option<String>,
/// verification level required for the guild
pub verification_level: u8,
/// default message notifications level
pub default_message_notifications: u8,
/// explicit content filter level
pub explicit_content_filter: u8,
/// roles in the guild
pub roles: Vec<RoleApiType>,
/// custom guild emojis
pub emojis: Vec<EmojiApiType>,
/// enabled guild features
pub features: Vec<String>,
/// required MFA level for the guild
pub mfa_level: u8,
/// application id of the guild creator if it is bot-created
#[serde(skip_serializing_if = "Option::is_none")]
pub application_id: Option<String>,
/// the id of the channel where guild notices such as welcome messages and boost events are posted
#[serde(skip_serializing_if = "Option::is_none")]
pub system_channel_id: Option<String>,
/// system channel flags
pub system_channel_flags: u32,
/// the id of the channel where Community guilds can display rules and/or guidelines
#[serde(skip_serializing_if = "Option::is_none")]
pub rules_channel_id: Option<String>,
/// the maximum number of presences for the guild (null is always returned, apart from the largest of guilds)
#[serde(skip_serializing_if = "Option::is_none")]
pub max_presences: Option<u32>,
/// the maximum number of members for the guild
#[serde(skip_serializing_if = "Option::is_none")]
pub max_members: Option<u32>,
/// the vanity url code for the guild
#[serde(skip_serializing_if = "Option::is_none")]
pub vanity_url_code: Option<String>,
/// the description of a guild
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
/// banner hash
#[serde(skip_serializing_if = "Option::is_none")]
pub banner: Option<String>,
/// premium tier (Server Boost level)
pub premium_tier: u8,
/// the number of boosts this guild currently has
#[serde(skip_serializing_if = "Option::is_none")]
pub premium_subscription_count: Option<u32>,
/// the preferred locale of a Community guild; used in server discovery and notices from Discord
pub preferred_locale: String,
/// the id of the channel where admins and moderators of Community guilds receive notices from Discord
#[serde(skip_serializing_if = "Option::is_none")]
pub public_updates_channel_id: Option<String>,
/// the maximum amount of users in a video channel
#[serde(skip_serializing_if = "Option::is_none")]
pub max_video_channel_users: Option<u32>,
/// the maximum amount of users in a stage video channel
#[serde(skip_serializing_if = "Option::is_none")]
pub max_stage_video_channel_users: Option<u32>,
/// approximate number of members in this guild
#[serde(skip_serializing_if = "Option::is_none")]
pub approximate_member_count: Option<u32>,
/// approximate number of non-offline members in this guild
#[serde(skip_serializing_if = "Option::is_none")]
pub approximate_presence_count: Option<u32>,
/// the welcome screen of a Community guild, shown to new members
#[serde(skip_serializing_if = "Option::is_none")]
pub welcome_screen: Option<WelcomeScreenApiType>,
/// guild NSFW level
pub nsfw_level: u8,
/// custom guild stickers
#[serde(skip_serializing_if = "Option::is_none")]
pub stickers: Option<Vec<StickerApiType>>,
/// whether the guild has the boost progress bar enabled
pub premium_progress_bar_enabled: bool,
/// the id of the channel where admins and moderators of Community guilds receive safety alerts from Discord
#[serde(skip_serializing_if = "Option::is_none")]
pub safety_alerts_channel_id: Option<String>,
/// the incidents data for this guild
#[serde(skip_serializing_if = "Option::is_none")]
pub incidents_data: Option<IncidentsDataApiType>,
}
/// <https://discord.com/developers/docs/resources/guild#unavailable-guild-object>
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct UnavailableGuildApiType {
pub id: String,
pub unavailable: bool,
}
/// <https://discord.com/developers/docs/resources/guild#guild-member-object>
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct GuildMemberApiType {
/// the user this guild member represents
#[serde(skip_serializing_if = "Option::is_none")]
pub user: Option<UserApiType>,
/// this user's guild nickname
#[serde(skip_serializing_if = "Option::is_none")]
pub nick: Option<String>,
/// the member's guild avatar hash
#[serde(skip_serializing_if = "Option::is_none")]
pub avatar: Option<String>,
/// the member's guild banner hash
#[serde(skip_serializing_if = "Option::is_none")]
pub banner: Option<String>,
/// array of role object ids
pub roles: Vec<String>,
/// when the user joined the guild
pub joined_at: String,
/// when the user started boosting the guild
#[serde(skip_serializing_if = "Option::is_none")]
pub premium_since: Option<String>,
/// whether the user is deafened in voice channels
pub deaf: bool,
/// whether the user is muted in voice channels
pub mute: bool,
/// guild member flags represented as a bit set, defaults to 0
#[serde(skip_serializing_if = "Option::is_none")]
pub flags: Option<u32>,
/// whether the user has not yet passed the guild's Membership Screening requirements
#[serde(skip_serializing_if = "Option::is_none")]
pub pending: Option<bool>,
/// total permissions of the member in the channel, including overwrites
#[serde(skip_serializing_if = "Option::is_none")]
pub permissions: Option<String>,
/// when the user's timeout will expire and the user will be able to communicate in the guild again
#[serde(skip_serializing_if = "Option::is_none")]
pub communication_disabled_until: Option<String>,
/// data for the member's guild avatar decoration
#[serde(skip_serializing_if = "Option::is_none")]
pub avatar_decoration_data: Option<AvatarDecorationDataApiType>,
}
/// <https://discord.com/developers/docs/resources/guild#integration-object>
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct IntegrationApiType {
/// integration id
pub id: String,
/// integration name
pub name: String,
/// integration type (twitch, youtube, discord, or guild_subscription)
#[serde(rename = "type")]
pub type_: String,
/// is this integration enabled
#[serde(skip_serializing_if = "Option::is_none")]
pub enabled: Option<bool>,
/// is this integration syncing
#[serde(skip_serializing_if = "Option::is_none")]
pub syncing: Option<bool>,
/// id that this integration uses for "subscribers"
#[serde(skip_serializing_if = "Option::is_none")]
pub role_id: Option<String>,
/// whether emoticons should be synced for this integration (twitch only currently)
#[serde(skip_serializing_if = "Option::is_none")]
pub enable_emoticons: Option<bool>,
/// the behavior of expiring subscribers
#[serde(skip_serializing_if = "Option::is_none")]
pub expire_behavior: Option<u8>,
/// the grace period (in days) before expiring subscribers
#[serde(skip_serializing_if = "Option::is_none")]
pub expire_grace_period: Option<u32>,
/// user for this integration
#[serde(skip_serializing_if = "Option::is_none")]
pub user: Option<UserApiType>,
/// integration account information
pub account: IntegrationAccountApiType,
/// when this integration was last synced
#[serde(skip_serializing_if = "Option::is_none")]
pub synced_at: Option<String>,
/// how many subscribers this integration has
#[serde(skip_serializing_if = "Option::is_none")]
pub subscriber_count: Option<u32>,
/// has this integration been revoked
#[serde(skip_serializing_if = "Option::is_none")]
pub revoked: Option<bool>,
/// The bot/OAuth2 application for discord integrations
#[serde(skip_serializing_if = "Option::is_none")]
pub application: Option<IntegrationApplicationApiType>,
/// the scopes the application has been authorized for
#[serde(skip_serializing_if = "Option::is_none")]
pub scopes: Option<Vec<String>>,
}
/// <https://discord.com/developers/docs/resources/guild#integration-account-object>
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct IntegrationAccountApiType {
/// id of the account
pub id: String,
/// name of the account
pub name: String,
}
/// <https://discord.com/developers/docs/resources/guild#ban-object>
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct BanApiType {
/// the reason for the ban
#[serde(skip_serializing_if = "Option::is_none")]
pub reason: Option<String>,
/// the banned user
pub user: UserApiType,
}
/// <https://discord.com/developers/docs/resources/guild#incidents-data-object>
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct IncidentsDataApiType {
/// when invites get enabled again
#[serde(skip_serializing_if = "Option::is_none")]
pub invites_disabled_until: Option<String>, // ISO8601 timestamp
/// when direct messages get enabled again
#[serde(skip_serializing_if = "Option::is_none")]
pub dms_disabled_until: Option<String>, // ISO8601 timestamp
/// when the dm spam was detected
#[serde(skip_serializing_if = "Option::is_none")]
pub dm_spam_detected_at: Option<String>, // ISO8601 timestamp
/// when the raid was detected
#[serde(skip_serializing_if = "Option::is_none")]
pub raid_detected_at: Option<String>, // ISO8601 timestamp
}
/// <https://discord.com/developers/docs/resources/guild#integration-application-object>
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct IntegrationApplicationApiType {
/// the id of the app
pub id: String,
/// the name of the app
pub name: String,
/// the icon hash of the app
pub icon: Option<String>,
/// the description of the app
pub description: String,
/// the bot associated with this application
#[serde(skip_serializing_if = "Option::is_none")]
pub bot: Option<UserApiType>,
}