commitpull/978/mergea8bafb90cd
Merge:f38dd4c4
7e04285e
Author: WamWooWam <wamwoowam@gmail.com> Date: Mon Mar 12 08:05:52 2018 +0000 Merge branch 'dev' of https://github.com/WamWooWam/Discord.Net into dev commitf38dd4c421
Author: WamWooWam <wamwoowam@gmail.com> Date: Mon Mar 12 08:05:49 2018 +0000 Cleaned up & fixed code style. commit7e04285e5d
Author: Thomas May <wamwoowam@gmail.com> Date: Sun Mar 11 14:11:28 2018 +0000 Revert changes to DefaultRestClient Didn't actually need to change this, whoops. commit3f5b2c8ef1
Author: WamWooWam <wamwoowam@gmail.com> Date: Sat Mar 10 19:30:44 2018 +0000 Enabled embeds alongside uploaded files. God damn Discord is a mess. Co-authored-by: WamWooWam <wamwoowam@gmail.com>
@@ -1,4 +1,4 @@ | |||||
using System; | |||||
using System; | |||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.IO; | using System.IO; | ||||
using System.Threading.Tasks; | using System.Threading.Tasks; | ||||
@@ -11,10 +11,10 @@ namespace Discord | |||||
Task<IUserMessage> SendMessageAsync(string text, bool isTTS = false, Embed embed = null, RequestOptions options = null); | Task<IUserMessage> SendMessageAsync(string text, bool isTTS = false, Embed embed = null, RequestOptions options = null); | ||||
#if FILESYSTEM | #if FILESYSTEM | ||||
/// <summary> Sends a file to this text channel, with an optional caption. </summary> | /// <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); | |||||
Task<IUserMessage> SendFileAsync(string filePath, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null); | |||||
#endif | #endif | ||||
/// <summary> Sends a file to this text channel, with an optional caption. </summary> | /// <summary> Sends a file to this text channel, with an optional caption. </summary> | ||||
Task<IUserMessage> SendFileAsync(Stream stream, string filename, string text = null, bool isTTS = false, RequestOptions options = null); | |||||
Task<IUserMessage> SendFileAsync(Stream stream, string filename, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null); | |||||
/// <summary> Gets a message from this message channel with the given id, or null if not found. </summary> | /// <summary> Gets a message from this message channel with the given id, or null if not found. </summary> | ||||
Task<IMessage> GetMessageAsync(ulong id, CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); | Task<IMessage> GetMessageAsync(ulong id, CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); | ||||
@@ -1,4 +1,4 @@ | |||||
using System.Threading.Tasks; | |||||
using System.Threading.Tasks; | |||||
using System.IO; | using System.IO; | ||||
namespace Discord | namespace Discord | ||||
@@ -8,10 +8,10 @@ namespace Discord | |||||
/// <summary> | /// <summary> | ||||
/// Sends a message to the user via DM. | /// Sends a message to the user via DM. | ||||
/// </summary> | /// </summary> | ||||
public static async Task<IUserMessage> SendMessageAsync(this IUser user, | |||||
string text, | |||||
public static async Task<IUserMessage> SendMessageAsync(this IUser user, | |||||
string text, | |||||
bool isTTS = false, | bool isTTS = false, | ||||
Embed embed = null, | |||||
Embed embed = null, | |||||
RequestOptions options = null) | RequestOptions options = null) | ||||
{ | { | ||||
return await (await user.GetOrCreateDMChannelAsync().ConfigureAwait(false)).SendMessageAsync(text, isTTS, embed, options).ConfigureAwait(false); | return await (await user.GetOrCreateDMChannelAsync().ConfigureAwait(false)).SendMessageAsync(text, isTTS, embed, options).ConfigureAwait(false); | ||||
@@ -25,23 +25,25 @@ namespace Discord | |||||
string filename, | string filename, | ||||
string text = null, | string text = null, | ||||
bool isTTS = false, | bool isTTS = false, | ||||
Embed embed = null, | |||||
RequestOptions options = null | RequestOptions options = null | ||||
) | ) | ||||
{ | { | ||||
return await (await user.GetOrCreateDMChannelAsync().ConfigureAwait(false)).SendFileAsync(stream, filename, text, isTTS, options).ConfigureAwait(false); | |||||
return await (await user.GetOrCreateDMChannelAsync().ConfigureAwait(false)).SendFileAsync(stream, filename, text, isTTS, embed, options).ConfigureAwait(false); | |||||
} | } | ||||
#if FILESYSTEM | #if FILESYSTEM | ||||
/// <summary> | /// <summary> | ||||
/// Sends a file to the user via DM. | /// Sends a file to the user via DM. | ||||
/// </summary> | /// </summary> | ||||
public static async Task<IUserMessage> SendFileAsync(this IUser user, | |||||
string filePath, | |||||
string text = null, | |||||
bool isTTS = false, | |||||
public static async Task<IUserMessage> SendFileAsync(this IUser user, | |||||
string filePath, | |||||
string text = null, | |||||
bool isTTS = false, | |||||
Embed embed = null, | |||||
RequestOptions options = null) | RequestOptions options = null) | ||||
{ | { | ||||
return await (await user.GetOrCreateDMChannelAsync().ConfigureAwait(false)).SendFileAsync(filePath, text, isTTS, options).ConfigureAwait(false); | |||||
return await (await user.GetOrCreateDMChannelAsync().ConfigureAwait(false)).SendFileAsync(filePath, text, isTTS, embed, options).ConfigureAwait(false); | |||||
} | } | ||||
#endif | #endif | ||||
} | } | ||||
@@ -1,18 +1,25 @@ | |||||
#pragma warning disable CS1591 | |||||
#pragma warning disable CS1591 | |||||
using Discord.Net.Converters; | |||||
using Discord.Net.Rest; | using Discord.Net.Rest; | ||||
using Newtonsoft.Json; | |||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Globalization; | |||||
using System.IO; | using System.IO; | ||||
using System.Text; | |||||
namespace Discord.API.Rest | namespace Discord.API.Rest | ||||
{ | { | ||||
internal class UploadFileParams | internal class UploadFileParams | ||||
{ | { | ||||
private static JsonSerializer _serializer = new JsonSerializer { ContractResolver = new DiscordContractResolver() }; | |||||
public Stream File { get; } | public Stream File { get; } | ||||
public Optional<string> Filename { get; set; } | public Optional<string> Filename { get; set; } | ||||
public Optional<string> Content { get; set; } | public Optional<string> Content { get; set; } | ||||
public Optional<string> Nonce { get; set; } | public Optional<string> Nonce { get; set; } | ||||
public Optional<bool> IsTTS { get; set; } | public Optional<bool> IsTTS { get; set; } | ||||
public Optional<Embed> Embed { get; set; } | |||||
public UploadFileParams(Stream file) | public UploadFileParams(Stream file) | ||||
{ | { | ||||
@@ -29,6 +36,19 @@ namespace Discord.API.Rest | |||||
d["tts"] = IsTTS.Value.ToString(); | d["tts"] = IsTTS.Value.ToString(); | ||||
if (Nonce.IsSpecified) | if (Nonce.IsSpecified) | ||||
d["nonce"] = Nonce.Value; | d["nonce"] = Nonce.Value; | ||||
if (Embed.IsSpecified) | |||||
{ | |||||
var sb = new StringBuilder(256); | |||||
using (TextWriter text = new StringWriter(sb, CultureInfo.InvariantCulture)) | |||||
using (JsonWriter writer = new JsonTextWriter(text)) | |||||
{ | |||||
Dictionary<string, object> dictionary = new Dictionary<string, object>(); | |||||
dictionary["embed"] = Embed.Value; | |||||
_serializer.Serialize(writer, dictionary); | |||||
} | |||||
d["payload_json"] = sb.ToString(); | |||||
} | |||||
return d; | return d; | ||||
} | } | ||||
} | } | ||||
@@ -1,4 +1,4 @@ | |||||
using Discord.API.Rest; | |||||
using Discord.API.Rest; | |||||
using System; | using System; | ||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Collections.Immutable; | using System.Collections.Immutable; | ||||
@@ -170,17 +170,17 @@ namespace Discord.Rest | |||||
#if FILESYSTEM | #if FILESYSTEM | ||||
public static async Task<RestUserMessage> SendFileAsync(IMessageChannel channel, BaseDiscordClient client, | public static async Task<RestUserMessage> SendFileAsync(IMessageChannel channel, BaseDiscordClient client, | ||||
string filePath, string text, bool isTTS, RequestOptions options) | |||||
string filePath, string text, bool isTTS, Embed embed, RequestOptions options) | |||||
{ | { | ||||
string filename = Path.GetFileName(filePath); | string filename = Path.GetFileName(filePath); | ||||
using (var file = File.OpenRead(filePath)) | using (var file = File.OpenRead(filePath)) | ||||
return await SendFileAsync(channel, client, file, filename, text, isTTS, options).ConfigureAwait(false); | |||||
return await SendFileAsync(channel, client, file, filename, text, isTTS, embed, options).ConfigureAwait(false); | |||||
} | } | ||||
#endif | #endif | ||||
public static async Task<RestUserMessage> SendFileAsync(IMessageChannel channel, BaseDiscordClient client, | public static async Task<RestUserMessage> SendFileAsync(IMessageChannel channel, BaseDiscordClient client, | ||||
Stream stream, string filename, string text, bool isTTS, RequestOptions options) | |||||
Stream stream, string filename, string text, bool isTTS, Embed embed, RequestOptions options) | |||||
{ | { | ||||
var args = new UploadFileParams(stream) { Filename = filename, Content = text, IsTTS = isTTS }; | |||||
var args = new UploadFileParams(stream) { Filename = filename, Content = text, IsTTS = isTTS, Embed = embed?.ToModel() }; | |||||
var model = await client.ApiClient.UploadFileAsync(channel.Id, args, options).ConfigureAwait(false); | var model = await client.ApiClient.UploadFileAsync(channel.Id, args, options).ConfigureAwait(false); | ||||
return RestUserMessage.Create(client, channel, client.CurrentUser, model); | return RestUserMessage.Create(client, channel, client.CurrentUser, model); | ||||
} | } | ||||
@@ -1,4 +1,4 @@ | |||||
using System.Collections.Generic; | |||||
using System.Collections.Generic; | |||||
using System.IO; | using System.IO; | ||||
using System.Threading.Tasks; | using System.Threading.Tasks; | ||||
@@ -10,10 +10,10 @@ namespace Discord.Rest | |||||
new Task<RestUserMessage> SendMessageAsync(string text, bool isTTS = false, Embed embed = null, RequestOptions options = null); | new Task<RestUserMessage> SendMessageAsync(string text, bool isTTS = false, Embed embed = null, RequestOptions options = null); | ||||
#if FILESYSTEM | #if FILESYSTEM | ||||
/// <summary> Sends a file to this text channel, with an optional caption. </summary> | /// <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); | |||||
new Task<RestUserMessage> SendFileAsync(string filePath, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null); | |||||
#endif | #endif | ||||
/// <summary> Sends a file to this text channel, with an optional caption. </summary> | /// <summary> Sends a file to this text channel, with an optional caption. </summary> | ||||
new Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text = null, bool isTTS = false, RequestOptions options = null); | |||||
new Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null); | |||||
/// <summary> Gets a message from this message channel with the given id, or null if not found. </summary> | /// <summary> Gets a message from this message channel with the given id, or null if not found. </summary> | ||||
Task<RestMessage> GetMessageAsync(ulong id, RequestOptions options = null); | Task<RestMessage> GetMessageAsync(ulong id, RequestOptions options = null); | ||||
@@ -1,4 +1,4 @@ | |||||
using System; | |||||
using System; | |||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Collections.Immutable; | using System.Collections.Immutable; | ||||
using System.Diagnostics; | using System.Diagnostics; | ||||
@@ -37,7 +37,7 @@ namespace Discord.Rest | |||||
public override async Task UpdateAsync(RequestOptions options = null) | public override async Task UpdateAsync(RequestOptions options = null) | ||||
{ | { | ||||
var model = await Discord.ApiClient.GetChannelAsync(Id, options).ConfigureAwait(false); | var model = await Discord.ApiClient.GetChannelAsync(Id, options).ConfigureAwait(false); | ||||
Update(model); | |||||
Update(model); | |||||
} | } | ||||
public Task CloseAsync(RequestOptions options = null) | public Task CloseAsync(RequestOptions options = null) | ||||
=> ChannelHelper.DeleteAsync(this, Discord, options); | => ChannelHelper.DeleteAsync(this, Discord, options); | ||||
@@ -66,11 +66,11 @@ namespace Discord.Rest | |||||
public Task<RestUserMessage> SendMessageAsync(string text, bool isTTS = false, Embed embed = null, RequestOptions options = null) | public Task<RestUserMessage> SendMessageAsync(string text, bool isTTS = false, Embed embed = null, RequestOptions options = null) | ||||
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, options); | => ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, options); | ||||
#if FILESYSTEM | #if FILESYSTEM | ||||
public Task<RestUserMessage> SendFileAsync(string filePath, string text, bool isTTS = false, RequestOptions options = null) | |||||
=> ChannelHelper.SendFileAsync(this, Discord, filePath, text, isTTS, options); | |||||
public Task<RestUserMessage> SendFileAsync(string filePath, string text, bool isTTS = false, Embed embed = null, RequestOptions options = null) | |||||
=> ChannelHelper.SendFileAsync(this, Discord, filePath, text, isTTS, embed, options); | |||||
#endif | #endif | ||||
public Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text, bool isTTS = false, RequestOptions options = null) | |||||
=> ChannelHelper.SendFileAsync(this, Discord, stream, filename, text, isTTS, options); | |||||
public Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text, bool isTTS = false, Embed embed = null, RequestOptions options = null) | |||||
=> ChannelHelper.SendFileAsync(this, Discord, stream, filename, text, isTTS, embed, options); | |||||
public Task TriggerTypingAsync(RequestOptions options = null) | public Task TriggerTypingAsync(RequestOptions options = null) | ||||
=> ChannelHelper.TriggerTypingAsync(this, Discord, options); | => ChannelHelper.TriggerTypingAsync(this, Discord, options); | ||||
@@ -122,11 +122,11 @@ namespace Discord.Rest | |||||
=> await GetPinnedMessagesAsync(options).ConfigureAwait(false); | => await GetPinnedMessagesAsync(options).ConfigureAwait(false); | ||||
#if FILESYSTEM | #if FILESYSTEM | ||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(string filePath, string text, bool isTTS, RequestOptions options) | |||||
=> await SendFileAsync(filePath, text, isTTS, options).ConfigureAwait(false); | |||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(string filePath, string text, bool isTTS, Embed embed, RequestOptions options) | |||||
=> await SendFileAsync(filePath, text, isTTS, embed, options).ConfigureAwait(false); | |||||
#endif | #endif | ||||
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.SendFileAsync(Stream stream, string filename, string text, bool isTTS, Embed embed, RequestOptions options) | |||||
=> await SendFileAsync(stream, filename, text, isTTS, embed, options).ConfigureAwait(false); | |||||
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, RequestOptions options) | async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, RequestOptions options) | ||||
=> await SendMessageAsync(text, isTTS, embed, options).ConfigureAwait(false); | => await SendMessageAsync(text, isTTS, embed, options).ConfigureAwait(false); | ||||
IDisposable IMessageChannel.EnterTypingState(RequestOptions options) | IDisposable IMessageChannel.EnterTypingState(RequestOptions options) | ||||
@@ -1,4 +1,4 @@ | |||||
using Discord.Audio; | |||||
using Discord.Audio; | |||||
using System; | using System; | ||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Collections.Immutable; | using System.Collections.Immutable; | ||||
@@ -19,7 +19,7 @@ namespace Discord.Rest | |||||
public string Name { get; private set; } | public string Name { get; private set; } | ||||
public IReadOnlyCollection<RestGroupUser> Users => _users.ToReadOnlyCollection(); | public IReadOnlyCollection<RestGroupUser> Users => _users.ToReadOnlyCollection(); | ||||
public IReadOnlyCollection<RestGroupUser> Recipients | |||||
public IReadOnlyCollection<RestGroupUser> Recipients | |||||
=> _users.Select(x => x.Value).Where(x => x.Id != Discord.CurrentUser.Id).ToReadOnlyCollection(() => _users.Count - 1); | => _users.Select(x => x.Value).Where(x => x.Id != Discord.CurrentUser.Id).ToReadOnlyCollection(() => _users.Count - 1); | ||||
internal RestGroupChannel(BaseDiscordClient discord, ulong id) | internal RestGroupChannel(BaseDiscordClient discord, ulong id) | ||||
@@ -79,11 +79,11 @@ namespace Discord.Rest | |||||
public Task<RestUserMessage> SendMessageAsync(string text, bool isTTS = false, Embed embed = null, RequestOptions options = null) | public Task<RestUserMessage> SendMessageAsync(string text, bool isTTS = false, Embed embed = null, RequestOptions options = null) | ||||
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, options); | => ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, options); | ||||
#if FILESYSTEM | #if FILESYSTEM | ||||
public Task<RestUserMessage> SendFileAsync(string filePath, string text, bool isTTS = false, RequestOptions options = null) | |||||
=> ChannelHelper.SendFileAsync(this, Discord, filePath, text, isTTS, options); | |||||
public Task<RestUserMessage> SendFileAsync(string filePath, string text, bool isTTS = false, Embed embed = null, RequestOptions options = null) | |||||
=> ChannelHelper.SendFileAsync(this, Discord, filePath, text, isTTS, embed, options); | |||||
#endif | #endif | ||||
public Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text, bool isTTS = false, RequestOptions options = null) | |||||
=> ChannelHelper.SendFileAsync(this, Discord, stream, filename, text, isTTS, options); | |||||
public Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text, bool isTTS = false, Embed embed = null, RequestOptions options = null) | |||||
=> ChannelHelper.SendFileAsync(this, Discord, stream, filename, text, isTTS, embed, options); | |||||
public Task TriggerTypingAsync(RequestOptions options = null) | public Task TriggerTypingAsync(RequestOptions options = null) | ||||
=> ChannelHelper.TriggerTypingAsync(this, Discord, options); | => ChannelHelper.TriggerTypingAsync(this, Discord, options); | ||||
@@ -132,11 +132,11 @@ namespace Discord.Rest | |||||
=> await GetPinnedMessagesAsync(options).ConfigureAwait(false); | => await GetPinnedMessagesAsync(options).ConfigureAwait(false); | ||||
#if FILESYSTEM | #if FILESYSTEM | ||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(string filePath, string text, bool isTTS, RequestOptions options) | |||||
=> await SendFileAsync(filePath, text, isTTS, options).ConfigureAwait(false); | |||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(string filePath, string text, bool isTTS, Embed embed, RequestOptions options) | |||||
=> await SendFileAsync(filePath, text, isTTS, embed, options).ConfigureAwait(false); | |||||
#endif | #endif | ||||
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.SendFileAsync(Stream stream, string filename, string text, bool isTTS, Embed embed, RequestOptions options) | |||||
=> await SendFileAsync(stream, filename, text, isTTS, embed, options).ConfigureAwait(false); | |||||
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, RequestOptions options) | async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, RequestOptions options) | ||||
=> await SendMessageAsync(text, isTTS, embed, options).ConfigureAwait(false); | => await SendMessageAsync(text, isTTS, embed, options).ConfigureAwait(false); | ||||
IDisposable IMessageChannel.EnterTypingState(RequestOptions options) | IDisposable IMessageChannel.EnterTypingState(RequestOptions options) | ||||
@@ -1,4 +1,4 @@ | |||||
using System; | |||||
using System; | |||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Diagnostics; | using System.Diagnostics; | ||||
using System.IO; | using System.IO; | ||||
@@ -61,11 +61,11 @@ namespace Discord.Rest | |||||
public Task<RestUserMessage> SendMessageAsync(string text, bool isTTS = false, Embed embed = null, RequestOptions options = null) | public Task<RestUserMessage> SendMessageAsync(string text, bool isTTS = false, Embed embed = null, RequestOptions options = null) | ||||
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, options); | => ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, options); | ||||
#if FILESYSTEM | #if FILESYSTEM | ||||
public Task<RestUserMessage> SendFileAsync(string filePath, string text, bool isTTS = false, RequestOptions options = null) | |||||
=> ChannelHelper.SendFileAsync(this, Discord, filePath, text, isTTS, options); | |||||
public Task<RestUserMessage> SendFileAsync(string filePath, string text, bool isTTS = false, Embed embed = null, RequestOptions options = null) | |||||
=> ChannelHelper.SendFileAsync(this, Discord, filePath, text, isTTS, embed, options); | |||||
#endif | #endif | ||||
public Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text, bool isTTS = false, RequestOptions options = null) | |||||
=> ChannelHelper.SendFileAsync(this, Discord, stream, filename, text, isTTS, options); | |||||
public Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text, bool isTTS = false, Embed embed = null, RequestOptions options = null) | |||||
=> ChannelHelper.SendFileAsync(this, Discord, stream, filename, text, isTTS, embed, options); | |||||
public Task DeleteMessagesAsync(IEnumerable<IMessage> messages, RequestOptions options = null) | public Task DeleteMessagesAsync(IEnumerable<IMessage> messages, RequestOptions options = null) | ||||
=> ChannelHelper.DeleteMessagesAsync(this, Discord, messages.Select(x => x.Id), options); | => ChannelHelper.DeleteMessagesAsync(this, Discord, messages.Select(x => x.Id), options); | ||||
@@ -123,18 +123,18 @@ namespace Discord.Rest | |||||
else | else | ||||
return AsyncEnumerable.Empty<IReadOnlyCollection<IMessage>>(); | return AsyncEnumerable.Empty<IReadOnlyCollection<IMessage>>(); | ||||
} | } | ||||
async Task<IReadOnlyCollection<IMessage>> IMessageChannel.GetPinnedMessagesAsync(RequestOptions options) | |||||
async Task<IReadOnlyCollection<IMessage>> IMessageChannel.GetPinnedMessagesAsync(RequestOptions options) | |||||
=> await GetPinnedMessagesAsync(options).ConfigureAwait(false); | => await GetPinnedMessagesAsync(options).ConfigureAwait(false); | ||||
#if FILESYSTEM | #if FILESYSTEM | ||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(string filePath, string text, bool isTTS, RequestOptions options) | |||||
=> await SendFileAsync(filePath, text, isTTS, options).ConfigureAwait(false); | |||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(string filePath, string text, bool isTTS, Embed embed, RequestOptions options) | |||||
=> await SendFileAsync(filePath, text, isTTS, embed, options).ConfigureAwait(false); | |||||
#endif | #endif | ||||
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, Embed embed, RequestOptions options) | |||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS, Embed embed, RequestOptions options) | |||||
=> await SendFileAsync(stream, filename, text, isTTS, embed, options).ConfigureAwait(false); | |||||
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, RequestOptions options) | |||||
=> await SendMessageAsync(text, isTTS, embed, options).ConfigureAwait(false); | => await SendMessageAsync(text, isTTS, embed, options).ConfigureAwait(false); | ||||
IDisposable IMessageChannel.EnterTypingState(RequestOptions options) | |||||
IDisposable IMessageChannel.EnterTypingState(RequestOptions options) | |||||
=> EnterTypingState(options); | => EnterTypingState(options); | ||||
//IGuildChannel | //IGuildChannel | ||||
@@ -1,4 +1,4 @@ | |||||
using System; | |||||
using System; | |||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Diagnostics; | using System.Diagnostics; | ||||
using System.IO; | using System.IO; | ||||
@@ -21,7 +21,7 @@ namespace Discord.Rest | |||||
{ | { | ||||
return new RestVirtualMessageChannel(discord, id); | return new RestVirtualMessageChannel(discord, id); | ||||
} | } | ||||
public Task<RestMessage> GetMessageAsync(ulong id, RequestOptions options = null) | public Task<RestMessage> GetMessageAsync(ulong id, RequestOptions options = null) | ||||
=> ChannelHelper.GetMessageAsync(this, Discord, id, options); | => ChannelHelper.GetMessageAsync(this, Discord, id, options); | ||||
public IAsyncEnumerable<IReadOnlyCollection<RestMessage>> GetMessagesAsync(int limit = DiscordConfig.MaxMessagesPerBatch, RequestOptions options = null) | public IAsyncEnumerable<IReadOnlyCollection<RestMessage>> GetMessagesAsync(int limit = DiscordConfig.MaxMessagesPerBatch, RequestOptions options = null) | ||||
@@ -36,11 +36,11 @@ namespace Discord.Rest | |||||
public Task<RestUserMessage> SendMessageAsync(string text, bool isTTS, Embed embed = null, RequestOptions options = null) | public Task<RestUserMessage> SendMessageAsync(string text, bool isTTS, Embed embed = null, RequestOptions options = null) | ||||
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, options); | => ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, options); | ||||
#if FILESYSTEM | #if FILESYSTEM | ||||
public Task<RestUserMessage> SendFileAsync(string filePath, string text, bool isTTS, RequestOptions options = null) | |||||
=> ChannelHelper.SendFileAsync(this, Discord, filePath, text, isTTS, options); | |||||
public Task<RestUserMessage> SendFileAsync(string filePath, string text, bool isTTS, Embed embed = null, RequestOptions options = null) | |||||
=> ChannelHelper.SendFileAsync(this, Discord, filePath, text, isTTS, embed, options); | |||||
#endif | #endif | ||||
public Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text, bool isTTS, RequestOptions options = null) | |||||
=> ChannelHelper.SendFileAsync(this, Discord, stream, filename, text, isTTS, options); | |||||
public Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text, bool isTTS, Embed embed = null, RequestOptions options = null) | |||||
=> ChannelHelper.SendFileAsync(this, Discord, stream, filename, text, isTTS, embed, options); | |||||
public Task TriggerTypingAsync(RequestOptions options = null) | public Task TriggerTypingAsync(RequestOptions options = null) | ||||
=> ChannelHelper.TriggerTypingAsync(this, Discord, options); | => ChannelHelper.TriggerTypingAsync(this, Discord, options); | ||||
@@ -82,11 +82,11 @@ namespace Discord.Rest | |||||
=> await GetPinnedMessagesAsync(options); | => await GetPinnedMessagesAsync(options); | ||||
#if FILESYSTEM | #if FILESYSTEM | ||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(string filePath, string text, bool isTTS, RequestOptions options) | |||||
=> await SendFileAsync(filePath, text, isTTS, options); | |||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(string filePath, string text, bool isTTS, Embed embed, RequestOptions options) | |||||
=> await SendFileAsync(filePath, text, isTTS, embed, options); | |||||
#endif | #endif | ||||
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.SendFileAsync(Stream stream, string filename, string text, bool isTTS, Embed embed, RequestOptions options) | |||||
=> await SendFileAsync(stream, filename, text, isTTS, embed, options); | |||||
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, RequestOptions options) | async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, RequestOptions options) | ||||
=> await SendMessageAsync(text, isTTS, embed, options); | => await SendMessageAsync(text, isTTS, embed, options); | ||||
IDisposable IMessageChannel.EnterTypingState(RequestOptions options) | IDisposable IMessageChannel.EnterTypingState(RequestOptions options) | ||||
@@ -1,4 +1,5 @@ | |||||
using Newtonsoft.Json; | |||||
using Discord.Net.Converters; | |||||
using Newtonsoft.Json; | |||||
using System; | using System; | ||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Globalization; | using System.Globalization; | ||||
@@ -1,4 +1,4 @@ | |||||
using Discord.Rest; | |||||
using Discord.Rest; | |||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.IO; | using System.IO; | ||||
using System.Threading.Tasks; | using System.Threading.Tasks; | ||||
@@ -14,10 +14,10 @@ namespace Discord.WebSocket | |||||
new Task<RestUserMessage> SendMessageAsync(string text, bool isTTS = false, Embed embed = null, RequestOptions options = null); | new Task<RestUserMessage> SendMessageAsync(string text, bool isTTS = false, Embed embed = null, RequestOptions options = null); | ||||
#if FILESYSTEM | #if FILESYSTEM | ||||
/// <summary> Sends a file to this text channel, with an optional caption. </summary> | /// <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); | |||||
new Task<RestUserMessage> SendFileAsync(string filePath, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null); | |||||
#endif | #endif | ||||
/// <summary> Sends a file to this text channel, with an optional caption. </summary> | /// <summary> Sends a file to this text channel, with an optional caption. </summary> | ||||
new Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text = null, bool isTTS = false, RequestOptions options = null); | |||||
new Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null); | |||||
SocketMessage GetCachedMessage(ulong id); | SocketMessage GetCachedMessage(ulong id); | ||||
/// <summary> Gets the last N messages from this message channel. </summary> | /// <summary> Gets the last N messages from this message channel. </summary> | ||||
@@ -1,4 +1,4 @@ | |||||
using Discord.Rest; | |||||
using Discord.Rest; | |||||
using System; | using System; | ||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Collections.Immutable; | using System.Collections.Immutable; | ||||
@@ -70,11 +70,11 @@ namespace Discord.WebSocket | |||||
public Task<RestUserMessage> SendMessageAsync(string text, bool isTTS = false, Embed embed = null, RequestOptions options = null) | public Task<RestUserMessage> SendMessageAsync(string text, bool isTTS = false, Embed embed = null, RequestOptions options = null) | ||||
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, options); | => ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, options); | ||||
#if FILESYSTEM | #if FILESYSTEM | ||||
public Task<RestUserMessage> SendFileAsync(string filePath, string text, bool isTTS = false, RequestOptions options = null) | |||||
=> ChannelHelper.SendFileAsync(this, Discord, filePath, text, isTTS, options); | |||||
public Task<RestUserMessage> SendFileAsync(string filePath, string text, bool isTTS = false, Embed embed = null, RequestOptions options = null) | |||||
=> ChannelHelper.SendFileAsync(this, Discord, filePath, text, isTTS, embed, options); | |||||
#endif | #endif | ||||
public Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text, bool isTTS = false, RequestOptions options = null) | |||||
=> ChannelHelper.SendFileAsync(this, Discord, stream, filename, text, isTTS, options); | |||||
public Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text, bool isTTS = false, Embed embed = null, RequestOptions options = null) | |||||
=> ChannelHelper.SendFileAsync(this, Discord, stream, filename, text, isTTS, embed, options); | |||||
public Task TriggerTypingAsync(RequestOptions options = null) | public Task TriggerTypingAsync(RequestOptions options = null) | ||||
=> ChannelHelper.TriggerTypingAsync(this, Discord, options); | => ChannelHelper.TriggerTypingAsync(this, Discord, options); | ||||
@@ -113,7 +113,7 @@ namespace Discord.WebSocket | |||||
//IPrivateChannel | //IPrivateChannel | ||||
IReadOnlyCollection<IUser> IPrivateChannel.Recipients => ImmutableArray.Create<IUser>(Recipient); | IReadOnlyCollection<IUser> IPrivateChannel.Recipients => ImmutableArray.Create<IUser>(Recipient); | ||||
//IMessageChannel | //IMessageChannel | ||||
async Task<IMessage> IMessageChannel.GetMessageAsync(ulong id, CacheMode mode, RequestOptions options) | async Task<IMessage> IMessageChannel.GetMessageAsync(ulong id, CacheMode mode, RequestOptions options) | ||||
{ | { | ||||
@@ -131,11 +131,11 @@ namespace Discord.WebSocket | |||||
async Task<IReadOnlyCollection<IMessage>> IMessageChannel.GetPinnedMessagesAsync(RequestOptions options) | async Task<IReadOnlyCollection<IMessage>> IMessageChannel.GetPinnedMessagesAsync(RequestOptions options) | ||||
=> await GetPinnedMessagesAsync(options).ConfigureAwait(false); | => await GetPinnedMessagesAsync(options).ConfigureAwait(false); | ||||
#if FILESYSTEM | #if FILESYSTEM | ||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(string filePath, string text, bool isTTS, RequestOptions options) | |||||
=> await SendFileAsync(filePath, text, isTTS, options).ConfigureAwait(false); | |||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(string filePath, string text, bool isTTS, Embed embed, RequestOptions options) | |||||
=> await SendFileAsync(filePath, text, isTTS, embed, options).ConfigureAwait(false); | |||||
#endif | #endif | ||||
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.SendFileAsync(Stream stream, string filename, string text, bool isTTS, Embed embed, RequestOptions options) | |||||
=> await SendFileAsync(stream, filename, text, isTTS, embed, options).ConfigureAwait(false); | |||||
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, RequestOptions options) | async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, RequestOptions options) | ||||
=> await SendMessageAsync(text, isTTS, embed, options).ConfigureAwait(false); | => await SendMessageAsync(text, isTTS, embed, options).ConfigureAwait(false); | ||||
IDisposable IMessageChannel.EnterTypingState(RequestOptions options) | IDisposable IMessageChannel.EnterTypingState(RequestOptions options) | ||||
@@ -1,4 +1,4 @@ | |||||
using Discord.Audio; | |||||
using Discord.Audio; | |||||
using Discord.Rest; | using Discord.Rest; | ||||
using System; | using System; | ||||
using System.Collections.Concurrent; | using System.Collections.Concurrent; | ||||
@@ -61,7 +61,7 @@ namespace Discord.WebSocket | |||||
users[models[i].Id] = SocketGroupUser.Create(this, state, models[i]); | users[models[i].Id] = SocketGroupUser.Create(this, state, models[i]); | ||||
_users = users; | _users = users; | ||||
} | } | ||||
public Task LeaveAsync(RequestOptions options = null) | public Task LeaveAsync(RequestOptions options = null) | ||||
=> ChannelHelper.DeleteAsync(this, Discord, options); | => ChannelHelper.DeleteAsync(this, Discord, options); | ||||
@@ -98,11 +98,11 @@ namespace Discord.WebSocket | |||||
public Task<RestUserMessage> SendMessageAsync(string text, bool isTTS = false, Embed embed = null, RequestOptions options = null) | public Task<RestUserMessage> SendMessageAsync(string text, bool isTTS = false, Embed embed = null, RequestOptions options = null) | ||||
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, options); | => ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, options); | ||||
#if FILESYSTEM | #if FILESYSTEM | ||||
public Task<RestUserMessage> SendFileAsync(string filePath, string text, bool isTTS = false, RequestOptions options = null) | |||||
=> ChannelHelper.SendFileAsync(this, Discord, filePath, text, isTTS, options); | |||||
public Task<RestUserMessage> SendFileAsync(string filePath, string text, bool isTTS = false, Embed embed = null, RequestOptions options = null) | |||||
=> ChannelHelper.SendFileAsync(this, Discord, filePath, text, isTTS, embed, options); | |||||
#endif | #endif | ||||
public Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text, bool isTTS = false, RequestOptions options = null) | |||||
=> ChannelHelper.SendFileAsync(this, Discord, stream, filename, text, isTTS, options); | |||||
public Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text, bool isTTS = false, Embed embed = null, RequestOptions options = null) | |||||
=> ChannelHelper.SendFileAsync(this, Discord, stream, filename, text, isTTS, embed, options); | |||||
public Task TriggerTypingAsync(RequestOptions options = null) | public Task TriggerTypingAsync(RequestOptions options = null) | ||||
=> ChannelHelper.TriggerTypingAsync(this, Discord, options); | => ChannelHelper.TriggerTypingAsync(this, Discord, options); | ||||
@@ -195,11 +195,11 @@ namespace Discord.WebSocket | |||||
async Task<IReadOnlyCollection<IMessage>> IMessageChannel.GetPinnedMessagesAsync(RequestOptions options) | async Task<IReadOnlyCollection<IMessage>> IMessageChannel.GetPinnedMessagesAsync(RequestOptions options) | ||||
=> await GetPinnedMessagesAsync(options).ConfigureAwait(false); | => await GetPinnedMessagesAsync(options).ConfigureAwait(false); | ||||
#if FILESYSTEM | #if FILESYSTEM | ||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(string filePath, string text, bool isTTS, RequestOptions options) | |||||
=> await SendFileAsync(filePath, text, isTTS, options).ConfigureAwait(false); | |||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(string filePath, string text, bool isTTS, Embed embed, RequestOptions options) | |||||
=> await SendFileAsync(filePath, text, isTTS, embed, options).ConfigureAwait(false); | |||||
#endif | #endif | ||||
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.SendFileAsync(Stream stream, string filename, string text, bool isTTS, Embed embed, RequestOptions options) | |||||
=> await SendFileAsync(stream, filename, text, isTTS, embed, options).ConfigureAwait(false); | |||||
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, RequestOptions options) | async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, RequestOptions options) | ||||
=> await SendMessageAsync(text, isTTS, embed, options).ConfigureAwait(false); | => await SendMessageAsync(text, isTTS, embed, options).ConfigureAwait(false); | ||||
IDisposable IMessageChannel.EnterTypingState(RequestOptions options) | IDisposable IMessageChannel.EnterTypingState(RequestOptions options) | ||||
@@ -1,4 +1,4 @@ | |||||
using Discord.Rest; | |||||
using Discord.Rest; | |||||
using System; | using System; | ||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Collections.Immutable; | using System.Collections.Immutable; | ||||
@@ -16,7 +16,7 @@ namespace Discord.WebSocket | |||||
private readonly MessageCache _messages; | private readonly MessageCache _messages; | ||||
public string Topic { get; private set; } | public string Topic { get; private set; } | ||||
private bool _nsfw; | private bool _nsfw; | ||||
public bool IsNsfw => _nsfw || ChannelHelper.IsNsfw(this); | public bool IsNsfw => _nsfw || ChannelHelper.IsNsfw(this); | ||||
@@ -24,9 +24,9 @@ namespace Discord.WebSocket | |||||
public IReadOnlyCollection<SocketMessage> CachedMessages => _messages?.Messages ?? ImmutableArray.Create<SocketMessage>(); | public IReadOnlyCollection<SocketMessage> CachedMessages => _messages?.Messages ?? ImmutableArray.Create<SocketMessage>(); | ||||
public override IReadOnlyCollection<SocketGuildUser> Users | public override IReadOnlyCollection<SocketGuildUser> Users | ||||
=> Guild.Users.Where(x => Permissions.GetValue( | => Guild.Users.Where(x => Permissions.GetValue( | ||||
Permissions.ResolveChannel(Guild, x, this, Permissions.ResolveGuild(Guild, x)), | |||||
Permissions.ResolveChannel(Guild, x, this, Permissions.ResolveGuild(Guild, x)), | |||||
ChannelPermission.ViewChannel)).ToImmutableArray(); | ChannelPermission.ViewChannel)).ToImmutableArray(); | ||||
internal SocketTextChannel(DiscordSocketClient discord, ulong id, SocketGuild guild) | internal SocketTextChannel(DiscordSocketClient discord, ulong id, SocketGuild guild) | ||||
: base(discord, id, guild) | : base(discord, id, guild) | ||||
{ | { | ||||
@@ -78,11 +78,11 @@ namespace Discord.WebSocket | |||||
public Task<RestUserMessage> SendMessageAsync(string text, bool isTTS = false, Embed embed = null, RequestOptions options = null) | public Task<RestUserMessage> SendMessageAsync(string text, bool isTTS = false, Embed embed = null, RequestOptions options = null) | ||||
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, options); | => ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, options); | ||||
#if FILESYSTEM | #if FILESYSTEM | ||||
public Task<RestUserMessage> SendFileAsync(string filePath, string text, bool isTTS = false, RequestOptions options = null) | |||||
=> ChannelHelper.SendFileAsync(this, Discord, filePath, text, isTTS, options); | |||||
public Task<RestUserMessage> SendFileAsync(string filePath, string text, bool isTTS = false, Embed embed = null, RequestOptions options = null) | |||||
=> ChannelHelper.SendFileAsync(this, Discord, filePath, text, isTTS, embed, options); | |||||
#endif | #endif | ||||
public Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text, bool isTTS = false, RequestOptions options = null) | |||||
=> ChannelHelper.SendFileAsync(this, Discord, stream, filename, text, isTTS, options); | |||||
public Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text, bool isTTS = false, Embed embed = null, RequestOptions options = null) | |||||
=> ChannelHelper.SendFileAsync(this, Discord, stream, filename, text, isTTS, embed, options); | |||||
public Task DeleteMessagesAsync(IEnumerable<IMessage> messages, RequestOptions options = null) | public Task DeleteMessagesAsync(IEnumerable<IMessage> messages, RequestOptions options = null) | ||||
=> ChannelHelper.DeleteMessagesAsync(this, Discord, messages.Select(x => x.Id), options); | => ChannelHelper.DeleteMessagesAsync(this, Discord, messages.Select(x => x.Id), options); | ||||
@@ -155,14 +155,14 @@ namespace Discord.WebSocket | |||||
async Task<IReadOnlyCollection<IMessage>> IMessageChannel.GetPinnedMessagesAsync(RequestOptions options) | async Task<IReadOnlyCollection<IMessage>> IMessageChannel.GetPinnedMessagesAsync(RequestOptions options) | ||||
=> await GetPinnedMessagesAsync(options).ConfigureAwait(false); | => await GetPinnedMessagesAsync(options).ConfigureAwait(false); | ||||
#if FILESYSTEM | #if FILESYSTEM | ||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(string filePath, string text, bool isTTS, RequestOptions options) | |||||
=> await SendFileAsync(filePath, text, isTTS, options).ConfigureAwait(false); | |||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(string filePath, string text, bool isTTS, Embed embed, RequestOptions options) | |||||
=> await SendFileAsync(filePath, text, isTTS, embed, options).ConfigureAwait(false); | |||||
#endif | #endif | ||||
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.SendFileAsync(Stream stream, string filename, string text, bool isTTS, Embed embed, RequestOptions options) | |||||
=> await SendFileAsync(stream, filename, text, isTTS, embed, options).ConfigureAwait(false); | |||||
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, RequestOptions options) | async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, RequestOptions options) | ||||
=> await SendMessageAsync(text, isTTS, embed, options).ConfigureAwait(false); | => await SendMessageAsync(text, isTTS, embed, options).ConfigureAwait(false); | ||||
IDisposable IMessageChannel.EnterTypingState(RequestOptions options) | IDisposable IMessageChannel.EnterTypingState(RequestOptions options) | ||||
=> EnterTypingState(options); | => EnterTypingState(options); | ||||
} | } | ||||
} | |||||
} |