@@ -53,7 +53,7 @@ namespace Discord.Audio | |||
public ulong ChannelId { get; internal set; } | |||
internal byte[] SecretKey { get; private set; } | |||
private DiscordSocketClient Discord => Guild.Discord; | |||
private DiscordSocketClient Discord => Guild.Client; | |||
public ConnectionState ConnectionState => _connection.State; | |||
/// <summary> Creates a new REST/WebSocket discord client. </summary> | |||
@@ -37,7 +37,7 @@ namespace Discord.WebSocket | |||
} | |||
internal new static SocketCategoryChannel Create(SocketGuild guild, ClientState state, Model model) | |||
{ | |||
var entity = new SocketCategoryChannel(guild.Discord, model.Id, guild); | |||
var entity = new SocketCategoryChannel(guild.Client, model.Id, guild); | |||
entity.Update(state, model); | |||
return entity; | |||
} | |||
@@ -29,15 +29,15 @@ namespace Discord.WebSocket | |||
/// <summary> | |||
/// Gets a collection that is the current logged-in user and the recipient. | |||
/// </summary> | |||
public new IReadOnlyCollection<SocketUser> Users => ImmutableArray.Create(Discord.CurrentUser, Recipient); | |||
public new IReadOnlyCollection<SocketUser> Users => ImmutableArray.Create(Client.CurrentUser, Recipient); | |||
internal SocketDMChannel(DiscordSocketClient discord, ulong id, SocketGlobalUser recipient) | |||
: base(discord, id) | |||
{ | |||
Recipient = recipient; | |||
recipient.GlobalUser.AddRef(); | |||
if (Discord.MessageCacheSize > 0) | |||
_messages = new MessageCache(Discord); | |||
if (Client.MessageCacheSize > 0) | |||
_messages = new MessageCache(Client); | |||
} | |||
internal static SocketDMChannel Create(DiscordSocketClient discord, ClientState state, Model model) | |||
{ | |||
@@ -52,7 +52,7 @@ namespace Discord.WebSocket | |||
/// <inheritdoc /> | |||
public Task CloseAsync(RequestOptions options = null) | |||
=> ChannelHelper.DeleteAsync(this, Discord, options); | |||
=> ChannelHelper.DeleteAsync(this, Client, options); | |||
//Messages | |||
/// <inheritdoc /> | |||
@@ -70,7 +70,7 @@ namespace Discord.WebSocket | |||
{ | |||
IMessage msg = _messages?.Get(id); | |||
if (msg == null) | |||
msg = await ChannelHelper.GetMessageAsync(this, Discord, id, options).ConfigureAwait(false); | |||
msg = await ChannelHelper.GetMessageAsync(this, Client, id, options).ConfigureAwait(false); | |||
return msg; | |||
} | |||
@@ -87,7 +87,7 @@ namespace Discord.WebSocket | |||
/// Paged collection of messages. | |||
/// </returns> | |||
public IAsyncEnumerable<IReadOnlyCollection<IMessage>> GetMessagesAsync(int limit = DiscordConfig.MaxMessagesPerBatch, RequestOptions options = null) | |||
=> SocketChannelHelper.GetMessagesAsync(this, Discord, _messages, null, Direction.Before, limit, CacheMode.AllowDownload, options); | |||
=> SocketChannelHelper.GetMessagesAsync(this, Client, _messages, null, Direction.Before, limit, CacheMode.AllowDownload, options); | |||
/// <summary> | |||
/// Gets a collection of messages in this channel. | |||
/// </summary> | |||
@@ -103,7 +103,7 @@ namespace Discord.WebSocket | |||
/// Paged collection of messages. | |||
/// </returns> | |||
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); | |||
=> SocketChannelHelper.GetMessagesAsync(this, Client, _messages, fromMessageId, dir, limit, CacheMode.AllowDownload, options); | |||
/// <summary> | |||
/// Gets a collection of messages in this channel. | |||
/// </summary> | |||
@@ -119,45 +119,45 @@ namespace Discord.WebSocket | |||
/// Paged collection of messages. | |||
/// </returns> | |||
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); | |||
=> SocketChannelHelper.GetMessagesAsync(this, Client, _messages, fromMessage.Id, dir, limit, CacheMode.AllowDownload, options); | |||
/// <inheritdoc /> | |||
public IReadOnlyCollection<SocketMessage> GetCachedMessages(int limit = DiscordConfig.MaxMessagesPerBatch) | |||
=> SocketChannelHelper.GetCachedMessages(this, Discord, _messages, null, Direction.Before, limit); | |||
=> SocketChannelHelper.GetCachedMessages(this, Client, _messages, null, Direction.Before, limit); | |||
/// <inheritdoc /> | |||
public IReadOnlyCollection<SocketMessage> GetCachedMessages(ulong fromMessageId, Direction dir, int limit = DiscordConfig.MaxMessagesPerBatch) | |||
=> SocketChannelHelper.GetCachedMessages(this, Discord, _messages, fromMessageId, dir, limit); | |||
=> SocketChannelHelper.GetCachedMessages(this, Client, _messages, fromMessageId, dir, limit); | |||
/// <inheritdoc /> | |||
public IReadOnlyCollection<SocketMessage> GetCachedMessages(IMessage fromMessage, Direction dir, int limit = DiscordConfig.MaxMessagesPerBatch) | |||
=> SocketChannelHelper.GetCachedMessages(this, Discord, _messages, fromMessage.Id, dir, limit); | |||
=> SocketChannelHelper.GetCachedMessages(this, Client, _messages, fromMessage.Id, dir, limit); | |||
/// <inheritdoc /> | |||
public Task<IReadOnlyCollection<RestMessage>> GetPinnedMessagesAsync(RequestOptions options = null) | |||
=> ChannelHelper.GetPinnedMessagesAsync(this, Discord, options); | |||
=> ChannelHelper.GetPinnedMessagesAsync(this, Client, options); | |||
/// <inheritdoc /> | |||
/// <exception cref="ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="DiscordConfig.MaxMessageSize"/>.</exception> | |||
public Task<RestUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null) | |||
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, options); | |||
=> ChannelHelper.SendMessageAsync(this, Client, text, isTTS, embed, options); | |||
/// <inheritdoc /> | |||
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); | |||
=> ChannelHelper.SendFileAsync(this, Client, filePath, text, isTTS, embed, options); | |||
/// <inheritdoc /> | |||
/// <exception cref="ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="DiscordConfig.MaxMessageSize"/>.</exception> | |||
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); | |||
=> ChannelHelper.SendFileAsync(this, Client, stream, filename, text, isTTS, embed, options); | |||
/// <inheritdoc /> | |||
public Task DeleteMessageAsync(ulong messageId, RequestOptions options = null) | |||
=> ChannelHelper.DeleteMessageAsync(this, messageId, Discord, options); | |||
=> ChannelHelper.DeleteMessageAsync(this, messageId, Client, options); | |||
/// <inheritdoc /> | |||
public Task DeleteMessageAsync(IMessage message, RequestOptions options = null) | |||
=> ChannelHelper.DeleteMessageAsync(this, message.Id, Discord, options); | |||
=> ChannelHelper.DeleteMessageAsync(this, message.Id, Client, options); | |||
/// <inheritdoc /> | |||
public Task TriggerTypingAsync(RequestOptions options = null) | |||
=> ChannelHelper.TriggerTypingAsync(this, Discord, options); | |||
=> ChannelHelper.TriggerTypingAsync(this, Client, options); | |||
/// <inheritdoc /> | |||
public IDisposable EnterTypingState(RequestOptions options = null) | |||
=> ChannelHelper.EnterTypingState(this, Discord, options); | |||
=> ChannelHelper.EnterTypingState(this, Client, options); | |||
internal void AddMessage(SocketMessage msg) | |||
=> _messages?.Add(msg); | |||
@@ -176,8 +176,8 @@ namespace Discord.WebSocket | |||
{ | |||
if (id == Recipient.Id) | |||
return Recipient; | |||
else if (id == Discord.CurrentUser.Id) | |||
return Discord.CurrentUser; | |||
else if (id == Client.CurrentUser.Id) | |||
return Client.CurrentUser; | |||
else | |||
return null; | |||
} | |||
@@ -218,13 +218,13 @@ namespace Discord.WebSocket | |||
} | |||
/// <inheritdoc /> | |||
IAsyncEnumerable<IReadOnlyCollection<IMessage>> IMessageChannel.GetMessagesAsync(int limit, CacheMode mode, RequestOptions options) | |||
=> SocketChannelHelper.GetMessagesAsync(this, Discord, _messages, null, Direction.Before, limit, mode, options); | |||
=> SocketChannelHelper.GetMessagesAsync(this, Client, _messages, null, Direction.Before, limit, mode, options); | |||
/// <inheritdoc /> | |||
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); | |||
=> SocketChannelHelper.GetMessagesAsync(this, Client, _messages, fromMessageId, dir, limit, mode, options); | |||
/// <inheritdoc /> | |||
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); | |||
=> SocketChannelHelper.GetMessagesAsync(this, Client, _messages, fromMessage.Id, dir, limit, mode, options); | |||
/// <inheritdoc /> | |||
async Task<IReadOnlyCollection<IMessage>> IMessageChannel.GetPinnedMessagesAsync(RequestOptions options) | |||
=> await GetPinnedMessagesAsync(options).ConfigureAwait(false); | |||
@@ -33,13 +33,13 @@ namespace Discord.WebSocket | |||
public IReadOnlyCollection<SocketMessage> CachedMessages => _messages?.Messages ?? ImmutableArray.Create<SocketMessage>(); | |||
public new IReadOnlyCollection<SocketGroupUser> Users => _users.ToReadOnlyCollection(); | |||
public IReadOnlyCollection<SocketGroupUser> 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 != Client.CurrentUser.Id).ToReadOnlyCollection(() => _users.Count - 1); | |||
internal SocketGroupChannel(DiscordSocketClient discord, ulong id) | |||
: base(discord, id) | |||
{ | |||
if (Discord.MessageCacheSize > 0) | |||
_messages = new MessageCache(Discord); | |||
if (Client.MessageCacheSize > 0) | |||
_messages = new MessageCache(Client); | |||
_voiceStates = new ConcurrentDictionary<ulong, SocketVoiceState>(ConcurrentHashSet.DefaultConcurrencyLevel, 5); | |||
_users = new ConcurrentDictionary<ulong, SocketGroupUser>(ConcurrentHashSet.DefaultConcurrencyLevel, 5); | |||
} | |||
@@ -69,7 +69,7 @@ namespace Discord.WebSocket | |||
/// <inheritdoc /> | |||
public Task LeaveAsync(RequestOptions options = null) | |||
=> ChannelHelper.DeleteAsync(this, Discord, options); | |||
=> ChannelHelper.DeleteAsync(this, Client, options); | |||
/// <exception cref="NotSupportedException">Voice is not yet supported for group channels.</exception> | |||
public Task<IAudioClient> ConnectAsync() | |||
@@ -98,7 +98,7 @@ namespace Discord.WebSocket | |||
{ | |||
IMessage msg = _messages?.Get(id); | |||
if (msg == null) | |||
msg = await ChannelHelper.GetMessageAsync(this, Discord, id, options).ConfigureAwait(false); | |||
msg = await ChannelHelper.GetMessageAsync(this, Client, id, options).ConfigureAwait(false); | |||
return msg; | |||
} | |||
@@ -115,7 +115,7 @@ namespace Discord.WebSocket | |||
/// Paged collection of messages. | |||
/// </returns> | |||
public IAsyncEnumerable<IReadOnlyCollection<IMessage>> GetMessagesAsync(int limit = DiscordConfig.MaxMessagesPerBatch, RequestOptions options = null) | |||
=> SocketChannelHelper.GetMessagesAsync(this, Discord, _messages, null, Direction.Before, limit, CacheMode.AllowDownload, options); | |||
=> SocketChannelHelper.GetMessagesAsync(this, Client, _messages, null, Direction.Before, limit, CacheMode.AllowDownload, options); | |||
/// <summary> | |||
/// Gets a collection of messages in this channel. | |||
/// </summary> | |||
@@ -131,7 +131,7 @@ namespace Discord.WebSocket | |||
/// Paged collection of messages. | |||
/// </returns> | |||
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); | |||
=> SocketChannelHelper.GetMessagesAsync(this, Client, _messages, fromMessageId, dir, limit, CacheMode.AllowDownload, options); | |||
/// <summary> | |||
/// Gets a collection of messages in this channel. | |||
/// </summary> | |||
@@ -147,45 +147,45 @@ namespace Discord.WebSocket | |||
/// Paged collection of messages. | |||
/// </returns> | |||
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); | |||
=> SocketChannelHelper.GetMessagesAsync(this, Client, _messages, fromMessage.Id, dir, limit, CacheMode.AllowDownload, options); | |||
/// <inheritdoc /> | |||
public IReadOnlyCollection<SocketMessage> GetCachedMessages(int limit = DiscordConfig.MaxMessagesPerBatch) | |||
=> SocketChannelHelper.GetCachedMessages(this, Discord, _messages, null, Direction.Before, limit); | |||
=> SocketChannelHelper.GetCachedMessages(this, Client, _messages, null, Direction.Before, limit); | |||
/// <inheritdoc /> | |||
public IReadOnlyCollection<SocketMessage> GetCachedMessages(ulong fromMessageId, Direction dir, int limit = DiscordConfig.MaxMessagesPerBatch) | |||
=> SocketChannelHelper.GetCachedMessages(this, Discord, _messages, fromMessageId, dir, limit); | |||
=> SocketChannelHelper.GetCachedMessages(this, Client, _messages, fromMessageId, dir, limit); | |||
/// <inheritdoc /> | |||
public IReadOnlyCollection<SocketMessage> GetCachedMessages(IMessage fromMessage, Direction dir, int limit = DiscordConfig.MaxMessagesPerBatch) | |||
=> SocketChannelHelper.GetCachedMessages(this, Discord, _messages, fromMessage.Id, dir, limit); | |||
=> SocketChannelHelper.GetCachedMessages(this, Client, _messages, fromMessage.Id, dir, limit); | |||
/// <inheritdoc /> | |||
public Task<IReadOnlyCollection<RestMessage>> GetPinnedMessagesAsync(RequestOptions options = null) | |||
=> ChannelHelper.GetPinnedMessagesAsync(this, Discord, options); | |||
=> ChannelHelper.GetPinnedMessagesAsync(this, Client, options); | |||
/// <inheritdoc /> | |||
/// <exception cref="ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="DiscordConfig.MaxMessageSize"/>.</exception> | |||
public Task<RestUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null) | |||
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, options); | |||
=> ChannelHelper.SendMessageAsync(this, Client, text, isTTS, embed, options); | |||
/// <inheritdoc /> | |||
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); | |||
=> ChannelHelper.SendFileAsync(this, Client, filePath, text, isTTS, embed, options); | |||
/// <inheritdoc /> | |||
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); | |||
=> ChannelHelper.SendFileAsync(this, Client, stream, filename, text, isTTS, embed, options); | |||
/// <inheritdoc /> | |||
public Task DeleteMessageAsync(ulong messageId, RequestOptions options = null) | |||
=> ChannelHelper.DeleteMessageAsync(this, messageId, Discord, options); | |||
=> ChannelHelper.DeleteMessageAsync(this, messageId, Client, options); | |||
/// <inheritdoc /> | |||
public Task DeleteMessageAsync(IMessage message, RequestOptions options = null) | |||
=> ChannelHelper.DeleteMessageAsync(this, message.Id, Discord, options); | |||
=> ChannelHelper.DeleteMessageAsync(this, message.Id, Client, options); | |||
/// <inheritdoc /> | |||
public Task TriggerTypingAsync(RequestOptions options = null) | |||
=> ChannelHelper.TriggerTypingAsync(this, Discord, options); | |||
=> ChannelHelper.TriggerTypingAsync(this, Client, options); | |||
/// <inheritdoc /> | |||
public IDisposable EnterTypingState(RequestOptions options = null) | |||
=> ChannelHelper.EnterTypingState(this, Discord, options); | |||
=> ChannelHelper.EnterTypingState(this, Client, options); | |||
internal void AddMessage(SocketMessage msg) | |||
=> _messages?.Add(msg); | |||
@@ -212,7 +212,7 @@ namespace Discord.WebSocket | |||
return user; | |||
else | |||
{ | |||
var privateUser = SocketGroupUser.Create(this, Discord.State, model); | |||
var privateUser = SocketGroupUser.Create(this, Client.State, model); | |||
privateUser.GlobalUser.AddRef(); | |||
_users[privateUser.Id] = privateUser; | |||
return privateUser; | |||
@@ -222,7 +222,7 @@ namespace Discord.WebSocket | |||
{ | |||
if (_users.TryRemove(id, out SocketGroupUser user)) | |||
{ | |||
user.GlobalUser.RemoveRef(Discord); | |||
user.GlobalUser.RemoveRef(Client); | |||
return user; | |||
} | |||
return null; | |||
@@ -281,13 +281,13 @@ namespace Discord.WebSocket | |||
} | |||
/// <inheritdoc /> | |||
IAsyncEnumerable<IReadOnlyCollection<IMessage>> IMessageChannel.GetMessagesAsync(int limit, CacheMode mode, RequestOptions options) | |||
=> SocketChannelHelper.GetMessagesAsync(this, Discord, _messages, null, Direction.Before, limit, mode, options); | |||
=> SocketChannelHelper.GetMessagesAsync(this, Client, _messages, null, Direction.Before, limit, mode, options); | |||
/// <inheritdoc /> | |||
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); | |||
=> SocketChannelHelper.GetMessagesAsync(this, Client, _messages, fromMessageId, dir, limit, mode, options); | |||
/// <inheritdoc /> | |||
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); | |||
=> SocketChannelHelper.GetMessagesAsync(this, Client, _messages, fromMessage.Id, dir, limit, mode, options); | |||
/// <inheritdoc /> | |||
async Task<IReadOnlyCollection<IMessage>> IMessageChannel.GetPinnedMessagesAsync(RequestOptions options) | |||
=> await GetPinnedMessagesAsync(options).ConfigureAwait(false); | |||
@@ -56,7 +56,7 @@ namespace Discord.WebSocket | |||
return SocketCategoryChannel.Create(guild, state, model); | |||
default: | |||
// TODO: Proper implementation for channel categories | |||
return new SocketGuildChannel(guild.Discord, model.Id, guild); | |||
return new SocketGuildChannel(guild.Client, model.Id, guild); | |||
} | |||
} | |||
/// <inheritdoc /> | |||
@@ -74,10 +74,10 @@ namespace Discord.WebSocket | |||
/// <inheritdoc /> | |||
public Task ModifyAsync(Action<GuildChannelProperties> func, RequestOptions options = null) | |||
=> ChannelHelper.ModifyAsync(this, Discord, func, options); | |||
=> ChannelHelper.ModifyAsync(this, Client, func, options); | |||
/// <inheritdoc /> | |||
public Task DeleteAsync(RequestOptions options = null) | |||
=> ChannelHelper.DeleteAsync(this, Discord, options); | |||
=> ChannelHelper.DeleteAsync(this, Client, options); | |||
/// <summary> | |||
/// Gets the permission overwrite for a specific user. | |||
@@ -123,7 +123,7 @@ namespace Discord.WebSocket | |||
/// </returns> | |||
public async Task AddPermissionOverwriteAsync(IUser user, OverwritePermissions permissions, RequestOptions options = null) | |||
{ | |||
await ChannelHelper.AddPermissionOverwriteAsync(this, Discord, user, permissions, options).ConfigureAwait(false); | |||
await ChannelHelper.AddPermissionOverwriteAsync(this, Client, user, permissions, options).ConfigureAwait(false); | |||
_overwrites = _overwrites.Add(new Overwrite(user.Id, PermissionTarget.User, new OverwritePermissions(permissions.AllowValue, permissions.DenyValue))); | |||
} | |||
@@ -138,7 +138,7 @@ namespace Discord.WebSocket | |||
/// </returns> | |||
public async Task AddPermissionOverwriteAsync(IRole role, OverwritePermissions permissions, RequestOptions options = null) | |||
{ | |||
await ChannelHelper.AddPermissionOverwriteAsync(this, Discord, role, permissions, options).ConfigureAwait(false); | |||
await ChannelHelper.AddPermissionOverwriteAsync(this, Client, role, permissions, options).ConfigureAwait(false); | |||
_overwrites = _overwrites.Add(new Overwrite(role.Id, PermissionTarget.Role, new OverwritePermissions(permissions.AllowValue, permissions.DenyValue))); | |||
} | |||
/// <summary> | |||
@@ -151,7 +151,7 @@ namespace Discord.WebSocket | |||
/// </returns> | |||
public async Task RemovePermissionOverwriteAsync(IUser user, RequestOptions options = null) | |||
{ | |||
await ChannelHelper.RemovePermissionOverwriteAsync(this, Discord, user, options).ConfigureAwait(false); | |||
await ChannelHelper.RemovePermissionOverwriteAsync(this, Client, user, options).ConfigureAwait(false); | |||
for (int i = 0; i < _overwrites.Length; i++) | |||
{ | |||
@@ -172,7 +172,7 @@ namespace Discord.WebSocket | |||
/// </returns> | |||
public async Task RemovePermissionOverwriteAsync(IRole role, RequestOptions options = null) | |||
{ | |||
await ChannelHelper.RemovePermissionOverwriteAsync(this, Discord, role, options).ConfigureAwait(false); | |||
await ChannelHelper.RemovePermissionOverwriteAsync(this, Client, role, options).ConfigureAwait(false); | |||
for (int i = 0; i < _overwrites.Length; i++) | |||
{ | |||
@@ -34,7 +34,7 @@ namespace Discord.WebSocket | |||
=> CategoryId.HasValue ? Guild.GetChannel(CategoryId.Value) as ICategoryChannel : null; | |||
/// <inheritdoc /> | |||
public Task SyncPermissionsAsync(RequestOptions options = null) | |||
=> ChannelHelper.SyncPermissionsAsync(this, Discord, options); | |||
=> ChannelHelper.SyncPermissionsAsync(this, Client, options); | |||
private bool _nsfw; | |||
/// <inheritdoc /> | |||
@@ -53,12 +53,12 @@ namespace Discord.WebSocket | |||
internal SocketTextChannel(DiscordSocketClient discord, ulong id, SocketGuild guild) | |||
: base(discord, id, guild) | |||
{ | |||
if (Discord.MessageCacheSize > 0) | |||
_messages = new MessageCache(Discord); | |||
if (Client.MessageCacheSize > 0) | |||
_messages = new MessageCache(Client); | |||
} | |||
internal new static SocketTextChannel Create(SocketGuild guild, ClientState state, Model model) | |||
{ | |||
var entity = new SocketTextChannel(guild.Discord, model.Id, guild); | |||
var entity = new SocketTextChannel(guild.Client, model.Id, guild); | |||
entity.Update(state, model); | |||
return entity; | |||
} | |||
@@ -73,7 +73,7 @@ namespace Discord.WebSocket | |||
/// <inheritdoc /> | |||
public Task ModifyAsync(Action<TextChannelProperties> func, RequestOptions options = null) | |||
=> ChannelHelper.ModifyAsync(this, Discord, func, options); | |||
=> ChannelHelper.ModifyAsync(this, Client, func, options); | |||
//Messages | |||
/// <inheritdoc /> | |||
@@ -96,7 +96,7 @@ namespace Discord.WebSocket | |||
{ | |||
IMessage msg = _messages?.Get(id); | |||
if (msg == null) | |||
msg = await ChannelHelper.GetMessageAsync(this, Discord, id, options).ConfigureAwait(false); | |||
msg = await ChannelHelper.GetMessageAsync(this, Client, id, options).ConfigureAwait(false); | |||
return msg; | |||
} | |||
@@ -113,7 +113,7 @@ namespace Discord.WebSocket | |||
/// Paged collection of messages. | |||
/// </returns> | |||
public IAsyncEnumerable<IReadOnlyCollection<IMessage>> GetMessagesAsync(int limit = DiscordConfig.MaxMessagesPerBatch, RequestOptions options = null) | |||
=> SocketChannelHelper.GetMessagesAsync(this, Discord, _messages, null, Direction.Before, limit, CacheMode.AllowDownload, options); | |||
=> SocketChannelHelper.GetMessagesAsync(this, Client, _messages, null, Direction.Before, limit, CacheMode.AllowDownload, options); | |||
/// <summary> | |||
/// Gets a collection of messages in this channel. | |||
/// </summary> | |||
@@ -129,7 +129,7 @@ namespace Discord.WebSocket | |||
/// Paged collection of messages. | |||
/// </returns> | |||
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); | |||
=> SocketChannelHelper.GetMessagesAsync(this, Client, _messages, fromMessageId, dir, limit, CacheMode.AllowDownload, options); | |||
/// <summary> | |||
/// Gets a collection of messages in this channel. | |||
/// </summary> | |||
@@ -145,54 +145,54 @@ namespace Discord.WebSocket | |||
/// Paged collection of messages. | |||
/// </returns> | |||
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); | |||
=> SocketChannelHelper.GetMessagesAsync(this, Client, _messages, fromMessage.Id, dir, limit, CacheMode.AllowDownload, options); | |||
/// <inheritdoc /> | |||
public IReadOnlyCollection<SocketMessage> GetCachedMessages(int limit = DiscordConfig.MaxMessagesPerBatch) | |||
=> SocketChannelHelper.GetCachedMessages(this, Discord, _messages, null, Direction.Before, limit); | |||
=> SocketChannelHelper.GetCachedMessages(this, Client, _messages, null, Direction.Before, limit); | |||
/// <inheritdoc /> | |||
public IReadOnlyCollection<SocketMessage> GetCachedMessages(ulong fromMessageId, Direction dir, int limit = DiscordConfig.MaxMessagesPerBatch) | |||
=> SocketChannelHelper.GetCachedMessages(this, Discord, _messages, fromMessageId, dir, limit); | |||
=> SocketChannelHelper.GetCachedMessages(this, Client, _messages, fromMessageId, dir, limit); | |||
/// <inheritdoc /> | |||
public IReadOnlyCollection<SocketMessage> GetCachedMessages(IMessage fromMessage, Direction dir, int limit = DiscordConfig.MaxMessagesPerBatch) | |||
=> SocketChannelHelper.GetCachedMessages(this, Discord, _messages, fromMessage.Id, dir, limit); | |||
=> SocketChannelHelper.GetCachedMessages(this, Client, _messages, fromMessage.Id, dir, limit); | |||
/// <inheritdoc /> | |||
public Task<IReadOnlyCollection<RestMessage>> GetPinnedMessagesAsync(RequestOptions options = null) | |||
=> ChannelHelper.GetPinnedMessagesAsync(this, Discord, options); | |||
=> ChannelHelper.GetPinnedMessagesAsync(this, Client, options); | |||
/// <inheritdoc /> | |||
/// <exception cref="ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="DiscordConfig.MaxMessageSize"/>.</exception> | |||
public Task<RestUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null) | |||
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, options); | |||
=> ChannelHelper.SendMessageAsync(this, Client, text, isTTS, embed, options); | |||
/// <inheritdoc /> | |||
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); | |||
=> ChannelHelper.SendFileAsync(this, Client, filePath, text, isTTS, embed, options); | |||
/// <inheritdoc /> | |||
/// <exception cref="ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="DiscordConfig.MaxMessageSize"/>.</exception> | |||
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); | |||
=> ChannelHelper.SendFileAsync(this, Client, stream, filename, text, isTTS, embed, options); | |||
/// <inheritdoc /> | |||
public Task DeleteMessagesAsync(IEnumerable<IMessage> messages, RequestOptions options = null) | |||
=> ChannelHelper.DeleteMessagesAsync(this, Discord, messages.Select(x => x.Id), options); | |||
=> ChannelHelper.DeleteMessagesAsync(this, Client, messages.Select(x => x.Id), options); | |||
/// <inheritdoc /> | |||
public Task DeleteMessagesAsync(IEnumerable<ulong> messageIds, RequestOptions options = null) | |||
=> ChannelHelper.DeleteMessagesAsync(this, Discord, messageIds, options); | |||
=> ChannelHelper.DeleteMessagesAsync(this, Client, messageIds, options); | |||
/// <inheritdoc /> | |||
public Task DeleteMessageAsync(ulong messageId, RequestOptions options = null) | |||
=> ChannelHelper.DeleteMessageAsync(this, messageId, Discord, options); | |||
=> ChannelHelper.DeleteMessageAsync(this, messageId, Client, options); | |||
/// <inheritdoc /> | |||
public Task DeleteMessageAsync(IMessage message, RequestOptions options = null) | |||
=> ChannelHelper.DeleteMessageAsync(this, message.Id, Discord, options); | |||
=> ChannelHelper.DeleteMessageAsync(this, message.Id, Client, options); | |||
/// <inheritdoc /> | |||
public Task TriggerTypingAsync(RequestOptions options = null) | |||
=> ChannelHelper.TriggerTypingAsync(this, Discord, options); | |||
=> ChannelHelper.TriggerTypingAsync(this, Client, options); | |||
/// <inheritdoc /> | |||
public IDisposable EnterTypingState(RequestOptions options = null) | |||
=> ChannelHelper.EnterTypingState(this, Discord, options); | |||
=> ChannelHelper.EnterTypingState(this, Client, options); | |||
internal void AddMessage(SocketMessage msg) | |||
=> _messages?.Add(msg); | |||
@@ -226,7 +226,7 @@ namespace Discord.WebSocket | |||
/// webhook. | |||
/// </returns> | |||
public Task<RestWebhook> CreateWebhookAsync(string name, Stream avatar = null, RequestOptions options = null) | |||
=> ChannelHelper.CreateWebhookAsync(this, Discord, name, avatar, options); | |||
=> ChannelHelper.CreateWebhookAsync(this, Client, name, avatar, options); | |||
/// <summary> | |||
/// Gets a webhook available in this text channel. | |||
/// </summary> | |||
@@ -237,7 +237,7 @@ namespace Discord.WebSocket | |||
/// with the identifier; <c>null</c> if the webhook is not found. | |||
/// </returns> | |||
public Task<RestWebhook> GetWebhookAsync(ulong id, RequestOptions options = null) | |||
=> ChannelHelper.GetWebhookAsync(this, Discord, id, options); | |||
=> ChannelHelper.GetWebhookAsync(this, Client, id, options); | |||
/// <summary> | |||
/// Gets the webhooks available in this text channel. | |||
/// </summary> | |||
@@ -247,15 +247,15 @@ namespace Discord.WebSocket | |||
/// of webhooks that is available in this channel. | |||
/// </returns> | |||
public Task<IReadOnlyCollection<RestWebhook>> GetWebhooksAsync(RequestOptions options = null) | |||
=> ChannelHelper.GetWebhooksAsync(this, Discord, options); | |||
=> ChannelHelper.GetWebhooksAsync(this, Client, options); | |||
//Invites | |||
/// <inheritdoc /> | |||
public async Task<IInviteMetadata> CreateInviteAsync(int? maxAge = 86400, int? maxUses = null, bool isTemporary = false, bool isUnique = false, RequestOptions options = null) | |||
=> await ChannelHelper.CreateInviteAsync(this, Discord, maxAge, maxUses, isTemporary, isUnique, options).ConfigureAwait(false); | |||
=> await ChannelHelper.CreateInviteAsync(this, Client, maxAge, maxUses, isTemporary, isUnique, options).ConfigureAwait(false); | |||
/// <inheritdoc /> | |||
public async Task<IReadOnlyCollection<IInviteMetadata>> GetInvitesAsync(RequestOptions options = null) | |||
=> await ChannelHelper.GetInvitesAsync(this, Discord, options).ConfigureAwait(false); | |||
=> await ChannelHelper.GetInvitesAsync(this, Client, options).ConfigureAwait(false); | |||
private string DebuggerDisplay => $"{Name} ({Id}, Text)"; | |||
internal new SocketTextChannel Clone() => MemberwiseClone() as SocketTextChannel; | |||
@@ -290,13 +290,13 @@ namespace Discord.WebSocket | |||
} | |||
/// <inheritdoc /> | |||
IAsyncEnumerable<IReadOnlyCollection<IMessage>> IMessageChannel.GetMessagesAsync(int limit, CacheMode mode, RequestOptions options) | |||
=> SocketChannelHelper.GetMessagesAsync(this, Discord, _messages, null, Direction.Before, limit, mode, options); | |||
=> SocketChannelHelper.GetMessagesAsync(this, Client, _messages, null, Direction.Before, limit, mode, options); | |||
/// <inheritdoc /> | |||
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); | |||
=> SocketChannelHelper.GetMessagesAsync(this, Client, _messages, fromMessageId, dir, limit, mode, options); | |||
/// <inheritdoc /> | |||
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); | |||
=> SocketChannelHelper.GetMessagesAsync(this, Client, _messages, fromMessage.Id, dir, limit, mode, options); | |||
/// <inheritdoc /> | |||
async Task<IReadOnlyCollection<IMessage>> IMessageChannel.GetPinnedMessagesAsync(RequestOptions options) | |||
=> await GetPinnedMessagesAsync(options).ConfigureAwait(false); | |||
@@ -32,7 +32,7 @@ namespace Discord.WebSocket | |||
=> CategoryId.HasValue ? Guild.GetChannel(CategoryId.Value) as ICategoryChannel : null; | |||
/// <inheritdoc /> | |||
public Task SyncPermissionsAsync(RequestOptions options = null) | |||
=> ChannelHelper.SyncPermissionsAsync(this, Discord, options); | |||
=> ChannelHelper.SyncPermissionsAsync(this, Client, options); | |||
/// <inheritdoc /> | |||
public override IReadOnlyCollection<SocketGuildUser> Users | |||
@@ -44,7 +44,7 @@ namespace Discord.WebSocket | |||
} | |||
internal new static SocketVoiceChannel Create(SocketGuild guild, ClientState state, Model model) | |||
{ | |||
var entity = new SocketVoiceChannel(guild.Discord, model.Id, guild); | |||
var entity = new SocketVoiceChannel(guild.Client, model.Id, guild); | |||
entity.Update(state, model); | |||
return entity; | |||
} | |||
@@ -59,7 +59,7 @@ namespace Discord.WebSocket | |||
/// <inheritdoc /> | |||
public Task ModifyAsync(Action<VoiceChannelProperties> func, RequestOptions options = null) | |||
=> ChannelHelper.ModifyAsync(this, Discord, func, options); | |||
=> ChannelHelper.ModifyAsync(this, Client, func, options); | |||
/// <inheritdoc /> | |||
public async Task<IAudioClient> ConnectAsync(bool selfDeaf = false, bool selfMute = false, bool external = false) | |||
@@ -83,10 +83,10 @@ namespace Discord.WebSocket | |||
//Invites | |||
/// <inheritdoc /> | |||
public async Task<IInviteMetadata> CreateInviteAsync(int? maxAge = 86400, int? maxUses = null, bool isTemporary = false, bool isUnique = false, RequestOptions options = null) | |||
=> await ChannelHelper.CreateInviteAsync(this, Discord, maxAge, maxUses, isTemporary, isUnique, options).ConfigureAwait(false); | |||
=> await ChannelHelper.CreateInviteAsync(this, Client, maxAge, maxUses, isTemporary, isUnique, options).ConfigureAwait(false); | |||
/// <inheritdoc /> | |||
public async Task<IReadOnlyCollection<IInviteMetadata>> GetInvitesAsync(RequestOptions options = null) | |||
=> await ChannelHelper.GetInvitesAsync(this, Discord, options).ConfigureAwait(false); | |||
=> await ChannelHelper.GetInvitesAsync(this, Client, options).ConfigureAwait(false); | |||
private string DebuggerDisplay => $"{Name} ({Id}, Voice)"; | |||
internal new SocketVoiceChannel Clone() => MemberwiseClone() as SocketVoiceChannel; | |||
@@ -197,7 +197,7 @@ namespace Discord.WebSocket | |||
/// <summary> | |||
/// Gets the current logged-in user. | |||
/// </summary> | |||
public SocketGuildUser CurrentUser => _members.TryGetValue(Discord.CurrentUser.Id, out SocketGuildUser member) ? member : null; | |||
public SocketGuildUser CurrentUser => _members.TryGetValue(Client.CurrentUser.Id, out SocketGuildUser member) ? member : null; | |||
/// <summary> | |||
/// Gets the built-in role containing all users in this guild. | |||
/// </summary> | |||
@@ -216,7 +216,7 @@ namespace Discord.WebSocket | |||
get | |||
{ | |||
var channels = _channels; | |||
var state = Discord.State; | |||
var state = Client.State; | |||
return channels.Select(x => state.GetChannel(x) as SocketGuildChannel).Where(x => x != null).ToReadOnlyCollection(channels); | |||
} | |||
} | |||
@@ -416,27 +416,27 @@ namespace Discord.WebSocket | |||
//General | |||
/// <inheritdoc /> | |||
public Task DeleteAsync(RequestOptions options = null) | |||
=> GuildHelper.DeleteAsync(this, Discord, options); | |||
=> GuildHelper.DeleteAsync(this, Client, options); | |||
/// <inheritdoc /> | |||
/// <exception cref="ArgumentNullException"><paramref name="func"/> is <c>null</c>.</exception> | |||
public Task ModifyAsync(Action<GuildProperties> func, RequestOptions options = null) | |||
=> GuildHelper.ModifyAsync(this, Discord, func, options); | |||
=> GuildHelper.ModifyAsync(this, Client, func, options); | |||
/// <inheritdoc /> | |||
/// <exception cref="ArgumentNullException"><paramref name="func"/> is <c>null</c>.</exception> | |||
public Task ModifyEmbedAsync(Action<GuildEmbedProperties> func, RequestOptions options = null) | |||
=> GuildHelper.ModifyEmbedAsync(this, Discord, func, options); | |||
=> GuildHelper.ModifyEmbedAsync(this, Client, func, options); | |||
/// <inheritdoc /> | |||
public Task ReorderChannelsAsync(IEnumerable<ReorderChannelProperties> args, RequestOptions options = null) | |||
=> GuildHelper.ReorderChannelsAsync(this, Discord, args, options); | |||
=> GuildHelper.ReorderChannelsAsync(this, Client, args, options); | |||
/// <inheritdoc /> | |||
public Task ReorderRolesAsync(IEnumerable<ReorderRoleProperties> args, RequestOptions options = null) | |||
=> GuildHelper.ReorderRolesAsync(this, Discord, args, options); | |||
=> GuildHelper.ReorderRolesAsync(this, Client, args, options); | |||
/// <inheritdoc /> | |||
public Task LeaveAsync(RequestOptions options = null) | |||
=> GuildHelper.LeaveAsync(this, Discord, options); | |||
=> GuildHelper.LeaveAsync(this, Client, options); | |||
//Bans | |||
/// <summary> | |||
@@ -449,7 +449,7 @@ namespace Discord.WebSocket | |||
/// behind the ban. | |||
/// </returns> | |||
public Task<IReadOnlyCollection<RestBan>> GetBansAsync(RequestOptions options = null) | |||
=> GuildHelper.GetBansAsync(this, Discord, options); | |||
=> GuildHelper.GetBansAsync(this, Client, options); | |||
/// <summary> | |||
/// Gets a ban object for a banned user. | |||
/// </summary> | |||
@@ -460,7 +460,7 @@ namespace Discord.WebSocket | |||
/// contains the user information and the reason for the ban; <c>null</c> if the ban entry cannot be found. | |||
/// </returns> | |||
public Task<RestBan> GetBanAsync(IUser user, RequestOptions options = null) | |||
=> GuildHelper.GetBanAsync(this, Discord, user.Id, options); | |||
=> GuildHelper.GetBanAsync(this, Client, user.Id, options); | |||
/// <summary> | |||
/// Gets a ban object for a banned user. | |||
/// </summary> | |||
@@ -471,21 +471,21 @@ namespace Discord.WebSocket | |||
/// contains the user information and the reason for the ban; <c>null</c> if the ban entry cannot be found. | |||
/// </returns> | |||
public Task<RestBan> GetBanAsync(ulong userId, RequestOptions options = null) | |||
=> GuildHelper.GetBanAsync(this, Discord, userId, options); | |||
=> GuildHelper.GetBanAsync(this, Client, userId, options); | |||
/// <inheritdoc /> | |||
public Task AddBanAsync(IUser user, int pruneDays = 0, string reason = null, RequestOptions options = null) | |||
=> GuildHelper.AddBanAsync(this, Discord, user.Id, pruneDays, reason, options); | |||
=> GuildHelper.AddBanAsync(this, Client, user.Id, pruneDays, reason, options); | |||
/// <inheritdoc /> | |||
public Task AddBanAsync(ulong userId, int pruneDays = 0, string reason = null, RequestOptions options = null) | |||
=> GuildHelper.AddBanAsync(this, Discord, userId, pruneDays, reason, options); | |||
=> GuildHelper.AddBanAsync(this, Client, userId, pruneDays, reason, options); | |||
/// <inheritdoc /> | |||
public Task RemoveBanAsync(IUser user, RequestOptions options = null) | |||
=> GuildHelper.RemoveBanAsync(this, Discord, user.Id, options); | |||
=> GuildHelper.RemoveBanAsync(this, Client, user.Id, options); | |||
/// <inheritdoc /> | |||
public Task RemoveBanAsync(ulong userId, RequestOptions options = null) | |||
=> GuildHelper.RemoveBanAsync(this, Discord, userId, options); | |||
=> GuildHelper.RemoveBanAsync(this, Client, userId, options); | |||
//Channels | |||
/// <summary> | |||
@@ -497,7 +497,7 @@ namespace Discord.WebSocket | |||
/// </returns> | |||
public SocketGuildChannel GetChannel(ulong id) | |||
{ | |||
var channel = Discord.State.GetChannel(id) as SocketGuildChannel; | |||
var channel = Client.State.GetChannel(id) as SocketGuildChannel; | |||
if (channel?.Guild.Id == Id) | |||
return channel; | |||
return null; | |||
@@ -545,7 +545,7 @@ namespace Discord.WebSocket | |||
/// text channel. | |||
/// </returns> | |||
public Task<RestTextChannel> CreateTextChannelAsync(string name, Action<TextChannelProperties> func = null, RequestOptions options = null) | |||
=> GuildHelper.CreateTextChannelAsync(this, Discord, name, options, func); | |||
=> GuildHelper.CreateTextChannelAsync(this, Client, name, options, func); | |||
/// <summary> | |||
/// Creates a new voice channel in this guild. | |||
/// </summary> | |||
@@ -558,7 +558,7 @@ namespace Discord.WebSocket | |||
/// voice channel. | |||
/// </returns> | |||
public Task<RestVoiceChannel> CreateVoiceChannelAsync(string name, Action<VoiceChannelProperties> func = null, RequestOptions options = null) | |||
=> GuildHelper.CreateVoiceChannelAsync(this, Discord, name, options, func); | |||
=> GuildHelper.CreateVoiceChannelAsync(this, Client, name, options, func); | |||
/// <summary> | |||
/// Creates a new channel category in this guild. | |||
/// </summary> | |||
@@ -571,7 +571,7 @@ namespace Discord.WebSocket | |||
/// category channel. | |||
/// </returns> | |||
public Task<RestCategoryChannel> CreateCategoryChannelAsync(string name, Action<GuildChannelProperties> func = null, RequestOptions options = null) | |||
=> GuildHelper.CreateCategoryChannelAsync(this, Discord, name, options, func); | |||
=> GuildHelper.CreateCategoryChannelAsync(this, Client, name, options, func); | |||
internal SocketGuildChannel AddChannel(ClientState state, ChannelModel model) | |||
{ | |||
@@ -597,13 +597,13 @@ namespace Discord.WebSocket | |||
/// voice regions the guild can access. | |||
/// </returns> | |||
public Task<IReadOnlyCollection<RestVoiceRegion>> GetVoiceRegionsAsync(RequestOptions options = null) | |||
=> GuildHelper.GetVoiceRegionsAsync(this, Discord, options); | |||
=> GuildHelper.GetVoiceRegionsAsync(this, Client, options); | |||
//Integrations | |||
public Task<IReadOnlyCollection<RestGuildIntegration>> GetIntegrationsAsync(RequestOptions options = null) | |||
=> GuildHelper.GetIntegrationsAsync(this, Discord, options); | |||
=> GuildHelper.GetIntegrationsAsync(this, Client, options); | |||
public Task<RestGuildIntegration> CreateIntegrationAsync(ulong id, string type, RequestOptions options = null) | |||
=> GuildHelper.CreateIntegrationAsync(this, Discord, id, type, options); | |||
=> GuildHelper.CreateIntegrationAsync(this, Client, id, type, options); | |||
//Invites | |||
/// <summary> | |||
@@ -615,7 +615,7 @@ namespace Discord.WebSocket | |||
/// invite metadata, each representing information for an invite found within this guild. | |||
/// </returns> | |||
public Task<IReadOnlyCollection<RestInviteMetadata>> GetInvitesAsync(RequestOptions options = null) | |||
=> GuildHelper.GetInvitesAsync(this, Discord, options); | |||
=> GuildHelper.GetInvitesAsync(this, Client, options); | |||
/// <summary> | |||
/// Gets the vanity invite URL of this guild. | |||
/// </summary> | |||
@@ -625,7 +625,7 @@ namespace Discord.WebSocket | |||
/// the vanity invite found within this guild; <c>null</c> if none is found. | |||
/// </returns> | |||
public Task<RestInviteMetadata> GetVanityInviteAsync(RequestOptions options = null) | |||
=> GuildHelper.GetVanityInviteAsync(this, Discord, options); | |||
=> GuildHelper.GetVanityInviteAsync(this, Client, options); | |||
//Roles | |||
/// <summary> | |||
@@ -657,10 +657,10 @@ namespace Discord.WebSocket | |||
/// </returns> | |||
public Task<RestRole> CreateRoleAsync(string name, GuildPermissions? permissions = default(GuildPermissions?), Color? color = default(Color?), | |||
bool isHoisted = false, RequestOptions options = null) | |||
=> GuildHelper.CreateRoleAsync(this, Discord, name, permissions, color, isHoisted, options); | |||
=> GuildHelper.CreateRoleAsync(this, Client, name, permissions, color, isHoisted, options); | |||
internal SocketRole AddRole(RoleModel model) | |||
{ | |||
var role = SocketRole.Create(this, Discord.State, model); | |||
var role = SocketRole.Create(this, Client.State, model); | |||
_roles[model.Id] = role; | |||
return role; | |||
} | |||
@@ -674,7 +674,7 @@ namespace Discord.WebSocket | |||
//Users | |||
/// <inheritdoc /> | |||
public Task<RestGuildUser> AddGuildUserAsync(ulong id, string accessToken, Action<AddGuildUserProperties> func = null, RequestOptions options = null) | |||
=> GuildHelper.AddGuildUserAsync(this, Discord, id, accessToken, func, options); | |||
=> GuildHelper.AddGuildUserAsync(this, Client, id, accessToken, func, options); | |||
/// <summary> | |||
/// Gets a user from this guild. | |||
@@ -698,15 +698,15 @@ namespace Discord.WebSocket | |||
} | |||
/// <inheritdoc /> | |||
public Task<int> PruneUsersAsync(int days = 30, bool simulate = false, RequestOptions options = null) | |||
=> GuildHelper.PruneUsersAsync(this, Discord, days, simulate, options); | |||
=> GuildHelper.PruneUsersAsync(this, Client, days, simulate, options); | |||
internal SocketGuildUser AddOrUpdateUser(UserModel model) | |||
{ | |||
if (_members.TryGetValue(model.Id, out SocketGuildUser member)) | |||
member.GlobalUser?.Update(Discord.State, model); | |||
member.GlobalUser?.Update(Client.State, model); | |||
else | |||
{ | |||
member = SocketGuildUser.Create(this, Discord.State, model); | |||
member = SocketGuildUser.Create(this, Client.State, model); | |||
member.GlobalUser.AddRef(); | |||
_members[member.Id] = member; | |||
DownloadedMemberCount++; | |||
@@ -716,10 +716,10 @@ namespace Discord.WebSocket | |||
internal SocketGuildUser AddOrUpdateUser(MemberModel model) | |||
{ | |||
if (_members.TryGetValue(model.User.Id, out SocketGuildUser member)) | |||
member.Update(Discord.State, model); | |||
member.Update(Client.State, model); | |||
else | |||
{ | |||
member = SocketGuildUser.Create(this, Discord.State, model); | |||
member = SocketGuildUser.Create(this, Client.State, model); | |||
member.GlobalUser.AddRef(); | |||
_members[member.Id] = member; | |||
DownloadedMemberCount++; | |||
@@ -729,10 +729,10 @@ namespace Discord.WebSocket | |||
internal SocketGuildUser AddOrUpdateUser(PresenceModel model) | |||
{ | |||
if (_members.TryGetValue(model.User.Id, out SocketGuildUser member)) | |||
member.Update(Discord.State, model, false); | |||
member.Update(Client.State, model, false); | |||
else | |||
{ | |||
member = SocketGuildUser.Create(this, Discord.State, model); | |||
member = SocketGuildUser.Create(this, Client.State, model); | |||
member.GlobalUser.AddRef(); | |||
_members[member.Id] = member; | |||
DownloadedMemberCount++; | |||
@@ -744,7 +744,7 @@ namespace Discord.WebSocket | |||
if (_members.TryRemove(id, out SocketGuildUser member)) | |||
{ | |||
DownloadedMemberCount--; | |||
member.GlobalUser.RemoveRef(Discord); | |||
member.GlobalUser.RemoveRef(Client); | |||
return member; | |||
} | |||
return null; | |||
@@ -753,7 +753,7 @@ namespace Discord.WebSocket | |||
/// <inheritdoc /> | |||
public async Task DownloadUsersAsync() | |||
{ | |||
await Discord.DownloadUsersAsync(new[] { this }).ConfigureAwait(false); | |||
await Client.DownloadUsersAsync(new[] { this }).ConfigureAwait(false); | |||
} | |||
internal void CompleteDownloadUsers() | |||
{ | |||
@@ -771,7 +771,7 @@ namespace Discord.WebSocket | |||
/// of the requested audit log entries. | |||
/// </returns> | |||
public IAsyncEnumerable<IReadOnlyCollection<RestAuditLogEntry>> GetAuditLogsAsync(int limit, RequestOptions options = null) | |||
=> GuildHelper.GetAuditLogsAsync(this, Discord, null, limit, options); | |||
=> GuildHelper.GetAuditLogsAsync(this, Client, null, limit, options); | |||
//Webhooks | |||
/// <summary> | |||
@@ -784,7 +784,7 @@ namespace Discord.WebSocket | |||
/// specified <paramref name="id"/>; <c>null</c> if none is found. | |||
/// </returns> | |||
public Task<RestWebhook> GetWebhookAsync(ulong id, RequestOptions options = null) | |||
=> GuildHelper.GetWebhookAsync(this, Discord, id, options); | |||
=> GuildHelper.GetWebhookAsync(this, Client, id, options); | |||
/// <summary> | |||
/// Gets a collection of all webhook from this guild. | |||
/// </summary> | |||
@@ -794,22 +794,22 @@ namespace Discord.WebSocket | |||
/// of webhooks found within the guild. | |||
/// </returns> | |||
public Task<IReadOnlyCollection<RestWebhook>> GetWebhooksAsync(RequestOptions options = null) | |||
=> GuildHelper.GetWebhooksAsync(this, Discord, options); | |||
=> GuildHelper.GetWebhooksAsync(this, Client, options); | |||
//Emotes | |||
/// <inheritdoc /> | |||
public Task<GuildEmote> GetEmoteAsync(ulong id, RequestOptions options = null) | |||
=> GuildHelper.GetEmoteAsync(this, Discord, id, options); | |||
=> GuildHelper.GetEmoteAsync(this, Client, id, options); | |||
/// <inheritdoc /> | |||
public Task<GuildEmote> CreateEmoteAsync(string name, Image image, Optional<IEnumerable<IRole>> roles = default(Optional<IEnumerable<IRole>>), RequestOptions options = null) | |||
=> GuildHelper.CreateEmoteAsync(this, Discord, name, image, roles, options); | |||
=> GuildHelper.CreateEmoteAsync(this, Client, name, image, roles, options); | |||
/// <inheritdoc /> | |||
/// <exception cref="ArgumentNullException"><paramref name="func"/> is <c>null</c>.</exception> | |||
public Task<GuildEmote> ModifyEmoteAsync(GuildEmote emote, Action<EmoteProperties> func, RequestOptions options = null) | |||
=> GuildHelper.ModifyEmoteAsync(this, Discord, emote.Id, func, options); | |||
=> GuildHelper.ModifyEmoteAsync(this, Client, emote.Id, func, options); | |||
/// <inheritdoc /> | |||
public Task DeleteEmoteAsync(GuildEmote emote, RequestOptions options = null) | |||
=> GuildHelper.DeleteEmoteAsync(this, Discord, emote.Id, options); | |||
=> GuildHelper.DeleteEmoteAsync(this, Client, emote.Id, options); | |||
//Voice States | |||
internal async Task<SocketVoiceState> AddOrUpdateVoiceStateAsync(ClientState state, VoiceStateModel model) | |||
@@ -876,14 +876,14 @@ namespace Discord.WebSocket | |||
{ | |||
#pragma warning disable IDISP001 | |||
var _ = promise.TrySetResultAsync(null); | |||
await Discord.ApiClient.SendVoiceStateUpdateAsync(Id, channelId, selfDeaf, selfMute).ConfigureAwait(false); | |||
await Client.ApiClient.SendVoiceStateUpdateAsync(Id, channelId, selfDeaf, selfMute).ConfigureAwait(false); | |||
return null; | |||
#pragma warning restore IDISP001 | |||
} | |||
if (_audioClient == null) | |||
{ | |||
var audioClient = new AudioClient(this, Discord.GetAudioId(), channelId); | |||
var audioClient = new AudioClient(this, Client.GetAudioId(), channelId); | |||
audioClient.Disconnected += async ex => | |||
{ | |||
if (!promise.Task.IsCompleted) | |||
@@ -911,7 +911,7 @@ namespace Discord.WebSocket | |||
#pragma warning restore IDISP003 | |||
} | |||
await Discord.ApiClient.SendVoiceStateUpdateAsync(Id, channelId, selfDeaf, selfMute).ConfigureAwait(false); | |||
await Client.ApiClient.SendVoiceStateUpdateAsync(Id, channelId, selfDeaf, selfMute).ConfigureAwait(false); | |||
} | |||
catch | |||
{ | |||
@@ -955,14 +955,14 @@ namespace Discord.WebSocket | |||
_audioConnectPromise = null; | |||
if (_audioClient != null) | |||
await _audioClient.StopAsync().ConfigureAwait(false); | |||
await Discord.ApiClient.SendVoiceStateUpdateAsync(Id, null, false, false).ConfigureAwait(false); | |||
await Client.ApiClient.SendVoiceStateUpdateAsync(Id, null, false, false).ConfigureAwait(false); | |||
_audioClient?.Dispose(); | |||
_audioClient = null; | |||
} | |||
internal async Task FinishConnectAudio(string url, string token) | |||
{ | |||
//TODO: Mem Leak: Disconnected/Connected handlers arent cleaned up | |||
var voiceState = GetVoiceState(Discord.CurrentUser.Id).Value; | |||
var voiceState = GetVoiceState(Client.CurrentUser.Id).Value; | |||
await _audioLock.WaitAsync().ConfigureAwait(false); | |||
try | |||
@@ -970,7 +970,7 @@ namespace Discord.WebSocket | |||
if (_audioClient != null) | |||
{ | |||
await RepopulateAudioStreamsAsync().ConfigureAwait(false); | |||
await _audioClient.StartAsync(url, Discord.CurrentUser.Id, voiceState.VoiceSessionId, token).ConfigureAwait(false); | |||
await _audioClient.StartAsync(url, Client.CurrentUser.Id, voiceState.VoiceSessionId, token).ConfigureAwait(false); | |||
} | |||
} | |||
catch (OperationCanceledException) | |||
@@ -139,7 +139,7 @@ namespace Discord.WebSocket | |||
/// <inheritdoc /> | |||
public Task DeleteAsync(RequestOptions options = null) | |||
=> MessageHelper.DeleteAsync(this, Discord, options); | |||
=> MessageHelper.DeleteAsync(this, Client, options); | |||
/// <summary> | |||
/// Gets the content of the message. | |||
@@ -41,7 +41,7 @@ namespace Discord.WebSocket | |||
/// <inheritdoc /> | |||
public override IReadOnlyCollection<SocketUser> MentionedUsers => MessageHelper.FilterTagsByValue<SocketUser>(TagType.UserMention, _tags); | |||
/// <inheritdoc /> | |||
public IReadOnlyDictionary<IEmote, ReactionMetadata> Reactions => _reactions.GroupBy(r => r.Emote).ToDictionary(x => x.Key, x => new ReactionMetadata { ReactionCount = x.Count(), IsMe = x.Any(y => y.UserId == Discord.CurrentUser.Id) }); | |||
public IReadOnlyDictionary<IEmote, ReactionMetadata> Reactions => _reactions.GroupBy(r => r.Emote).ToDictionary(x => x.Key, x => new ReactionMetadata { ReactionCount = x.Count(), IsMe = x.Any(y => y.UserId == Client.CurrentUser.Id) }); | |||
internal SocketUserMessage(DiscordSocketClient discord, ulong id, ISocketMessageChannel channel, SocketUser author, MessageSource source) | |||
: base(discord, id, channel, author, source) | |||
@@ -106,7 +106,7 @@ namespace Discord.WebSocket | |||
{ | |||
var val = value[i]; | |||
if (val.Object != null) | |||
newMentions.Add(SocketUnknownUser.Create(Discord, state, val.Object)); | |||
newMentions.Add(SocketUnknownUser.Create(Client, state, val.Object)); | |||
} | |||
mentions = newMentions.ToImmutable(); | |||
} | |||
@@ -138,27 +138,27 @@ namespace Discord.WebSocket | |||
/// <exception cref="InvalidOperationException">Only the author of a message may modify the message.</exception> | |||
/// <exception cref="ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="DiscordConfig.MaxMessageSize"/>.</exception> | |||
public Task ModifyAsync(Action<MessageProperties> func, RequestOptions options = null) | |||
=> MessageHelper.ModifyAsync(this, Discord, func, options); | |||
=> MessageHelper.ModifyAsync(this, Client, func, options); | |||
/// <inheritdoc /> | |||
public Task AddReactionAsync(IEmote emote, RequestOptions options = null) | |||
=> MessageHelper.AddReactionAsync(this, emote, Discord, options); | |||
=> MessageHelper.AddReactionAsync(this, emote, Client, options); | |||
/// <inheritdoc /> | |||
public Task RemoveReactionAsync(IEmote emote, IUser user, RequestOptions options = null) | |||
=> MessageHelper.RemoveReactionAsync(this, user, emote, Discord, options); | |||
=> MessageHelper.RemoveReactionAsync(this, user, emote, Client, options); | |||
/// <inheritdoc /> | |||
public Task RemoveAllReactionsAsync(RequestOptions options = null) | |||
=> MessageHelper.RemoveAllReactionsAsync(this, Discord, options); | |||
=> MessageHelper.RemoveAllReactionsAsync(this, Client, options); | |||
/// <inheritdoc /> | |||
public IAsyncEnumerable<IReadOnlyCollection<IUser>> GetReactionUsersAsync(IEmote emote, int limit, RequestOptions options = null) | |||
=> MessageHelper.GetReactionUsersAsync(this, emote, limit, Discord, options); | |||
=> MessageHelper.GetReactionUsersAsync(this, emote, limit, Client, options); | |||
/// <inheritdoc /> | |||
public Task PinAsync(RequestOptions options = null) | |||
=> MessageHelper.PinAsync(this, Discord, options); | |||
=> MessageHelper.PinAsync(this, Client, options); | |||
/// <inheritdoc /> | |||
public Task UnpinAsync(RequestOptions options = null) | |||
=> MessageHelper.UnpinAsync(this, Discord, options); | |||
=> MessageHelper.UnpinAsync(this, Client, options); | |||
public string Resolve(int startIndex, TagHandling userHandling = TagHandling.Name, TagHandling channelHandling = TagHandling.Name, | |||
TagHandling roleHandling = TagHandling.Name, TagHandling everyoneHandling = TagHandling.Ignore, TagHandling emojiHandling = TagHandling.Name) | |||
@@ -52,7 +52,7 @@ namespace Discord.WebSocket | |||
=> Guild.Users.Where(x => x.Roles.Any(r => r.Id == Id)); | |||
internal SocketRole(SocketGuild guild, ulong id) | |||
: base(guild.Discord, id) | |||
: base(guild.Client, id) | |||
{ | |||
Guild = guild; | |||
} | |||
@@ -75,10 +75,10 @@ namespace Discord.WebSocket | |||
/// <inheritdoc /> | |||
public Task ModifyAsync(Action<RoleProperties> func, RequestOptions options = null) | |||
=> RoleHelper.ModifyAsync(this, Discord, func, options); | |||
=> RoleHelper.ModifyAsync(this, Client, func, options); | |||
/// <inheritdoc /> | |||
public Task DeleteAsync(RequestOptions options = null) | |||
=> RoleHelper.DeleteAsync(this, Discord, options); | |||
=> RoleHelper.DeleteAsync(this, Client, options); | |||
/// <summary> | |||
/// Gets the name of the role. | |||
@@ -5,13 +5,13 @@ namespace Discord.WebSocket | |||
public abstract class SocketEntity<T> : IEntity<T> | |||
where T : IEquatable<T> | |||
{ | |||
internal DiscordSocketClient Discord { get; } | |||
public DiscordSocketClient Client { get; } | |||
/// <inheritdoc /> | |||
public T Id { get; } | |||
internal SocketEntity(DiscordSocketClient discord, T id) | |||
{ | |||
Discord = discord; | |||
Client = discord; | |||
Id = id; | |||
} | |||
} | |||
@@ -31,14 +31,14 @@ namespace Discord.WebSocket | |||
public override bool IsWebhook => false; | |||
internal SocketGroupUser(SocketGroupChannel channel, SocketGlobalUser globalUser) | |||
: base(channel.Discord, globalUser.Id) | |||
: base(channel.Client, globalUser.Id) | |||
{ | |||
Channel = channel; | |||
GlobalUser = globalUser; | |||
} | |||
internal static SocketGroupUser Create(SocketGroupChannel channel, ClientState state, Model model) | |||
{ | |||
var entity = new SocketGroupUser(channel, channel.Discord.GetOrCreateUser(state, model)); | |||
var entity = new SocketGroupUser(channel, channel.Client.GetOrCreateUser(state, model)); | |||
entity.Update(state, model); | |||
return entity; | |||
} | |||
@@ -102,27 +102,27 @@ namespace Discord.WebSocket | |||
} | |||
internal SocketGuildUser(SocketGuild guild, SocketGlobalUser globalUser) | |||
: base(guild.Discord, globalUser.Id) | |||
: base(guild.Client, globalUser.Id) | |||
{ | |||
Guild = guild; | |||
GlobalUser = globalUser; | |||
} | |||
internal static SocketGuildUser Create(SocketGuild guild, ClientState state, UserModel model) | |||
{ | |||
var entity = new SocketGuildUser(guild, guild.Discord.GetOrCreateUser(state, model)); | |||
var entity = new SocketGuildUser(guild, guild.Client.GetOrCreateUser(state, model)); | |||
entity.Update(state, model); | |||
entity.UpdateRoles(new ulong[0]); | |||
return entity; | |||
} | |||
internal static SocketGuildUser Create(SocketGuild guild, ClientState state, MemberModel model) | |||
{ | |||
var entity = new SocketGuildUser(guild, guild.Discord.GetOrCreateUser(state, model.User)); | |||
var entity = new SocketGuildUser(guild, guild.Client.GetOrCreateUser(state, model.User)); | |||
entity.Update(state, model); | |||
return entity; | |||
} | |||
internal static SocketGuildUser Create(SocketGuild guild, ClientState state, PresenceModel model) | |||
{ | |||
var entity = new SocketGuildUser(guild, guild.Discord.GetOrCreateUser(state, model.User)); | |||
var entity = new SocketGuildUser(guild, guild.Client.GetOrCreateUser(state, model.User)); | |||
entity.Update(state, model, false); | |||
return entity; | |||
} | |||
@@ -159,22 +159,22 @@ namespace Discord.WebSocket | |||
/// <inheritdoc /> | |||
public Task ModifyAsync(Action<GuildUserProperties> func, RequestOptions options = null) | |||
=> UserHelper.ModifyAsync(this, Discord, func, options); | |||
=> UserHelper.ModifyAsync(this, Client, func, options); | |||
/// <inheritdoc /> | |||
public Task KickAsync(string reason = null, RequestOptions options = null) | |||
=> UserHelper.KickAsync(this, Discord, reason, options); | |||
=> UserHelper.KickAsync(this, Client, reason, options); | |||
/// <inheritdoc /> | |||
public Task AddRoleAsync(IRole role, RequestOptions options = null) | |||
=> AddRolesAsync(new[] { role }, options); | |||
/// <inheritdoc /> | |||
public Task AddRolesAsync(IEnumerable<IRole> roles, RequestOptions options = null) | |||
=> UserHelper.AddRolesAsync(this, Discord, roles, options); | |||
=> UserHelper.AddRolesAsync(this, Client, roles, options); | |||
/// <inheritdoc /> | |||
public Task RemoveRoleAsync(IRole role, RequestOptions options = null) | |||
=> RemoveRolesAsync(new[] { role }, options); | |||
/// <inheritdoc /> | |||
public Task RemoveRolesAsync(IEnumerable<IRole> roles, RequestOptions options = null) | |||
=> UserHelper.RemoveRolesAsync(this, Discord, roles, options); | |||
=> UserHelper.RemoveRolesAsync(this, Client, roles, options); | |||
/// <inheritdoc /> | |||
public ChannelPermissions GetPermissions(IGuildChannel channel) | |||
@@ -68,7 +68,7 @@ namespace Discord.WebSocket | |||
/// <inheritdoc /> | |||
public Task ModifyAsync(Action<SelfUserProperties> func, RequestOptions options = null) | |||
=> UserHelper.ModifyAsync(this, Discord, func, options); | |||
=> UserHelper.ModifyAsync(this, Client, func, options); | |||
private string DebuggerDisplay => $"{Username}#{Discriminator} ({Id}{(IsBot ? ", Bot" : "")}, Self)"; | |||
internal new SocketSelfUser Clone() => MemberwiseClone() as SocketSelfUser; | |||
@@ -42,7 +42,7 @@ namespace Discord.WebSocket | |||
/// Gets mutual guilds shared with this user. | |||
/// </summary> | |||
public IReadOnlyCollection<SocketGuild> MutualGuilds | |||
=> Discord.Guilds.Where(g => g.Users.Any(u => u.Id == Id)).ToImmutableArray(); | |||
=> Client.Guilds.Where(g => g.Users.Any(u => u.Id == Id)).ToImmutableArray(); | |||
internal SocketUser(DiscordSocketClient discord, ulong id) | |||
: base(discord, id) | |||
@@ -80,7 +80,7 @@ namespace Discord.WebSocket | |||
/// <inheritdoc /> | |||
public async Task<IDMChannel> GetOrCreateDMChannelAsync(RequestOptions options = null) | |||
=> GlobalUser.DMChannel ?? await UserHelper.CreateDMChannelAsync(this, Discord, options).ConfigureAwait(false) as IDMChannel; | |||
=> GlobalUser.DMChannel ?? await UserHelper.CreateDMChannelAsync(this, Client, options).ConfigureAwait(false) as IDMChannel; | |||
/// <inheritdoc /> | |||
public string GetAvatarUrl(ImageFormat format = ImageFormat.Auto, ushort size = 128) | |||
@@ -35,7 +35,7 @@ namespace Discord.WebSocket | |||
throw new NotSupportedException(); | |||
internal SocketWebhookUser(SocketGuild guild, ulong id, ulong webhookId) | |||
: base(guild.Discord, id) | |||
: base(guild.Client, id) | |||
{ | |||
Guild = guild; | |||
WebhookId = webhookId; | |||