mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-07 22:37:54 +00:00
feat: add -raw flag to pk;msg (#399)
This commit is contained in:
parent
9a34834ca9
commit
b998636cbe
4 changed files with 50 additions and 19 deletions
|
|
@ -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))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue