From 06680e8c7262898462d514f6c04b92fe739948ce Mon Sep 17 00:00:00 2001 From: Valdemar Erk Date: Tue, 28 Jan 2025 15:52:34 +0100 Subject: [PATCH 1/3] fix(model): Add global_name to CurrentUser --- twilight-model/src/user/current_user.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/twilight-model/src/user/current_user.rs b/twilight-model/src/user/current_user.rs index fb785a27df7..6d677cc95bc 100644 --- a/twilight-model/src/user/current_user.rs +++ b/twilight-model/src/user/current_user.rs @@ -50,6 +50,9 @@ pub struct CurrentUser { /// All flags on a user's account. #[serde(skip_serializing_if = "Option::is_none")] pub flags: Option, + /// User's global display name, if set. For bots, this is the application name + #[serde(skip_serializing_if = "Option::is_none")] + pub global_name: Option, /// User's id. pub id: Id, /// User's chosen language option. From 545bb710cc7a4ac64e7ad52f0ab39cc387b326c4 Mon Sep 17 00:00:00 2001 From: Valdemar Erk Date: Tue, 28 Jan 2025 16:07:39 +0100 Subject: [PATCH 2/3] add some dots --- twilight-model/src/user/current_user.rs | 2 +- twilight-model/src/user/mod.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/twilight-model/src/user/current_user.rs b/twilight-model/src/user/current_user.rs index 6d677cc95bc..037eafe51fb 100644 --- a/twilight-model/src/user/current_user.rs +++ b/twilight-model/src/user/current_user.rs @@ -50,7 +50,7 @@ pub struct CurrentUser { /// All flags on a user's account. #[serde(skip_serializing_if = "Option::is_none")] pub flags: Option, - /// User's global display name, if set. For bots, this is the application name + /// User's global display name, if set. For bots, this is the application name. #[serde(skip_serializing_if = "Option::is_none")] pub global_name: Option, /// User's id. diff --git a/twilight-model/src/user/mod.rs b/twilight-model/src/user/mod.rs index 953b76a5b2b..bd732acdfc5 100644 --- a/twilight-model/src/user/mod.rs +++ b/twilight-model/src/user/mod.rs @@ -158,7 +158,7 @@ pub struct User { pub email: Option, #[serde(skip_serializing_if = "Option::is_none")] pub flags: Option, - /// User's global display name, if set. For bots, this is the application name + /// User's global display name, if set. For bots, this is the application name. #[serde(skip_serializing_if = "Option::is_none")] pub global_name: Option, pub id: Id, From ccefdf766a3998e136c9cf8023d6c414f972077d Mon Sep 17 00:00:00 2001 From: Valdemar Erk Date: Tue, 28 Jan 2025 16:17:10 +0100 Subject: [PATCH 3/3] fix test --- twilight-cache-inmemory/src/test.rs | 1 + .../src/gateway/payload/incoming/ready.rs | 1 + twilight-model/src/user/current_user.rs | 13 +++++++++---- twilight-standby/src/lib.rs | 1 + 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/twilight-cache-inmemory/src/test.rs b/twilight-cache-inmemory/src/test.rs index 2d2964f2067..88b43bada12 100644 --- a/twilight-cache-inmemory/src/test.rs +++ b/twilight-cache-inmemory/src/test.rs @@ -229,6 +229,7 @@ pub fn current_user(id: u64) -> CurrentUser { public_flags: None, flags: None, locale: None, + global_name: None, } } diff --git a/twilight-model/src/gateway/payload/incoming/ready.rs b/twilight-model/src/gateway/payload/incoming/ready.rs index 3808e9d1e71..2c7f51ffa1e 100644 --- a/twilight-model/src/gateway/payload/incoming/ready.rs +++ b/twilight-model/src/gateway/payload/incoming/ready.rs @@ -66,6 +66,7 @@ mod tests { premium_type: None, public_flags: None, verified: None, + global_name: None, }, version: 8, }; diff --git a/twilight-model/src/user/current_user.rs b/twilight-model/src/user/current_user.rs index 037eafe51fb..10bbac785c9 100644 --- a/twilight-model/src/user/current_user.rs +++ b/twilight-model/src/user/current_user.rs @@ -139,7 +139,7 @@ mod tests { vec![ Token::Struct { name: "CurrentUser", - len: 14, + len: 15, }, Token::Str("accent_color"), Token::None, @@ -159,6 +159,9 @@ mod tests { Token::Str("flags"), Token::Some, Token::U64(1), + Token::Str("global_name"), + Token::Some, + Token::Str("twilight sparkle"), Token::Str("id"), Token::NewtypeStruct { name: "Id" }, Token::Str("1"), @@ -199,6 +202,7 @@ mod tests { public_flags: Some(UserFlags::STAFF), flags: None, locale: Some("test locale".to_owned()), + global_name: None, }; // Deserializing a current user with a string discriminator (which @@ -220,14 +224,15 @@ mod tests { bot: true, discriminator: 9999, email: Some("test@example.com".to_owned()), + flags: Some(UserFlags::STAFF), + global_name: Some("twilight sparkle".to_owned()), id: Id::new(1), + locale: Some("test locale".to_owned()), mfa_enabled: true, name: "test name".to_owned(), - verified: Some(true), premium_type: Some(PremiumType::NitroClassic), public_flags: Some(UserFlags::STAFF), - flags: Some(UserFlags::STAFF), - locale: Some("test locale".to_owned()), + verified: Some(true), }; // Deserializing a current user with a string discriminator (which diff --git a/twilight-standby/src/lib.rs b/twilight-standby/src/lib.rs index dc82d3ab604..1f4fe4d53b6 100644 --- a/twilight-standby/src/lib.rs +++ b/twilight-standby/src/lib.rs @@ -1407,6 +1407,7 @@ mod tests { public_flags: None, flags: None, locale: None, + global_name: None, }, version: 6, };