Exposed RequestOptions
This commit is contained in:
@@ -11,11 +11,11 @@ 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);
|
||||
new Task<RestUserMessage> SendMessageAsync(string text, bool isTTS = false, 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);
|
||||
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>
|
||||
new Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text = null, bool isTTS = false);
|
||||
new Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text = null, bool isTTS = false, RequestOptions options = null);
|
||||
|
||||
SocketMessage GetCachedMessage(ulong id);
|
||||
/// <summary> Gets the last N messages from this message channel. </summary>
|
||||
@@ -25,6 +25,6 @@ namespace Discord.WebSocket
|
||||
/// <summary> Gets a collection of messages in this channel. </summary>
|
||||
IReadOnlyCollection<SocketMessage> GetCachedMessages(IMessage fromMessage, Direction dir, int limit = DiscordConfig.MaxMessagesPerBatch);
|
||||
/// <summary> Gets a collection of pinned messages in this channel. </summary>
|
||||
new Task<IReadOnlyCollection<RestMessage>> GetPinnedMessagesAsync();
|
||||
new Task<IReadOnlyCollection<RestMessage>> GetPinnedMessagesAsync(RequestOptions options = null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,9 +39,9 @@ namespace Discord.WebSocket
|
||||
internal SocketChannel Clone() => MemberwiseClone() as SocketChannel;
|
||||
|
||||
//IChannel
|
||||
Task<IUser> IChannel.GetUserAsync(ulong id, CacheMode mode)
|
||||
Task<IUser> IChannel.GetUserAsync(ulong id, CacheMode mode, RequestOptions options)
|
||||
=> Task.FromResult<IUser>(null); //Overridden
|
||||
IAsyncEnumerable<IReadOnlyCollection<IUser>> IChannel.GetUsersAsync(CacheMode mode)
|
||||
IAsyncEnumerable<IReadOnlyCollection<IUser>> IChannel.GetUsersAsync(CacheMode mode, RequestOptions options)
|
||||
=> AsyncEnumerable.Empty<IReadOnlyCollection<IUser>>(); //Overridden
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace Discord.WebSocket
|
||||
internal static class SocketChannelHelper
|
||||
{
|
||||
public static IAsyncEnumerable<IReadOnlyCollection<IMessage>> GetMessagesAsync(SocketChannel channel, DiscordSocketClient discord, MessageCache messages,
|
||||
ulong? fromMessageId, Direction dir, int limit, CacheMode mode)
|
||||
ulong? fromMessageId, Direction dir, int limit, CacheMode mode, RequestOptions options)
|
||||
{
|
||||
IReadOnlyCollection<SocketMessage> cachedMessages;
|
||||
IAsyncEnumerable<IReadOnlyCollection<IMessage>> result;
|
||||
@@ -28,7 +28,7 @@ namespace Discord.WebSocket
|
||||
fromMessageId = cachedMessages.Min(x => x.Id);
|
||||
else
|
||||
fromMessageId = cachedMessages.Max(x => x.Id);
|
||||
var downloadedMessages = ChannelHelper.GetMessagesAsync(channel, discord, fromMessageId, dir, limit);
|
||||
var downloadedMessages = ChannelHelper.GetMessagesAsync(channel, discord, fromMessageId, dir, limit, options);
|
||||
return result.Concat(downloadedMessages);
|
||||
}
|
||||
public static IReadOnlyCollection<SocketMessage> GetCachedMessages(SocketChannel channel, DiscordSocketClient discord, MessageCache messages,
|
||||
|
||||
@@ -38,46 +38,46 @@ namespace Discord.WebSocket
|
||||
Recipient.Update(state, model.Recipients.Value[0]);
|
||||
}
|
||||
|
||||
public Task CloseAsync()
|
||||
=> ChannelHelper.DeleteAsync(this, Discord);
|
||||
public Task CloseAsync(RequestOptions options = null)
|
||||
=> ChannelHelper.DeleteAsync(this, Discord, options);
|
||||
|
||||
//Messages
|
||||
public SocketMessage GetCachedMessage(ulong id)
|
||||
=> _messages?.Get(id);
|
||||
public async Task<IMessage> GetMessageAsync(ulong id)
|
||||
public async Task<IMessage> GetMessageAsync(ulong id, RequestOptions options = null)
|
||||
{
|
||||
IMessage msg = _messages?.Get(id);
|
||||
if (msg == null)
|
||||
msg = await ChannelHelper.GetMessageAsync(this, Discord, id);
|
||||
msg = await ChannelHelper.GetMessageAsync(this, Discord, id, options);
|
||||
return msg;
|
||||
}
|
||||
public IAsyncEnumerable<IReadOnlyCollection<IMessage>> GetMessagesAsync(int limit = DiscordConfig.MaxMessagesPerBatch)
|
||||
=> SocketChannelHelper.GetMessagesAsync(this, Discord, _messages, null, Direction.Before, limit, CacheMode.AllowDownload);
|
||||
public IAsyncEnumerable<IReadOnlyCollection<IMessage>> GetMessagesAsync(ulong fromMessageId, Direction dir, int limit = DiscordConfig.MaxMessagesPerBatch)
|
||||
=> SocketChannelHelper.GetMessagesAsync(this, Discord, _messages, fromMessageId, dir, limit, CacheMode.AllowDownload);
|
||||
public IAsyncEnumerable<IReadOnlyCollection<IMessage>> GetMessagesAsync(IMessage fromMessage, Direction dir, int limit = DiscordConfig.MaxMessagesPerBatch)
|
||||
=> SocketChannelHelper.GetMessagesAsync(this, Discord, _messages, fromMessage.Id, dir, limit, CacheMode.AllowDownload);
|
||||
public IAsyncEnumerable<IReadOnlyCollection<IMessage>> GetMessagesAsync(int limit = DiscordConfig.MaxMessagesPerBatch, RequestOptions options = null)
|
||||
=> SocketChannelHelper.GetMessagesAsync(this, Discord, _messages, null, Direction.Before, limit, CacheMode.AllowDownload, options);
|
||||
public IAsyncEnumerable<IReadOnlyCollection<IMessage>> GetMessagesAsync(ulong fromMessageId, Direction dir, int limit = DiscordConfig.MaxMessagesPerBatch, RequestOptions options = null)
|
||||
=> SocketChannelHelper.GetMessagesAsync(this, Discord, _messages, fromMessageId, dir, limit, CacheMode.AllowDownload, options);
|
||||
public IAsyncEnumerable<IReadOnlyCollection<IMessage>> GetMessagesAsync(IMessage fromMessage, Direction dir, int limit = DiscordConfig.MaxMessagesPerBatch, RequestOptions options = null)
|
||||
=> SocketChannelHelper.GetMessagesAsync(this, Discord, _messages, fromMessage.Id, dir, limit, CacheMode.AllowDownload, options);
|
||||
public IReadOnlyCollection<SocketMessage> GetCachedMessages(int limit = DiscordConfig.MaxMessagesPerBatch)
|
||||
=> SocketChannelHelper.GetCachedMessages(this, Discord, _messages, null, Direction.Before, limit);
|
||||
public IReadOnlyCollection<SocketMessage> GetCachedMessages(ulong fromMessageId, Direction dir, int limit = DiscordConfig.MaxMessagesPerBatch)
|
||||
=> SocketChannelHelper.GetCachedMessages(this, Discord, _messages, fromMessageId, dir, limit);
|
||||
public IReadOnlyCollection<SocketMessage> GetCachedMessages(IMessage fromMessage, Direction dir, int limit = DiscordConfig.MaxMessagesPerBatch)
|
||||
=> SocketChannelHelper.GetCachedMessages(this, Discord, _messages, fromMessage.Id, dir, limit);
|
||||
public Task<IReadOnlyCollection<RestMessage>> GetPinnedMessagesAsync()
|
||||
=> ChannelHelper.GetPinnedMessagesAsync(this, Discord);
|
||||
public Task<IReadOnlyCollection<RestMessage>> GetPinnedMessagesAsync(RequestOptions options = null)
|
||||
=> ChannelHelper.GetPinnedMessagesAsync(this, Discord, options);
|
||||
|
||||
public Task<RestUserMessage> SendMessageAsync(string text, bool isTTS)
|
||||
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS);
|
||||
public Task<RestUserMessage> SendFileAsync(string filePath, string text, bool isTTS)
|
||||
=> ChannelHelper.SendFileAsync(this, Discord, filePath, text, isTTS);
|
||||
public Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text, bool isTTS)
|
||||
=> ChannelHelper.SendFileAsync(this, Discord, stream, filename, text, isTTS);
|
||||
public Task<RestUserMessage> SendMessageAsync(string text, bool isTTS, RequestOptions options = null)
|
||||
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, options);
|
||||
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(Stream stream, string filename, string text, bool isTTS, RequestOptions options = null)
|
||||
=> ChannelHelper.SendFileAsync(this, Discord, stream, filename, text, isTTS, options);
|
||||
|
||||
public Task DeleteMessagesAsync(IEnumerable<IMessage> messages)
|
||||
=> ChannelHelper.DeleteMessagesAsync(this, Discord, messages);
|
||||
public Task DeleteMessagesAsync(IEnumerable<IMessage> messages, RequestOptions options = null)
|
||||
=> ChannelHelper.DeleteMessagesAsync(this, Discord, messages, options);
|
||||
|
||||
public IDisposable EnterTypingState()
|
||||
=> ChannelHelper.EnterTypingState(this, Discord);
|
||||
public IDisposable EnterTypingState(RequestOptions options = null)
|
||||
=> ChannelHelper.EnterTypingState(this, Discord, options);
|
||||
|
||||
internal void AddMessage(SocketMessage msg)
|
||||
=> _messages.Add(msg);
|
||||
@@ -111,36 +111,36 @@ namespace Discord.WebSocket
|
||||
|
||||
//IPrivateChannel
|
||||
IReadOnlyCollection<IUser> IPrivateChannel.Recipients => ImmutableArray.Create<IUser>(Recipient);
|
||||
|
||||
|
||||
//IMessageChannel
|
||||
async Task<IMessage> IMessageChannel.GetMessageAsync(ulong id, CacheMode mode)
|
||||
async Task<IMessage> IMessageChannel.GetMessageAsync(ulong id, CacheMode mode, RequestOptions options)
|
||||
{
|
||||
if (mode == CacheMode.AllowDownload)
|
||||
return await GetMessageAsync(id);
|
||||
return await GetMessageAsync(id, options);
|
||||
else
|
||||
return GetCachedMessage(id);
|
||||
}
|
||||
IAsyncEnumerable<IReadOnlyCollection<IMessage>> IMessageChannel.GetMessagesAsync(int limit, CacheMode mode)
|
||||
=> SocketChannelHelper.GetMessagesAsync(this, Discord, _messages, null, Direction.Before, limit, mode);
|
||||
IAsyncEnumerable<IReadOnlyCollection<IMessage>> IMessageChannel.GetMessagesAsync(ulong fromMessageId, Direction dir, int limit, CacheMode mode)
|
||||
=> SocketChannelHelper.GetMessagesAsync(this, Discord, _messages, fromMessageId, dir, limit, mode);
|
||||
IAsyncEnumerable<IReadOnlyCollection<IMessage>> IMessageChannel.GetMessagesAsync(IMessage fromMessage, Direction dir, int limit, CacheMode mode)
|
||||
=> SocketChannelHelper.GetMessagesAsync(this, Discord, _messages, fromMessage.Id, dir, limit, mode);
|
||||
async Task<IReadOnlyCollection<IMessage>> IMessageChannel.GetPinnedMessagesAsync()
|
||||
=> await GetPinnedMessagesAsync().ConfigureAwait(false);
|
||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(string filePath, string text, bool isTTS)
|
||||
=> await SendFileAsync(filePath, text, isTTS);
|
||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS)
|
||||
=> await SendFileAsync(stream, filename, text, isTTS);
|
||||
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS)
|
||||
=> await SendMessageAsync(text, isTTS);
|
||||
IDisposable IMessageChannel.EnterTypingState()
|
||||
=> EnterTypingState();
|
||||
IAsyncEnumerable<IReadOnlyCollection<IMessage>> IMessageChannel.GetMessagesAsync(int limit, CacheMode mode, RequestOptions options)
|
||||
=> SocketChannelHelper.GetMessagesAsync(this, Discord, _messages, null, Direction.Before, limit, mode, options);
|
||||
IAsyncEnumerable<IReadOnlyCollection<IMessage>> IMessageChannel.GetMessagesAsync(ulong fromMessageId, Direction dir, int limit, CacheMode mode, RequestOptions options)
|
||||
=> SocketChannelHelper.GetMessagesAsync(this, Discord, _messages, fromMessageId, dir, limit, mode, options);
|
||||
IAsyncEnumerable<IReadOnlyCollection<IMessage>> IMessageChannel.GetMessagesAsync(IMessage fromMessage, Direction dir, int limit, CacheMode mode, RequestOptions options)
|
||||
=> SocketChannelHelper.GetMessagesAsync(this, Discord, _messages, fromMessage.Id, dir, limit, mode, options);
|
||||
async Task<IReadOnlyCollection<IMessage>> IMessageChannel.GetPinnedMessagesAsync(RequestOptions options)
|
||||
=> await GetPinnedMessagesAsync(options).ConfigureAwait(false);
|
||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(string filePath, string text, bool isTTS, RequestOptions options)
|
||||
=> 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);
|
||||
IDisposable IMessageChannel.EnterTypingState(RequestOptions options)
|
||||
=> EnterTypingState(options);
|
||||
|
||||
//IChannel
|
||||
Task<IUser> IChannel.GetUserAsync(ulong id, CacheMode mode)
|
||||
Task<IUser> IChannel.GetUserAsync(ulong id, CacheMode mode, RequestOptions options)
|
||||
=> Task.FromResult<IUser>(GetUser(id));
|
||||
IAsyncEnumerable<IReadOnlyCollection<IUser>> IChannel.GetUsersAsync(CacheMode mode)
|
||||
IAsyncEnumerable<IReadOnlyCollection<IUser>> IChannel.GetUsersAsync(CacheMode mode, RequestOptions options)
|
||||
=> ImmutableArray.Create<IReadOnlyCollection<IUser>>(Users).ToAsyncEnumerable();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,46 +61,46 @@ namespace Discord.WebSocket
|
||||
_users = users;
|
||||
}
|
||||
|
||||
public Task LeaveAsync()
|
||||
=> ChannelHelper.DeleteAsync(this, Discord);
|
||||
public Task LeaveAsync(RequestOptions options = null)
|
||||
=> ChannelHelper.DeleteAsync(this, Discord, options);
|
||||
|
||||
//Messages
|
||||
public SocketMessage GetCachedMessage(ulong id)
|
||||
=> _messages?.Get(id);
|
||||
public async Task<IMessage> GetMessageAsync(ulong id)
|
||||
public async Task<IMessage> GetMessageAsync(ulong id, RequestOptions options = null)
|
||||
{
|
||||
IMessage msg = _messages?.Get(id);
|
||||
if (msg == null)
|
||||
msg = await ChannelHelper.GetMessageAsync(this, Discord, id);
|
||||
msg = await ChannelHelper.GetMessageAsync(this, Discord, id, options);
|
||||
return msg;
|
||||
}
|
||||
public IAsyncEnumerable<IReadOnlyCollection<IMessage>> GetMessagesAsync(int limit = DiscordConfig.MaxMessagesPerBatch)
|
||||
=> SocketChannelHelper.GetMessagesAsync(this, Discord, _messages, null, Direction.Before, limit, CacheMode.AllowDownload);
|
||||
public IAsyncEnumerable<IReadOnlyCollection<IMessage>> GetMessagesAsync(ulong fromMessageId, Direction dir, int limit = DiscordConfig.MaxMessagesPerBatch)
|
||||
=> SocketChannelHelper.GetMessagesAsync(this, Discord, _messages, fromMessageId, dir, limit, CacheMode.AllowDownload);
|
||||
public IAsyncEnumerable<IReadOnlyCollection<IMessage>> GetMessagesAsync(IMessage fromMessage, Direction dir, int limit = DiscordConfig.MaxMessagesPerBatch)
|
||||
=> SocketChannelHelper.GetMessagesAsync(this, Discord, _messages, fromMessage.Id, dir, limit, CacheMode.AllowDownload);
|
||||
public IAsyncEnumerable<IReadOnlyCollection<IMessage>> GetMessagesAsync(int limit = DiscordConfig.MaxMessagesPerBatch, RequestOptions options = null)
|
||||
=> SocketChannelHelper.GetMessagesAsync(this, Discord, _messages, null, Direction.Before, limit, CacheMode.AllowDownload, options);
|
||||
public IAsyncEnumerable<IReadOnlyCollection<IMessage>> GetMessagesAsync(ulong fromMessageId, Direction dir, int limit = DiscordConfig.MaxMessagesPerBatch, RequestOptions options = null)
|
||||
=> SocketChannelHelper.GetMessagesAsync(this, Discord, _messages, fromMessageId, dir, limit, CacheMode.AllowDownload, options);
|
||||
public IAsyncEnumerable<IReadOnlyCollection<IMessage>> GetMessagesAsync(IMessage fromMessage, Direction dir, int limit = DiscordConfig.MaxMessagesPerBatch, RequestOptions options = null)
|
||||
=> SocketChannelHelper.GetMessagesAsync(this, Discord, _messages, fromMessage.Id, dir, limit, CacheMode.AllowDownload, options);
|
||||
public IReadOnlyCollection<SocketMessage> GetCachedMessages(int limit = DiscordConfig.MaxMessagesPerBatch)
|
||||
=> SocketChannelHelper.GetCachedMessages(this, Discord, _messages, null, Direction.Before, limit);
|
||||
public IReadOnlyCollection<SocketMessage> GetCachedMessages(ulong fromMessageId, Direction dir, int limit = DiscordConfig.MaxMessagesPerBatch)
|
||||
=> SocketChannelHelper.GetCachedMessages(this, Discord, _messages, fromMessageId, dir, limit);
|
||||
public IReadOnlyCollection<SocketMessage> GetCachedMessages(IMessage fromMessage, Direction dir, int limit = DiscordConfig.MaxMessagesPerBatch)
|
||||
=> SocketChannelHelper.GetCachedMessages(this, Discord, _messages, fromMessage.Id, dir, limit);
|
||||
public Task<IReadOnlyCollection<RestMessage>> GetPinnedMessagesAsync()
|
||||
=> ChannelHelper.GetPinnedMessagesAsync(this, Discord);
|
||||
public Task<IReadOnlyCollection<RestMessage>> GetPinnedMessagesAsync(RequestOptions options = null)
|
||||
=> ChannelHelper.GetPinnedMessagesAsync(this, Discord, options);
|
||||
|
||||
public Task<RestUserMessage> SendMessageAsync(string text, bool isTTS)
|
||||
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS);
|
||||
public Task<RestUserMessage> SendFileAsync(string filePath, string text, bool isTTS)
|
||||
=> ChannelHelper.SendFileAsync(this, Discord, filePath, text, isTTS);
|
||||
public Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text, bool isTTS)
|
||||
=> ChannelHelper.SendFileAsync(this, Discord, stream, filename, text, isTTS);
|
||||
public Task<RestUserMessage> SendMessageAsync(string text, bool isTTS, RequestOptions options = null)
|
||||
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, options);
|
||||
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(Stream stream, string filename, string text, bool isTTS, RequestOptions options = null)
|
||||
=> ChannelHelper.SendFileAsync(this, Discord, stream, filename, text, isTTS, options);
|
||||
|
||||
public Task DeleteMessagesAsync(IEnumerable<IMessage> messages)
|
||||
=> ChannelHelper.DeleteMessagesAsync(this, Discord, messages);
|
||||
public Task DeleteMessagesAsync(IEnumerable<IMessage> messages, RequestOptions options = null)
|
||||
=> ChannelHelper.DeleteMessagesAsync(this, Discord, messages, options);
|
||||
|
||||
public IDisposable EnterTypingState()
|
||||
=> ChannelHelper.EnterTypingState(this, Discord);
|
||||
public IDisposable EnterTypingState(RequestOptions options = null)
|
||||
=> ChannelHelper.EnterTypingState(this, Discord, options);
|
||||
|
||||
internal void AddMessage(SocketMessage msg)
|
||||
=> _messages.Add(msg);
|
||||
@@ -176,35 +176,34 @@ namespace Discord.WebSocket
|
||||
IReadOnlyCollection<IUser> IPrivateChannel.Recipients => Recipients;
|
||||
|
||||
//IMessageChannel
|
||||
async Task<IMessage> IMessageChannel.GetMessageAsync(ulong id, CacheMode mode)
|
||||
async Task<IMessage> IMessageChannel.GetMessageAsync(ulong id, CacheMode mode, RequestOptions options)
|
||||
{
|
||||
if (mode == CacheMode.AllowDownload)
|
||||
return await GetMessageAsync(id);
|
||||
return await GetMessageAsync(id, options);
|
||||
else
|
||||
return GetCachedMessage(id);
|
||||
}
|
||||
IAsyncEnumerable<IReadOnlyCollection<IMessage>> IMessageChannel.GetMessagesAsync(int limit, CacheMode mode)
|
||||
=> SocketChannelHelper.GetMessagesAsync(this, Discord, _messages, null, Direction.Before, limit, mode);
|
||||
IAsyncEnumerable<IReadOnlyCollection<IMessage>> IMessageChannel.GetMessagesAsync(ulong fromMessageId, Direction dir, int limit, CacheMode mode)
|
||||
=> SocketChannelHelper.GetMessagesAsync(this, Discord, _messages, fromMessageId, dir, limit, mode);
|
||||
IAsyncEnumerable<IReadOnlyCollection<IMessage>> IMessageChannel.GetMessagesAsync(IMessage fromMessage, Direction dir, int limit, CacheMode mode)
|
||||
=> SocketChannelHelper.GetMessagesAsync(this, Discord, _messages, fromMessage.Id, dir, limit, mode);
|
||||
async Task<IReadOnlyCollection<IMessage>> IMessageChannel.GetPinnedMessagesAsync()
|
||||
=> await GetPinnedMessagesAsync();
|
||||
|
||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(string filePath, string text, bool isTTS)
|
||||
=> await SendFileAsync(filePath, text, isTTS);
|
||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS)
|
||||
=> await SendFileAsync(stream, filename, text, isTTS);
|
||||
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS)
|
||||
=> await SendMessageAsync(text, isTTS);
|
||||
IDisposable IMessageChannel.EnterTypingState()
|
||||
=> EnterTypingState();
|
||||
IAsyncEnumerable<IReadOnlyCollection<IMessage>> IMessageChannel.GetMessagesAsync(int limit, CacheMode mode, RequestOptions options)
|
||||
=> SocketChannelHelper.GetMessagesAsync(this, Discord, _messages, null, Direction.Before, limit, mode, options);
|
||||
IAsyncEnumerable<IReadOnlyCollection<IMessage>> IMessageChannel.GetMessagesAsync(ulong fromMessageId, Direction dir, int limit, CacheMode mode, RequestOptions options)
|
||||
=> SocketChannelHelper.GetMessagesAsync(this, Discord, _messages, fromMessageId, dir, limit, mode, options);
|
||||
IAsyncEnumerable<IReadOnlyCollection<IMessage>> IMessageChannel.GetMessagesAsync(IMessage fromMessage, Direction dir, int limit, CacheMode mode, RequestOptions options)
|
||||
=> SocketChannelHelper.GetMessagesAsync(this, Discord, _messages, fromMessage.Id, dir, limit, mode, options);
|
||||
async Task<IReadOnlyCollection<IMessage>> IMessageChannel.GetPinnedMessagesAsync(RequestOptions options)
|
||||
=> await GetPinnedMessagesAsync(options).ConfigureAwait(false);
|
||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(string filePath, string text, bool isTTS, RequestOptions options)
|
||||
=> 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);
|
||||
IDisposable IMessageChannel.EnterTypingState(RequestOptions options)
|
||||
=> EnterTypingState(options);
|
||||
|
||||
//IChannel
|
||||
Task<IUser> IChannel.GetUserAsync(ulong id, CacheMode mode)
|
||||
Task<IUser> IChannel.GetUserAsync(ulong id, CacheMode mode, RequestOptions options)
|
||||
=> Task.FromResult<IUser>(GetUser(id));
|
||||
IAsyncEnumerable<IReadOnlyCollection<IUser>> IChannel.GetUsersAsync(CacheMode mode)
|
||||
IAsyncEnumerable<IReadOnlyCollection<IUser>> IChannel.GetUsersAsync(CacheMode mode, RequestOptions options)
|
||||
=> ImmutableArray.Create<IReadOnlyCollection<IUser>>(Users).ToAsyncEnumerable();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,10 +51,10 @@ namespace Discord.WebSocket
|
||||
_overwrites = newOverwrites.ToImmutable();
|
||||
}
|
||||
|
||||
public Task ModifyAsync(Action<ModifyGuildChannelParams> func)
|
||||
=> ChannelHelper.ModifyAsync(this, Discord, func);
|
||||
public Task DeleteAsync()
|
||||
=> ChannelHelper.DeleteAsync(this, Discord);
|
||||
public Task ModifyAsync(Action<ModifyGuildChannelParams> func, RequestOptions options = null)
|
||||
=> ChannelHelper.ModifyAsync(this, Discord, func, options);
|
||||
public Task DeleteAsync(RequestOptions options = null)
|
||||
=> ChannelHelper.DeleteAsync(this, Discord, options);
|
||||
|
||||
public OverwritePermissions? GetPermissionOverwrite(IUser user)
|
||||
{
|
||||
@@ -74,19 +74,19 @@ namespace Discord.WebSocket
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public async Task AddPermissionOverwriteAsync(IUser user, OverwritePermissions perms)
|
||||
public async Task AddPermissionOverwriteAsync(IUser user, OverwritePermissions perms, RequestOptions options = null)
|
||||
{
|
||||
await ChannelHelper.AddPermissionOverwriteAsync(this, Discord, user, perms).ConfigureAwait(false);
|
||||
await ChannelHelper.AddPermissionOverwriteAsync(this, Discord, user, perms, options).ConfigureAwait(false);
|
||||
_overwrites = _overwrites.Add(new Overwrite(new API.Overwrite { Allow = perms.AllowValue, Deny = perms.DenyValue, TargetId = user.Id, TargetType = PermissionTarget.User }));
|
||||
}
|
||||
public async Task AddPermissionOverwriteAsync(IRole role, OverwritePermissions perms)
|
||||
public async Task AddPermissionOverwriteAsync(IRole role, OverwritePermissions perms, RequestOptions options = null)
|
||||
{
|
||||
await ChannelHelper.AddPermissionOverwriteAsync(this, Discord, role, perms).ConfigureAwait(false);
|
||||
await ChannelHelper.AddPermissionOverwriteAsync(this, Discord, role, perms, options).ConfigureAwait(false);
|
||||
_overwrites.Add(new Overwrite(new API.Overwrite { Allow = perms.AllowValue, Deny = perms.DenyValue, TargetId = role.Id, TargetType = PermissionTarget.Role }));
|
||||
}
|
||||
public async Task RemovePermissionOverwriteAsync(IUser user)
|
||||
public async Task RemovePermissionOverwriteAsync(IUser user, RequestOptions options = null)
|
||||
{
|
||||
await ChannelHelper.RemovePermissionOverwriteAsync(this, Discord, user).ConfigureAwait(false);
|
||||
await ChannelHelper.RemovePermissionOverwriteAsync(this, Discord, user, options).ConfigureAwait(false);
|
||||
|
||||
for (int i = 0; i < _overwrites.Length; i++)
|
||||
{
|
||||
@@ -97,9 +97,9 @@ namespace Discord.WebSocket
|
||||
}
|
||||
}
|
||||
}
|
||||
public async Task RemovePermissionOverwriteAsync(IRole role)
|
||||
public async Task RemovePermissionOverwriteAsync(IRole role, RequestOptions options = null)
|
||||
{
|
||||
await ChannelHelper.RemovePermissionOverwriteAsync(this, Discord, role).ConfigureAwait(false);
|
||||
await ChannelHelper.RemovePermissionOverwriteAsync(this, Discord, role, options).ConfigureAwait(false);
|
||||
|
||||
for (int i = 0; i < _overwrites.Length; i++)
|
||||
{
|
||||
@@ -111,10 +111,10 @@ namespace Discord.WebSocket
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<IReadOnlyCollection<RestInviteMetadata>> GetInvitesAsync()
|
||||
=> await ChannelHelper.GetInvitesAsync(this, Discord);
|
||||
public async Task<RestInviteMetadata> CreateInviteAsync(int? maxAge = 3600, int? maxUses = null, bool isTemporary = true)
|
||||
=> await ChannelHelper.CreateInviteAsync(this, Discord, maxAge, maxUses, isTemporary);
|
||||
public async Task<IReadOnlyCollection<RestInviteMetadata>> GetInvitesAsync(RequestOptions options = null)
|
||||
=> await ChannelHelper.GetInvitesAsync(this, Discord, options);
|
||||
public async Task<RestInviteMetadata> CreateInviteAsync(int? maxAge = 3600, int? maxUses = null, bool isTemporary = true, RequestOptions options = null)
|
||||
=> await ChannelHelper.CreateInviteAsync(this, Discord, maxAge, maxUses, isTemporary, options);
|
||||
|
||||
public new abstract SocketGuildUser GetUser(ulong id);
|
||||
|
||||
@@ -128,33 +128,33 @@ namespace Discord.WebSocket
|
||||
//IGuildChannel
|
||||
ulong IGuildChannel.GuildId => Guild.Id;
|
||||
|
||||
async Task<IReadOnlyCollection<IInviteMetadata>> IGuildChannel.GetInvitesAsync()
|
||||
=> await GetInvitesAsync();
|
||||
async Task<IInviteMetadata> IGuildChannel.CreateInviteAsync(int? maxAge, int? maxUses, bool isTemporary)
|
||||
=> await CreateInviteAsync(maxAge, maxUses, isTemporary);
|
||||
async Task<IReadOnlyCollection<IInviteMetadata>> IGuildChannel.GetInvitesAsync(RequestOptions options)
|
||||
=> await GetInvitesAsync(options);
|
||||
async Task<IInviteMetadata> IGuildChannel.CreateInviteAsync(int? maxAge, int? maxUses, bool isTemporary, RequestOptions options)
|
||||
=> await CreateInviteAsync(maxAge, maxUses, isTemporary, options);
|
||||
|
||||
OverwritePermissions? IGuildChannel.GetPermissionOverwrite(IRole role)
|
||||
=> GetPermissionOverwrite(role);
|
||||
OverwritePermissions? IGuildChannel.GetPermissionOverwrite(IUser user)
|
||||
=> GetPermissionOverwrite(user);
|
||||
async Task IGuildChannel.AddPermissionOverwriteAsync(IRole role, OverwritePermissions permissions)
|
||||
=> await AddPermissionOverwriteAsync(role, permissions);
|
||||
async Task IGuildChannel.AddPermissionOverwriteAsync(IUser user, OverwritePermissions permissions)
|
||||
=> await AddPermissionOverwriteAsync(user, permissions);
|
||||
async Task IGuildChannel.RemovePermissionOverwriteAsync(IRole role)
|
||||
=> await RemovePermissionOverwriteAsync(role);
|
||||
async Task IGuildChannel.RemovePermissionOverwriteAsync(IUser user)
|
||||
=> await RemovePermissionOverwriteAsync(user);
|
||||
async Task IGuildChannel.AddPermissionOverwriteAsync(IRole role, OverwritePermissions permissions, RequestOptions options)
|
||||
=> await AddPermissionOverwriteAsync(role, permissions, options);
|
||||
async Task IGuildChannel.AddPermissionOverwriteAsync(IUser user, OverwritePermissions permissions, RequestOptions options)
|
||||
=> await AddPermissionOverwriteAsync(user, permissions, options);
|
||||
async Task IGuildChannel.RemovePermissionOverwriteAsync(IRole role, RequestOptions options)
|
||||
=> await RemovePermissionOverwriteAsync(role, options);
|
||||
async Task IGuildChannel.RemovePermissionOverwriteAsync(IUser user, RequestOptions options)
|
||||
=> await RemovePermissionOverwriteAsync(user, options);
|
||||
|
||||
IAsyncEnumerable<IReadOnlyCollection<IGuildUser>> IGuildChannel.GetUsersAsync(CacheMode mode)
|
||||
IAsyncEnumerable<IReadOnlyCollection<IGuildUser>> IGuildChannel.GetUsersAsync(CacheMode mode, RequestOptions options)
|
||||
=> ImmutableArray.Create<IReadOnlyCollection<IGuildUser>>(Users).ToAsyncEnumerable();
|
||||
Task<IGuildUser> IGuildChannel.GetUserAsync(ulong id, CacheMode mode)
|
||||
Task<IGuildUser> IGuildChannel.GetUserAsync(ulong id, CacheMode mode, RequestOptions options)
|
||||
=> Task.FromResult<IGuildUser>(GetUser(id));
|
||||
|
||||
//IChannel
|
||||
IAsyncEnumerable<IReadOnlyCollection<IUser>> IChannel.GetUsersAsync(CacheMode mode)
|
||||
IAsyncEnumerable<IReadOnlyCollection<IUser>> IChannel.GetUsersAsync(CacheMode mode, RequestOptions options)
|
||||
=> ImmutableArray.Create<IReadOnlyCollection<IUser>>(Users).ToAsyncEnumerable(); //Overriden in Text/Voice //TODO: Does this actually override?
|
||||
Task<IUser> IChannel.GetUserAsync(ulong id, CacheMode mode)
|
||||
Task<IUser> IChannel.GetUserAsync(ulong id, CacheMode mode, RequestOptions options)
|
||||
=> Task.FromResult<IUser>(GetUser(id)); //Overriden in Text/Voice //TODO: Does this actually override?
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,46 +44,46 @@ namespace Discord.WebSocket
|
||||
Topic = model.Topic.Value;
|
||||
}
|
||||
|
||||
public Task ModifyAsync(Action<ModifyTextChannelParams> func)
|
||||
=> ChannelHelper.ModifyAsync(this, Discord, func);
|
||||
public Task ModifyAsync(Action<ModifyTextChannelParams> func, RequestOptions options = null)
|
||||
=> ChannelHelper.ModifyAsync(this, Discord, func, options);
|
||||
|
||||
//Messages
|
||||
public SocketMessage GetCachedMessage(ulong id)
|
||||
=> _messages?.Get(id);
|
||||
public async Task<IMessage> GetMessageAsync(ulong id)
|
||||
public async Task<IMessage> GetMessageAsync(ulong id, RequestOptions options = null)
|
||||
{
|
||||
IMessage msg = _messages?.Get(id);
|
||||
if (msg == null)
|
||||
msg = await ChannelHelper.GetMessageAsync(this, Discord, id);
|
||||
msg = await ChannelHelper.GetMessageAsync(this, Discord, id, options);
|
||||
return msg;
|
||||
}
|
||||
public IAsyncEnumerable<IReadOnlyCollection<IMessage>> GetMessagesAsync(int limit = DiscordConfig.MaxMessagesPerBatch)
|
||||
=> SocketChannelHelper.GetMessagesAsync(this, Discord, _messages, null, Direction.Before, limit, CacheMode.AllowDownload);
|
||||
public IAsyncEnumerable<IReadOnlyCollection<IMessage>> GetMessagesAsync(ulong fromMessageId, Direction dir, int limit = DiscordConfig.MaxMessagesPerBatch)
|
||||
=> SocketChannelHelper.GetMessagesAsync(this, Discord, _messages, fromMessageId, dir, limit, CacheMode.AllowDownload);
|
||||
public IAsyncEnumerable<IReadOnlyCollection<IMessage>> GetMessagesAsync(IMessage fromMessage, Direction dir, int limit = DiscordConfig.MaxMessagesPerBatch)
|
||||
=> SocketChannelHelper.GetMessagesAsync(this, Discord, _messages, fromMessage.Id, dir, limit, CacheMode.AllowDownload);
|
||||
public IAsyncEnumerable<IReadOnlyCollection<IMessage>> GetMessagesAsync(int limit = DiscordConfig.MaxMessagesPerBatch, RequestOptions options = null)
|
||||
=> SocketChannelHelper.GetMessagesAsync(this, Discord, _messages, null, Direction.Before, limit, CacheMode.AllowDownload, options);
|
||||
public IAsyncEnumerable<IReadOnlyCollection<IMessage>> GetMessagesAsync(ulong fromMessageId, Direction dir, int limit = DiscordConfig.MaxMessagesPerBatch, RequestOptions options = null)
|
||||
=> SocketChannelHelper.GetMessagesAsync(this, Discord, _messages, fromMessageId, dir, limit, CacheMode.AllowDownload, options);
|
||||
public IAsyncEnumerable<IReadOnlyCollection<IMessage>> GetMessagesAsync(IMessage fromMessage, Direction dir, int limit = DiscordConfig.MaxMessagesPerBatch, RequestOptions options = null)
|
||||
=> SocketChannelHelper.GetMessagesAsync(this, Discord, _messages, fromMessage.Id, dir, limit, CacheMode.AllowDownload, options);
|
||||
public IReadOnlyCollection<SocketMessage> GetCachedMessages(int limit = DiscordConfig.MaxMessagesPerBatch)
|
||||
=> SocketChannelHelper.GetCachedMessages(this, Discord, _messages, null, Direction.Before, limit);
|
||||
public IReadOnlyCollection<SocketMessage> GetCachedMessages(ulong fromMessageId, Direction dir, int limit = DiscordConfig.MaxMessagesPerBatch)
|
||||
=> SocketChannelHelper.GetCachedMessages(this, Discord, _messages, fromMessageId, dir, limit);
|
||||
public IReadOnlyCollection<SocketMessage> GetCachedMessages(IMessage fromMessage, Direction dir, int limit = DiscordConfig.MaxMessagesPerBatch)
|
||||
=> SocketChannelHelper.GetCachedMessages(this, Discord, _messages, fromMessage.Id, dir, limit);
|
||||
public Task<IReadOnlyCollection<RestMessage>> GetPinnedMessagesAsync()
|
||||
=> ChannelHelper.GetPinnedMessagesAsync(this, Discord);
|
||||
public Task<IReadOnlyCollection<RestMessage>> GetPinnedMessagesAsync(RequestOptions options = null)
|
||||
=> ChannelHelper.GetPinnedMessagesAsync(this, Discord, options);
|
||||
|
||||
public Task<RestUserMessage> SendMessageAsync(string text, bool isTTS)
|
||||
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS);
|
||||
public Task<RestUserMessage> SendFileAsync(string filePath, string text, bool isTTS)
|
||||
=> ChannelHelper.SendFileAsync(this, Discord, filePath, text, isTTS);
|
||||
public Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text, bool isTTS)
|
||||
=> ChannelHelper.SendFileAsync(this, Discord, stream, filename, text, isTTS);
|
||||
public Task<RestUserMessage> SendMessageAsync(string text, bool isTTS, RequestOptions options = null)
|
||||
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, options);
|
||||
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(Stream stream, string filename, string text, bool isTTS, RequestOptions options = null)
|
||||
=> ChannelHelper.SendFileAsync(this, Discord, stream, filename, text, isTTS, options);
|
||||
|
||||
public Task DeleteMessagesAsync(IEnumerable<IMessage> messages)
|
||||
=> ChannelHelper.DeleteMessagesAsync(this, Discord, messages);
|
||||
public Task DeleteMessagesAsync(IEnumerable<IMessage> messages, RequestOptions options = null)
|
||||
=> ChannelHelper.DeleteMessagesAsync(this, Discord, messages, options);
|
||||
|
||||
public IDisposable EnterTypingState()
|
||||
=> ChannelHelper.EnterTypingState(this, Discord);
|
||||
public IDisposable EnterTypingState(RequestOptions options = null)
|
||||
=> ChannelHelper.EnterTypingState(this, Discord, options);
|
||||
|
||||
internal void AddMessage(SocketMessage msg)
|
||||
=> _messages.Add(msg);
|
||||
@@ -108,34 +108,34 @@ namespace Discord.WebSocket
|
||||
internal new SocketTextChannel Clone() => MemberwiseClone() as SocketTextChannel;
|
||||
|
||||
//IGuildChannel
|
||||
Task<IGuildUser> IGuildChannel.GetUserAsync(ulong id, CacheMode mode)
|
||||
Task<IGuildUser> IGuildChannel.GetUserAsync(ulong id, CacheMode mode, RequestOptions options)
|
||||
=> Task.FromResult<IGuildUser>(GetUser(id));
|
||||
IAsyncEnumerable<IReadOnlyCollection<IGuildUser>> IGuildChannel.GetUsersAsync(CacheMode mode)
|
||||
IAsyncEnumerable<IReadOnlyCollection<IGuildUser>> IGuildChannel.GetUsersAsync(CacheMode mode, RequestOptions options)
|
||||
=> ImmutableArray.Create<IReadOnlyCollection<IGuildUser>>(Users).ToAsyncEnumerable();
|
||||
|
||||
//IMessageChannel
|
||||
async Task<IMessage> IMessageChannel.GetMessageAsync(ulong id, CacheMode mode)
|
||||
async Task<IMessage> IMessageChannel.GetMessageAsync(ulong id, CacheMode mode, RequestOptions options)
|
||||
{
|
||||
if (mode == CacheMode.AllowDownload)
|
||||
return await GetMessageAsync(id);
|
||||
return await GetMessageAsync(id, options);
|
||||
else
|
||||
return GetCachedMessage(id);
|
||||
}
|
||||
IAsyncEnumerable<IReadOnlyCollection<IMessage>> IMessageChannel.GetMessagesAsync(int limit, CacheMode mode)
|
||||
=> SocketChannelHelper.GetMessagesAsync(this, Discord, _messages, null, Direction.Before, limit, mode);
|
||||
IAsyncEnumerable<IReadOnlyCollection<IMessage>> IMessageChannel.GetMessagesAsync(ulong fromMessageId, Direction dir, int limit, CacheMode mode)
|
||||
=> SocketChannelHelper.GetMessagesAsync(this, Discord, _messages, fromMessageId, dir, limit, mode);
|
||||
IAsyncEnumerable<IReadOnlyCollection<IMessage>> IMessageChannel.GetMessagesAsync(IMessage fromMessage, Direction dir, int limit, CacheMode mode)
|
||||
=> SocketChannelHelper.GetMessagesAsync(this, Discord, _messages, fromMessage.Id, dir, limit, mode);
|
||||
async Task<IReadOnlyCollection<IMessage>> IMessageChannel.GetPinnedMessagesAsync()
|
||||
=> await GetPinnedMessagesAsync().ConfigureAwait(false);
|
||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(string filePath, string text, bool isTTS)
|
||||
=> await SendFileAsync(filePath, text, isTTS);
|
||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS)
|
||||
=> await SendFileAsync(stream, filename, text, isTTS);
|
||||
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS)
|
||||
=> await SendMessageAsync(text, isTTS);
|
||||
IDisposable IMessageChannel.EnterTypingState()
|
||||
=> EnterTypingState();
|
||||
IAsyncEnumerable<IReadOnlyCollection<IMessage>> IMessageChannel.GetMessagesAsync(int limit, CacheMode mode, RequestOptions options)
|
||||
=> SocketChannelHelper.GetMessagesAsync(this, Discord, _messages, null, Direction.Before, limit, mode, options);
|
||||
IAsyncEnumerable<IReadOnlyCollection<IMessage>> IMessageChannel.GetMessagesAsync(ulong fromMessageId, Direction dir, int limit, CacheMode mode, RequestOptions options)
|
||||
=> SocketChannelHelper.GetMessagesAsync(this, Discord, _messages, fromMessageId, dir, limit, mode, options);
|
||||
IAsyncEnumerable<IReadOnlyCollection<IMessage>> IMessageChannel.GetMessagesAsync(IMessage fromMessage, Direction dir, int limit, CacheMode mode, RequestOptions options)
|
||||
=> SocketChannelHelper.GetMessagesAsync(this, Discord, _messages, fromMessage.Id, dir, limit, mode, options);
|
||||
async Task<IReadOnlyCollection<IMessage>> IMessageChannel.GetPinnedMessagesAsync(RequestOptions options)
|
||||
=> await GetPinnedMessagesAsync(options).ConfigureAwait(false);
|
||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(string filePath, string text, bool isTTS, RequestOptions options)
|
||||
=> 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);
|
||||
IDisposable IMessageChannel.EnterTypingState(RequestOptions options)
|
||||
=> EnterTypingState(options);
|
||||
}
|
||||
}
|
||||
@@ -38,8 +38,8 @@ namespace Discord.WebSocket
|
||||
UserLimit = model.UserLimit.Value;
|
||||
}
|
||||
|
||||
public Task ModifyAsync(Action<ModifyVoiceChannelParams> func)
|
||||
=> ChannelHelper.ModifyAsync(this, Discord, func);
|
||||
public Task ModifyAsync(Action<ModifyVoiceChannelParams> func, RequestOptions options = null)
|
||||
=> ChannelHelper.ModifyAsync(this, Discord, func, options);
|
||||
|
||||
public override SocketGuildUser GetUser(ulong id)
|
||||
{
|
||||
@@ -56,9 +56,9 @@ namespace Discord.WebSocket
|
||||
Task<IAudioClient> IVoiceChannel.ConnectAsync() { throw new NotSupportedException(); }
|
||||
|
||||
//IGuildChannel
|
||||
Task<IGuildUser> IGuildChannel.GetUserAsync(ulong id, CacheMode mode)
|
||||
Task<IGuildUser> IGuildChannel.GetUserAsync(ulong id, CacheMode mode, RequestOptions options)
|
||||
=> Task.FromResult<IGuildUser>(GetUser(id));
|
||||
IAsyncEnumerable<IReadOnlyCollection<IGuildUser>> IGuildChannel.GetUsersAsync(CacheMode mode)
|
||||
IAsyncEnumerable<IReadOnlyCollection<IGuildUser>> IGuildChannel.GetUsersAsync(CacheMode mode, RequestOptions options)
|
||||
=> ImmutableArray.Create<IReadOnlyCollection<IGuildUser>>(Users).ToAsyncEnumerable();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user