diff --git a/PluralKit.Bot/Commands/MemberAvatar.cs b/PluralKit.Bot/Commands/MemberAvatar.cs index a02dabdd..9fee58c3 100644 --- a/PluralKit.Bot/Commands/MemberAvatar.cs +++ b/PluralKit.Bot/Commands/MemberAvatar.cs @@ -61,7 +61,7 @@ namespace PluralKit.Bot if (target.System != ctx.System.Id) throw Errors.NotOwnMemberError; else if (user != null) { - if (!user.HasAvatar()) throw Errors.UserHasNoAvatar; //TODO: is this necessary? + if (user.AvatarHash == null) throw Errors.UserHasNoAvatar; target.AvatarUrl = user.GetAvatarUrl(ImageFormat.Png, size: 256); await _data.SaveMember(target); @@ -131,7 +131,7 @@ namespace PluralKit.Bot if (user != null) { - if (!user.HasAvatar()) throw Errors.UserHasNoAvatar; + if (user.AvatarHash == null) throw Errors.UserHasNoAvatar; guildData.AvatarUrl = user.GetAvatarUrl(ImageFormat.Png, size: 256); await _data.SetMemberGuildSettings(target, ctx.Guild.Id, guildData); diff --git a/PluralKit.Bot/Commands/SystemEdit.cs b/PluralKit.Bot/Commands/SystemEdit.cs index ed000be2..d5cf1645 100644 --- a/PluralKit.Bot/Commands/SystemEdit.cs +++ b/PluralKit.Bot/Commands/SystemEdit.cs @@ -144,7 +144,7 @@ namespace PluralKit.Bot var member = await ctx.MatchUser(); if (member != null) { - if (!member.HasAvatar()) throw Errors.UserHasNoAvatar; + if (member.AvatarHash == null) throw Errors.UserHasNoAvatar; ctx.System.AvatarUrl = member.GetAvatarUrl(ImageFormat.Png, size: 256); await _data.SaveSystem(ctx.System); diff --git a/PluralKit.Bot/Extensions.cs b/PluralKit.Bot/Extensions.cs deleted file mode 100644 index ad9da5a6..00000000 --- a/PluralKit.Bot/Extensions.cs +++ /dev/null @@ -1,29 +0,0 @@ -using DSharpPlus; -using DSharpPlus.Entities; - -using System.Net.WebSockets; - -namespace PluralKit.Bot -{ - static class Extensions - { - //Unfortunately D#+ doesn't expose the connection state of the client, so we have to test for it instead - public static bool IsConnected(this DiscordClient client) - { - try - { - client.GetConnectionsAsync().GetAwaiter().GetResult(); - } - catch(WebSocketException) - { - return false; - } - return true; - } - - public static bool HasAvatar(this DiscordUser user) - { - return user.AvatarUrl != user.DefaultAvatarUrl; - } - } -}