feat: add -raw flag to pk;msg (#399)

This commit is contained in:
Katrix
2021-10-29 16:42:10 -04:00
committed by spiral
parent 9a34834ca9
commit b998636cbe
4 changed files with 50 additions and 19 deletions

View File

@@ -9,6 +9,7 @@ using Myriad.Builders;
using Myriad.Extensions;
using Myriad.Gateway;
using Myriad.Rest;
using Myriad.Rest.Exceptions;
using Myriad.Rest.Types;
using Myriad.Types;
@@ -56,6 +57,19 @@ namespace PluralKit.Bot
}
}
public static async Task<Message?> GetMessageOrNull(this DiscordApiClient rest, ulong channelId, ulong messageId)
{
try
{
return await rest.GetMessage(channelId, messageId);
}
catch (ForbiddenException)
{
// no permission, couldn't fetch, oh well
return null;
}
}
public static uint? ToDiscordColor(this string color)
{
if (uint.TryParse(color, NumberStyles.HexNumber, null, out var colorInt))