feature: Add inline replies (#1659)

* Add inline replies

* Missed a few things

* Change xml docs, IUserMessage, and other changes

* Missed one when changing

* Fix referencedMessage author
This commit is contained in:
Paulo
2020-11-22 00:43:38 -03:00
committed by GitHub
parent 25d5d36772
commit e3850e1e8f
32 changed files with 239 additions and 132 deletions

View File

@@ -6,6 +6,7 @@ using System.Linq;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Model = Discord.API.Message;
using UserModel = Discord.API.User;
namespace Discord.Rest
{
@@ -290,7 +291,7 @@ namespace Discord.Rest
public static MessageSource GetSource(Model msg)
{
if (msg.Type != MessageType.Default)
if (msg.Type != MessageType.Default && msg.Type != MessageType.Reply)
return MessageSource.System;
else if (msg.WebhookId.IsSpecified)
return MessageSource.Webhook;
@@ -307,5 +308,15 @@ namespace Discord.Rest
{
await client.ApiClient.CrosspostAsync(channelId, msgId, options).ConfigureAwait(false);
}
public static IUser GetAuthor(BaseDiscordClient client, IGuild guild, UserModel model, ulong? webhookId)
{
IUser author = null;
if (guild != null)
author = guild.GetUserAsync(model.Id, CacheMode.CacheOnly).Result;
if (author == null)
author = RestUser.Create(client, guild, model, webhookId);
return author;
}
}
}