* Initial implementation * Update summarytags/3.0.0
| @@ -104,5 +104,15 @@ namespace Discord | |||||
| var newText = Regex.Replace(text, @"(\*|_|`|~|>|\\)", ""); | var newText = Regex.Replace(text, @"(\*|_|`|~|>|\\)", ""); | ||||
| return newText; | return newText; | ||||
| } | } | ||||
| /// <summary> | |||||
| /// Formats a user's username + discriminator while maintaining bidirectional unicode | |||||
| /// </summary> | |||||
| /// <param name="user">The user whos username and discriminator to format</param> | |||||
| /// <returns>The username + discriminator</returns> | |||||
| public static string UsernameAndDiscriminator(IUser user) | |||||
| { | |||||
| return $"\u2066{user.Username}\u2069#{user.Discriminator}"; | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| @@ -128,8 +128,8 @@ namespace Discord.Rest | |||||
| /// <returns> | /// <returns> | ||||
| /// A string that resolves to Username#Discriminator of the user. | /// A string that resolves to Username#Discriminator of the user. | ||||
| /// </returns> | /// </returns> | ||||
| public override string ToString() => $"{Username}#{Discriminator}"; | |||||
| private string DebuggerDisplay => $"{Username}#{Discriminator} ({Id}{(IsBot ? ", Bot" : "")})"; | |||||
| public override string ToString() => Format.UsernameAndDiscriminator(this); | |||||
| private string DebuggerDisplay => $"{Format.UsernameAndDiscriminator(this)} ({Id}{(IsBot ? ", Bot" : "")})"; | |||||
| #endregion | #endregion | ||||
| #region IUser | #region IUser | ||||
| @@ -109,8 +109,8 @@ namespace Discord.WebSocket | |||||
| /// <returns> | /// <returns> | ||||
| /// The full name of the user. | /// The full name of the user. | ||||
| /// </returns> | /// </returns> | ||||
| public override string ToString() => $"{Username}#{Discriminator}"; | |||||
| private string DebuggerDisplay => $"{Username}#{Discriminator} ({Id}{(IsBot ? ", Bot" : "")})"; | |||||
| public override string ToString() => Format.UsernameAndDiscriminator(this); | |||||
| private string DebuggerDisplay => $"{Format.UsernameAndDiscriminator(this)} ({Id}{(IsBot ? ", Bot" : "")})"; | |||||
| internal SocketUser Clone() => MemberwiseClone() as SocketUser; | internal SocketUser Clone() => MemberwiseClone() as SocketUser; | ||||
| } | } | ||||
| } | } | ||||