| @@ -6,9 +6,9 @@ namespace Discord.Commands | |||
| { | |||
| public CommandContext Context { get; internal set; } | |||
| protected virtual async Task<IUserMessage> ReplyAsync(string message, bool isTTS = false, RequestOptions options = null) | |||
| protected virtual async Task<IUserMessage> ReplyAsync(string message, bool isTTS = false, API.Embed embed = null, RequestOptions options = null) | |||
| { | |||
| return await Context.Channel.SendMessageAsync(message, isTTS, options).ConfigureAwait(false); | |||
| return await Context.Channel.SendMessageAsync(message, isTTS, embed, options).ConfigureAwait(false); | |||
| } | |||
| } | |||
| } | |||
| @@ -8,7 +8,7 @@ namespace Discord | |||
| public interface IMessageChannel : IChannel | |||
| { | |||
| /// <summary> Sends a message to this message channel. </summary> | |||
| Task<IUserMessage> SendMessageAsync(string text, bool isTTS = false, RequestOptions options = null); | |||
| Task<IUserMessage> SendMessageAsync(string text, bool isTTS = false, API.Embed embed = null, RequestOptions options = null); | |||
| /// <summary> Sends a file to this text channel, with an optional caption. </summary> | |||
| Task<IUserMessage> SendFileAsync(string filePath, string text = null, bool isTTS = false, RequestOptions options = null); | |||
| /// <summary> Sends a file to this text channel, with an optional caption. </summary> | |||
| @@ -110,13 +110,6 @@ namespace Discord.Rest | |||
| } | |||
| public static async Task<RestUserMessage> SendMessageAsync(IChannel channel, BaseDiscordClient client, | |||
| string text, bool isTTS, IGuild guild, RequestOptions options) | |||
| { | |||
| var args = new CreateMessageParams(text) { IsTTS = isTTS }; | |||
| var model = await client.ApiClient.CreateMessageAsync(channel.Id, args, options).ConfigureAwait(false); | |||
| return RestUserMessage.Create(client, guild, model); | |||
| } | |||
| public static async Task<RestUserMessage> SendRichMessageAsync(IChannel channel, BaseDiscordClient client, | |||
| string text, bool isTTS, API.Embed embed, IGuild guild, RequestOptions options) | |||
| { | |||
| var args = new CreateMessageParams(text) { IsTTS = isTTS, Embed = embed }; | |||
| @@ -7,7 +7,7 @@ namespace Discord.Rest | |||
| public interface IRestMessageChannel : IMessageChannel | |||
| { | |||
| /// <summary> Sends a message to this message channel. </summary> | |||
| new Task<RestUserMessage> SendMessageAsync(string text, bool isTTS = false, RequestOptions options = null); | |||
| new Task<RestUserMessage> SendMessageAsync(string text, bool isTTS = false, API.Embed embed = null, RequestOptions options = null); | |||
| /// <summary> Sends a file to this text channel, with an optional caption. </summary> | |||
| new Task<RestUserMessage> SendFileAsync(string filePath, string text = null, bool isTTS = false, RequestOptions options = null); | |||
| /// <summary> Sends a file to this text channel, with an optional caption. </summary> | |||
| @@ -63,8 +63,8 @@ namespace Discord.Rest | |||
| public Task<IReadOnlyCollection<RestMessage>> GetPinnedMessagesAsync(RequestOptions options = null) | |||
| => ChannelHelper.GetPinnedMessagesAsync(this, Discord, null, options); | |||
| public Task<RestUserMessage> SendMessageAsync(string text, bool isTTS = false, RequestOptions options = null) | |||
| => ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, null, options); | |||
| public Task<RestUserMessage> SendMessageAsync(string text, bool isTTS = false, API.Embed embed = null, RequestOptions options = null) | |||
| => ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, null, options); | |||
| public Task<RestUserMessage> SendFileAsync(string filePath, string text, bool isTTS = false, RequestOptions options = null) | |||
| => ChannelHelper.SendFileAsync(this, Discord, filePath, text, isTTS, null, options); | |||
| public Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text, bool isTTS = false, RequestOptions options = null) | |||
| @@ -126,8 +126,8 @@ namespace Discord.Rest | |||
| => await SendFileAsync(filePath, text, isTTS, options).ConfigureAwait(false); | |||
| async Task<IUserMessage> IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS, RequestOptions options) | |||
| => await SendFileAsync(stream, filename, text, isTTS, options).ConfigureAwait(false); | |||
| async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, RequestOptions options) | |||
| => await SendMessageAsync(text, isTTS, options).ConfigureAwait(false); | |||
| async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, API.Embed embed, RequestOptions options) | |||
| => await SendMessageAsync(text, isTTS, embed, options).ConfigureAwait(false); | |||
| IDisposable IMessageChannel.EnterTypingState(RequestOptions options) | |||
| => EnterTypingState(options); | |||
| @@ -76,8 +76,8 @@ namespace Discord.Rest | |||
| public Task<IReadOnlyCollection<RestMessage>> GetPinnedMessagesAsync(RequestOptions options = null) | |||
| => ChannelHelper.GetPinnedMessagesAsync(this, Discord, null, options); | |||
| public Task<RestUserMessage> SendMessageAsync(string text, bool isTTS = false, RequestOptions options = null) | |||
| => ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, null, options); | |||
| public Task<RestUserMessage> SendMessageAsync(string text, bool isTTS = false, API.Embed embed = null, RequestOptions options = null) | |||
| => ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, null, options); | |||
| public Task<RestUserMessage> SendFileAsync(string filePath, string text, bool isTTS = false, RequestOptions options = null) | |||
| => ChannelHelper.SendFileAsync(this, Discord, filePath, text, isTTS, null, options); | |||
| public Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text, bool isTTS = false, RequestOptions options = null) | |||
| @@ -136,8 +136,8 @@ namespace Discord.Rest | |||
| => await SendFileAsync(filePath, text, isTTS, options).ConfigureAwait(false); | |||
| async Task<IUserMessage> IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS, RequestOptions options) | |||
| => await SendFileAsync(stream, filename, text, isTTS, options).ConfigureAwait(false); | |||
| async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, RequestOptions options) | |||
| => await SendMessageAsync(text, isTTS, options).ConfigureAwait(false); | |||
| async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, API.Embed embed, RequestOptions options) | |||
| => await SendMessageAsync(text, isTTS, embed, options).ConfigureAwait(false); | |||
| IDisposable IMessageChannel.EnterTypingState(RequestOptions options) | |||
| => EnterTypingState(options); | |||
| @@ -55,8 +55,8 @@ namespace Discord.Rest | |||
| public Task<IReadOnlyCollection<RestMessage>> GetPinnedMessagesAsync(RequestOptions options = null) | |||
| => ChannelHelper.GetPinnedMessagesAsync(this, Discord, null, options); | |||
| public Task<RestUserMessage> SendMessageAsync(string text, bool isTTS = false, RequestOptions options = null) | |||
| => ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, null, options); | |||
| public Task<RestUserMessage> SendMessageAsync(string text, bool isTTS = false, API.Embed embed = null, RequestOptions options = null) | |||
| => ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, null, options); | |||
| public Task<RestUserMessage> SendFileAsync(string filePath, string text, bool isTTS = false, RequestOptions options = null) | |||
| => ChannelHelper.SendFileAsync(this, Discord, filePath, text, isTTS, null, options); | |||
| public Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text, bool isTTS = false, RequestOptions options = null) | |||
| @@ -108,8 +108,8 @@ namespace Discord.Rest | |||
| => await SendFileAsync(filePath, text, isTTS, options).ConfigureAwait(false); | |||
| async Task<IUserMessage> IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS, RequestOptions options) | |||
| => await SendFileAsync(stream, filename, text, isTTS, options).ConfigureAwait(false); | |||
| async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, RequestOptions options) | |||
| => await SendMessageAsync(text, isTTS, options).ConfigureAwait(false); | |||
| async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, API.Embed embed, RequestOptions options) | |||
| => await SendMessageAsync(text, isTTS, embed, options).ConfigureAwait(false); | |||
| IDisposable IMessageChannel.EnterTypingState(RequestOptions options) | |||
| => EnterTypingState(options); | |||
| @@ -33,8 +33,8 @@ namespace Discord.Rest | |||
| public Task<IReadOnlyCollection<RestMessage>> GetPinnedMessagesAsync(RequestOptions options = null) | |||
| => ChannelHelper.GetPinnedMessagesAsync(this, Discord, null, options); | |||
| public Task<RestUserMessage> SendMessageAsync(string text, bool isTTS, RequestOptions options = null) | |||
| => ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, null, options); | |||
| public Task<RestUserMessage> SendMessageAsync(string text, bool isTTS, API.Embed embed = null, RequestOptions options = null) | |||
| => ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, null, options); | |||
| public Task<RestUserMessage> SendFileAsync(string filePath, string text, bool isTTS, RequestOptions options = null) | |||
| => ChannelHelper.SendFileAsync(this, Discord, filePath, text, isTTS, null, options); | |||
| public Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text, bool isTTS, RequestOptions options = null) | |||
| @@ -86,8 +86,8 @@ namespace Discord.Rest | |||
| => await SendFileAsync(filePath, text, isTTS, options); | |||
| async Task<IUserMessage> IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS, RequestOptions options) | |||
| => await SendFileAsync(stream, filename, text, isTTS, options); | |||
| async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, RequestOptions options) | |||
| => await SendMessageAsync(text, isTTS, options); | |||
| async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, API.Embed embed, RequestOptions options) | |||
| => await SendMessageAsync(text, isTTS, embed, options); | |||
| IDisposable IMessageChannel.EnterTypingState(RequestOptions options) | |||
| => EnterTypingState(options); | |||
| @@ -44,8 +44,8 @@ namespace Discord.Rpc | |||
| public Task<IReadOnlyCollection<RestMessage>> GetPinnedMessagesAsync(RequestOptions options = null) | |||
| => ChannelHelper.GetPinnedMessagesAsync(this, Discord, null, options); | |||
| public Task<RestUserMessage> SendMessageAsync(string text, bool isTTS = false, RequestOptions options = null) | |||
| => ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, null, options); | |||
| public Task<RestUserMessage> SendMessageAsync(string text, bool isTTS = false, API.Embed embed = null, RequestOptions options = null) | |||
| => ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, null, options); | |||
| public Task<RestUserMessage> SendFileAsync(string filePath, string text, bool isTTS = false, RequestOptions options = null) | |||
| => ChannelHelper.SendFileAsync(this, Discord, filePath, text, isTTS, null, options); | |||
| public Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text, bool isTTS = false, RequestOptions options = null) | |||
| @@ -104,8 +104,8 @@ namespace Discord.Rpc | |||
| => await SendFileAsync(filePath, text, isTTS, options).ConfigureAwait(false); | |||
| async Task<IUserMessage> IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS, RequestOptions options) | |||
| => await SendFileAsync(stream, filename, text, isTTS, options).ConfigureAwait(false); | |||
| async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, RequestOptions options) | |||
| => await SendMessageAsync(text, isTTS, options).ConfigureAwait(false); | |||
| async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, API.Embed embed, RequestOptions options) | |||
| => await SendMessageAsync(text, isTTS, embed, options).ConfigureAwait(false); | |||
| IDisposable IMessageChannel.EnterTypingState(RequestOptions options) | |||
| => EnterTypingState(options); | |||
| @@ -46,8 +46,8 @@ namespace Discord.Rpc | |||
| public Task<IReadOnlyCollection<RestMessage>> GetPinnedMessagesAsync(RequestOptions options = null) | |||
| => ChannelHelper.GetPinnedMessagesAsync(this, Discord, null, options); | |||
| public Task<RestUserMessage> SendMessageAsync(string text, bool isTTS = false, RequestOptions options = null) | |||
| => ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, null, options); | |||
| public Task<RestUserMessage> SendMessageAsync(string text, bool isTTS = false, API.Embed embed = null, RequestOptions options = null) | |||
| => ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, null, options); | |||
| public Task<RestUserMessage> SendFileAsync(string filePath, string text, bool isTTS = false, RequestOptions options = null) | |||
| => ChannelHelper.SendFileAsync(this, Discord, filePath, text, isTTS, null, options); | |||
| public Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text, bool isTTS = false, RequestOptions options = null) | |||
| @@ -103,8 +103,8 @@ namespace Discord.Rpc | |||
| => await SendFileAsync(filePath, text, isTTS, options).ConfigureAwait(false); | |||
| async Task<IUserMessage> IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS, RequestOptions options) | |||
| => await SendFileAsync(stream, filename, text, isTTS, options).ConfigureAwait(false); | |||
| async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, RequestOptions options) | |||
| => await SendMessageAsync(text, isTTS, options).ConfigureAwait(false); | |||
| async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, API.Embed embed, RequestOptions options) | |||
| => await SendMessageAsync(text, isTTS, embed, options).ConfigureAwait(false); | |||
| IDisposable IMessageChannel.EnterTypingState(RequestOptions options) | |||
| => EnterTypingState(options); | |||
| @@ -49,8 +49,8 @@ namespace Discord.Rpc | |||
| public Task<IReadOnlyCollection<RestMessage>> GetPinnedMessagesAsync(RequestOptions options = null) | |||
| => ChannelHelper.GetPinnedMessagesAsync(this, Discord, null, options); | |||
| public Task<RestUserMessage> SendMessageAsync(string text, bool isTTS = false, RequestOptions options = null) | |||
| => ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, null, options); | |||
| public Task<RestUserMessage> SendMessageAsync(string text, bool isTTS = false, API.Embed embed = null, RequestOptions options = null) | |||
| => ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, null, options); | |||
| public Task<RestUserMessage> SendFileAsync(string filePath, string text, bool isTTS = false, RequestOptions options = null) | |||
| => ChannelHelper.SendFileAsync(this, Discord, filePath, text, isTTS, null, options); | |||
| public Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text, bool isTTS = false, RequestOptions options = null) | |||
| @@ -105,8 +105,8 @@ namespace Discord.Rpc | |||
| => await SendFileAsync(filePath, text, isTTS, options).ConfigureAwait(false); | |||
| async Task<IUserMessage> IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS, RequestOptions options) | |||
| => await SendFileAsync(stream, filename, text, isTTS, options).ConfigureAwait(false); | |||
| async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, RequestOptions options) | |||
| => await SendMessageAsync(text, isTTS, options).ConfigureAwait(false); | |||
| async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, API.Embed embed, RequestOptions options) | |||
| => await SendMessageAsync(text, isTTS, embed, options).ConfigureAwait(false); | |||
| IDisposable IMessageChannel.EnterTypingState(RequestOptions options) | |||
| => EnterTypingState(options); | |||
| } | |||
| @@ -11,7 +11,7 @@ namespace Discord.WebSocket | |||
| IReadOnlyCollection<SocketMessage> CachedMessages { get; } | |||
| /// <summary> Sends a message to this message channel. </summary> | |||
| new Task<RestUserMessage> SendMessageAsync(string text, bool isTTS = false, RequestOptions options = null); | |||
| new Task<RestUserMessage> SendMessageAsync(string text, bool isTTS = false, API.Embed embed = null, RequestOptions options = null); | |||
| /// <summary> Sends a file to this text channel, with an optional caption. </summary> | |||
| new Task<RestUserMessage> SendFileAsync(string filePath, string text = null, bool isTTS = false, RequestOptions options = null); | |||
| /// <summary> Sends a file to this text channel, with an optional caption. </summary> | |||
| @@ -66,8 +66,8 @@ namespace Discord.WebSocket | |||
| public Task<IReadOnlyCollection<RestMessage>> GetPinnedMessagesAsync(RequestOptions options = null) | |||
| => ChannelHelper.GetPinnedMessagesAsync(this, Discord, null, options); | |||
| public Task<RestUserMessage> SendMessageAsync(string text, bool isTTS = false, RequestOptions options = null) | |||
| => ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, null, options); | |||
| public Task<RestUserMessage> SendMessageAsync(string text, bool isTTS = false, API.Embed embed = null, RequestOptions options = null) | |||
| => ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, null, options); | |||
| public Task<RestUserMessage> SendFileAsync(string filePath, string text, bool isTTS = false, RequestOptions options = null) | |||
| => ChannelHelper.SendFileAsync(this, Discord, filePath, text, isTTS, null, options); | |||
| public Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text, bool isTTS = false, RequestOptions options = null) | |||
| @@ -134,8 +134,8 @@ namespace Discord.WebSocket | |||
| => await SendFileAsync(filePath, text, isTTS, options).ConfigureAwait(false); | |||
| async Task<IUserMessage> IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS, RequestOptions options) | |||
| => await SendFileAsync(stream, filename, text, isTTS, options).ConfigureAwait(false); | |||
| async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, RequestOptions options) | |||
| => await SendMessageAsync(text, isTTS, options).ConfigureAwait(false); | |||
| async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, API.Embed embed, RequestOptions options) | |||
| => await SendMessageAsync(text, isTTS, embed, options).ConfigureAwait(false); | |||
| IDisposable IMessageChannel.EnterTypingState(RequestOptions options) | |||
| => EnterTypingState(options); | |||
| @@ -89,8 +89,8 @@ namespace Discord.WebSocket | |||
| public Task<IReadOnlyCollection<RestMessage>> GetPinnedMessagesAsync(RequestOptions options = null) | |||
| => ChannelHelper.GetPinnedMessagesAsync(this, Discord, null, options); | |||
| public Task<RestUserMessage> SendMessageAsync(string text, bool isTTS = false, RequestOptions options = null) | |||
| => ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, null, options); | |||
| public Task<RestUserMessage> SendMessageAsync(string text, bool isTTS = false, API.Embed embed = null, RequestOptions options = null) | |||
| => ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, null, options); | |||
| public Task<RestUserMessage> SendFileAsync(string filePath, string text, bool isTTS = false, RequestOptions options = null) | |||
| => ChannelHelper.SendFileAsync(this, Discord, filePath, text, isTTS, null, options); | |||
| public Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text, bool isTTS = false, RequestOptions options = null) | |||
| @@ -197,8 +197,8 @@ namespace Discord.WebSocket | |||
| => await SendFileAsync(filePath, text, isTTS, options).ConfigureAwait(false); | |||
| async Task<IUserMessage> IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS, RequestOptions options) | |||
| => await SendFileAsync(stream, filename, text, isTTS, options).ConfigureAwait(false); | |||
| async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, RequestOptions options) | |||
| => await SendMessageAsync(text, isTTS, options).ConfigureAwait(false); | |||
| async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, API.Embed embed, RequestOptions options) | |||
| => await SendMessageAsync(text, isTTS, embed, options).ConfigureAwait(false); | |||
| IDisposable IMessageChannel.EnterTypingState(RequestOptions options) | |||
| => EnterTypingState(options); | |||
| @@ -72,8 +72,8 @@ namespace Discord.WebSocket | |||
| public Task<IReadOnlyCollection<RestMessage>> GetPinnedMessagesAsync(RequestOptions options = null) | |||
| => ChannelHelper.GetPinnedMessagesAsync(this, Discord, Guild, options); | |||
| public Task<RestUserMessage> SendMessageAsync(string text, bool isTTS = false, RequestOptions options = null) | |||
| => ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, Guild, options); | |||
| public Task<RestUserMessage> SendMessageAsync(string text, bool isTTS = false, API.Embed embed = null, RequestOptions options = null) | |||
| => ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, Guild, options); | |||
| public Task<RestUserMessage> SendFileAsync(string filePath, string text, bool isTTS = false, RequestOptions options = null) | |||
| => ChannelHelper.SendFileAsync(this, Discord, filePath, text, isTTS, Guild, options); | |||
| public Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text, bool isTTS = false, RequestOptions options = null) | |||
| @@ -135,8 +135,8 @@ namespace Discord.WebSocket | |||
| => await SendFileAsync(filePath, text, isTTS, options).ConfigureAwait(false); | |||
| async Task<IUserMessage> IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS, RequestOptions options) | |||
| => await SendFileAsync(stream, filename, text, isTTS, options).ConfigureAwait(false); | |||
| async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, RequestOptions options) | |||
| => await SendMessageAsync(text, isTTS, options).ConfigureAwait(false); | |||
| async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, API.Embed embed, RequestOptions options) | |||
| => await SendMessageAsync(text, isTTS, embed, options).ConfigureAwait(false); | |||
| IDisposable IMessageChannel.EnterTypingState(RequestOptions options) | |||
| => EnterTypingState(options); | |||
| } | |||