diff --git a/DisCatSharp.ThirdPartyLookups/Entities/Mee6 Leaderboard/Mee6User.cs b/DisCatSharp.ThirdPartyLookups/Entities/Mee6 Leaderboard/Mee6User.cs index be539c099..e2c15a249 100644 --- a/DisCatSharp.ThirdPartyLookups/Entities/Mee6 Leaderboard/Mee6User.cs +++ b/DisCatSharp.ThirdPartyLookups/Entities/Mee6 Leaderboard/Mee6User.cs @@ -1,102 +1,113 @@ // This file is part of the DisCatSharp project, based off DSharpPlus. // // Copyright (c) 2021-2022 AITSYS // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. using System; using System.Collections.Generic; +using System.Globalization; using System.Linq; using System.Text; using System.Threading.Tasks; +using DisCatSharp.Enums; +using DisCatSharp.Net; + using Newtonsoft.Json; namespace DisCatSharp.ThirdPartyLookups.Entities; /// /// A user represented in a Mee6 Leaderboard. /// public class Mee6User { /// /// The id of this guild. /// [JsonProperty("id")] internal string? _Id { get; set; } /// /// The id of this guild. /// [JsonIgnore] public ulong Id => Convert.ToUInt64(this._Id); /// /// The username of this user. /// [JsonProperty("username")] public string? Username { get; set; } /// /// The discriminator of this user. /// [JsonProperty("discriminator")] public string? Discriminator { get; set; } /// /// The username and discriminator combined. E.g. User#0001 /// public string UsernameWithDiscriminator => $"{this.Username}#{this.Discriminator}"; /// /// The hash of the users' avatar. /// [JsonProperty("avatar")] public string? AvatarHash { get; set; } + /// + /// Gets the user's avatar url. + /// + [JsonIgnore] + public string? AvatarUrl + => !string.IsNullOrWhiteSpace(this.AvatarHash) ? $"{DiscordDomain.GetDomain(CoreDomain.DiscordCdn).Url}{Endpoints.AVATARS}/{this.Id.ToString(CultureInfo.InvariantCulture)}/{this.AvatarHash}.{(this.AvatarHash.StartsWith("a_") ? "gif" : "png")}?size=1024" : null; + /// /// The id of the guild this user belongs to. /// [JsonProperty("guild_id")] public string? GuildId { get; set; } /// /// How many messages the user wrote. /// [JsonProperty("message_count")] public int? MessageCount { get; set; } /// /// The current level of this user. /// [JsonProperty("level")] public int? Level { get; set; } /// /// The current experience of this user. /// [JsonProperty("xp")] public int? Experience { get; set; } /// /// Detailed information about the users' experience. /// [JsonProperty("detailed_xp")] public int[]? DetailedExperience { get; set; } }