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
// use serde::Deserialize;
// /// User struct that represents a Discord Base user.
// ///
// struct BaseUser {
// /// The user's id.
// pub id: String,
// /// The user's username, not unique across the platform.
// pub username: String,
// /// The user's 4-digit discord-tag.
// pub discriminator: String,
// /// The user;s display name, if it is set. For bots, this is the Application Name.
// pub global_name: Option<String>,
// /// The user's avatar hash.
// pub avatar: String,
// /// whether the user belongs to an OAuth2 application.
// pub bot: bool,
// /// whether the user is an Official Discord System user (part of the urgent message system).
// /// This is only available when using the OAuth2 flow.
// pub system: bool,
// /// whether the user has two factor enabled on their account.
// pub mfa_enabled: bool,
// /// The User banner hash.
// pub banner: Option<String>,
// /// accent color of the user banner.
// pub accent_color: Option<u64>,
// /// The user chosen language option.
// pub locale: String,
// /// verification status of the user.
// pub verified: bool,
// /// The user's email.
// pub email: Option<String>,
// /// The flags on a user's account.
// pub flags: u64,
// /// The type of Nitro subscription on a user's account.
// pub premium_type: u64,
// // The public flags on a user's account.
// // pub public_flags: u64,
// // Data for the user;s avatar decoration.
// // pub avatar_decoration_data: Option<String>,
// }
// #[derive(Deserialize)]
// struct UserPayload {
// username: String,
// id: String,
// discriminator: String,
// global_name: Option<String>,
// avatar: Option<String>,
// banner: Option<String>,
// accent_color: Option<u64>,
// bot: Option<bool>,
// system: Option<bool>,
// public_flags: Option<u64>,
// }
// impl BaseUser {
// fn new(data: UserPayload) -> Self {
// BaseUser {
// id: data.id,
// username: data.username,
// discriminator: data.discriminator,
// global_name: data.global_name,
// avatar: data.avatar.unwrap_or_else(|| "".to_string()),
// bot: data.bot.unwrap_or_else(|| false),
// system: data.system.unwrap_or_else(|| false),
// mfa_enabled: false,
// banner: data.banner,
// accent_color: data.accent_color,
// locale: "".to_string(),
// verified: false,
// email: None,
// flags: data.public_flags.unwrap_or_else(|| 0),
// premium_type: 0,
// }
// }
// pub fn public_flags(&self) -> u64 {
// self.flags
// }
// }