mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-15 02:00:09 +00:00
Fix sending message attachments
This commit is contained in:
parent
5bdb229b34
commit
740ccf6979
1 changed files with 3 additions and 1 deletions
|
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
using System.Net.Http;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Dapper;
|
using Dapper;
|
||||||
using Discord;
|
using Discord;
|
||||||
|
|
@ -100,7 +101,8 @@ namespace PluralKit.Bot
|
||||||
|
|
||||||
ulong messageId;
|
ulong messageId;
|
||||||
if (attachment != null) {
|
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);
|
messageId = await client.SendFileAsync(stream, filename: attachment.Filename, text: text, username: username, avatarUrl: avatarUrl);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue