remove some unused/legacy code

This commit is contained in:
spiral 2021-08-04 01:39:41 -04:00
parent 9fd4f327e0
commit c27cbeed01
No known key found for this signature in database
GPG Key ID: A6059F0CA0E1BD31
3 changed files with 3 additions and 14 deletions

View File

@ -161,7 +161,7 @@ namespace PluralKit.Bot {
var eb = new EmbedBuilder()
// TODO: add URL of website when that's up
.Author(new(name, IconUrl: DiscordUtils.WorkaroundForUrlBug(avatar.TryGetCleanCdnUrl())))
.Author(new(name, IconUrl: avatar.TryGetCleanCdnUrl()))
// .WithColor(member.ColorPrivacy.CanAccess(ctx) ? color : DiscordUtils.Gray)
.Color(color)
.Footer(new(
@ -231,7 +231,7 @@ namespace PluralKit.Bot {
}
var eb = new EmbedBuilder()
.Author(new(nameField, IconUrl: DiscordUtils.WorkaroundForUrlBug(target.IconFor(pctx))))
.Author(new(nameField, IconUrl: target.IconFor(pctx)))
.Color(color)
.Footer(new($"System ID: {system.Hid} | Group ID: {target.Hid} | Created on {target.Created.FormatZoned(system)}"));
@ -324,7 +324,7 @@ namespace PluralKit.Bot {
// Put it all together
var eb = new EmbedBuilder()
.Author(new(msg.Member.NameFor(ctx), IconUrl: DiscordUtils.WorkaroundForUrlBug(msg.Member.AvatarFor(ctx).TryGetCleanCdnUrl())))
.Author(new(msg.Member.NameFor(ctx), IconUrl: msg.Member.AvatarFor(ctx).TryGetCleanCdnUrl()))
.Description(serverMsg?.Content?.NormalizeLineEndSpacing() ?? "*(message contents deleted or inaccessible)*")
.Image(new(serverMsg?.Attachments?.FirstOrDefault()?.Url))
.Field(new("System",

View File

@ -56,12 +56,6 @@ namespace PluralKit.Bot
}
}
public static string WorkaroundForUrlBug(string input)
{
// Workaround for https://github.com/DSharpPlus/DSharpPlus/issues/565
return input?.Replace("%20", "+");
}
public static uint? ToDiscordColor(this string color)
{
if (uint.TryParse(color, NumberStyles.HexNumber, null, out var colorInt))

View File

@ -56,11 +56,6 @@ namespace PluralKit.Bot
// This function filters out sporadic errors out of our control from being reported to Sentry
// otherwise we'd blow out our error reporting budget as soon as Discord takes a dump, or something.
// Discord server errors are *not our problem*
// TODO: DSharpPlus doesn't have a generic "HttpException" type and only special cases a couple response codes (that we don't need here)
// Doesn't seem to handle 500s in the library at all, I'm not sure what it does in case it receives one...
// if (e is DSharpPlus.Exceptions he && ((int) he.HttpCode) >= 500) return false;
// Occasionally Discord's API will Have A Bad Time and return a bunch of CloudFlare errors (in HTML format).
// The library tries to parse these HTML responses as JSON and crashes with a consistent exception message.
if (e is JsonReaderException jre && jre.Message == "Unexpected character encountered while parsing value: <. Path '', line 0, position 0.") return false;