Add DM support

This commit is contained in:
Ske
2020-12-25 13:19:35 +01:00
parent 2e0c30eb5d
commit a2c8cbb560
9 changed files with 79 additions and 45 deletions

View File

@@ -120,6 +120,9 @@ namespace Myriad.Rest
_client.PostMultipart<Message>($"/webhooks/{webhookId}/{webhookToken}?wait=true",
("ExecuteWebhook", webhookId), request, files)!;
public Task<Channel> CreateDm(ulong recipientId) =>
_client.Post<Channel>($"/users/@me/channels", ("CreateDM", default), new CreateDmRequest(recipientId))!;
private static string EncodeEmoji(Emoji emoji) =>
WebUtility.UrlEncode(emoji.Name) ?? emoji.Id?.ToString() ??
throw new ArgumentException("Could not encode emoji");