From 740ccf6979712d926010b33323a2be1bc1eafa94 Mon Sep 17 00:00:00 2001 From: Ske Date: Wed, 10 Jul 2019 12:52:02 +0200 Subject: [PATCH] Fix sending message attachments --- PluralKit.Bot/Services/ProxyService.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/PluralKit.Bot/Services/ProxyService.cs b/PluralKit.Bot/Services/ProxyService.cs index 065f1bcc..67178d59 100644 --- a/PluralKit.Bot/Services/ProxyService.cs +++ b/PluralKit.Bot/Services/ProxyService.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Data; using System.Linq; using System.Net; +using System.Net.Http; using System.Threading.Tasks; using Dapper; using Discord; @@ -100,7 +101,8 @@ namespace PluralKit.Bot ulong messageId; if (attachment != null) { - using (var stream = await WebRequest.CreateHttp(attachment.Url).GetRequestStreamAsync()) { + using (var http = new HttpClient()) + using (var stream = await http.GetStreamAsync(attachment.Url)) { messageId = await client.SendFileAsync(stream, filename: attachment.Filename, text: text, username: username, avatarUrl: avatarUrl); } } else {