Remove IUpdateable.Update from WebSocket entities
This commit is contained in:
@@ -208,8 +208,8 @@
|
||||
<Compile Include="Rest\Entities\Users\SelfUser.cs" />
|
||||
<Compile Include="Rest\Entities\Users\User.cs" />
|
||||
<Compile Include="TokenType.cs" />
|
||||
<Compile Include="WebSocket\Caches\MessageCache.cs" />
|
||||
<Compile Include="WebSocket\Caches\ChannelPermissionsCache.cs" />
|
||||
<Compile Include="WebSocket\MessageCache.cs" />
|
||||
<Compile Include="WebSocket\ChannelPermissionsCache.cs" />
|
||||
<Compile Include="WebSocket\DiscordClient.cs" />
|
||||
<Compile Include="WebSocket\Entities\Channels\DMChannel.cs" />
|
||||
<Compile Include="WebSocket\Entities\Channels\GuildChannel.cs" />
|
||||
|
||||
@@ -140,15 +140,11 @@ namespace Discord.Rest
|
||||
/// <inheritdoc />
|
||||
public async Task ModifyChannels(IEnumerable<ModifyGuildChannelsParams> args)
|
||||
{
|
||||
if (args == null) throw new NullReferenceException(nameof(args));
|
||||
|
||||
await Discord.BaseClient.ModifyGuildChannels(Id, args).ConfigureAwait(false);
|
||||
}
|
||||
/// <inheritdoc />
|
||||
public async Task ModifyRoles(IEnumerable<ModifyGuildRolesParams> args)
|
||||
{
|
||||
if (args == null) throw new NullReferenceException(nameof(args));
|
||||
|
||||
{
|
||||
var models = await Discord.BaseClient.ModifyGuildRoles(Id, args).ConfigureAwait(false);
|
||||
Update(models);
|
||||
}
|
||||
|
||||
@@ -107,13 +107,6 @@ namespace Discord.WebSocket
|
||||
await Discord.BaseClient.DeleteChannel(Id).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task Update()
|
||||
{
|
||||
var model = await Discord.BaseClient.GetChannel(Id).ConfigureAwait(false);
|
||||
Update(model);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override string ToString() => $"@{Recipient} [DM]";
|
||||
|
||||
@@ -137,5 +130,7 @@ namespace Discord.WebSocket
|
||||
=> await SendFile(stream, filename, text, isTTS).ConfigureAwait(false);
|
||||
async Task IMessageChannel.TriggerTyping()
|
||||
=> await TriggerTyping().ConfigureAwait(false);
|
||||
Task IUpdateable.Update()
|
||||
=> Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,6 @@ namespace Discord.WebSocket
|
||||
var args = new ModifyGuildChannelParams();
|
||||
func(args);
|
||||
var model = await Discord.BaseClient.ModifyGuildChannel(Id, args).ConfigureAwait(false);
|
||||
Update(model);
|
||||
}
|
||||
|
||||
/// <summary> Gets a user in this channel with the given id. </summary>
|
||||
@@ -147,12 +146,6 @@ namespace Discord.WebSocket
|
||||
{
|
||||
await Discord.BaseClient.DeleteChannel(Id).ConfigureAwait(false);
|
||||
}
|
||||
/// <inheritdoc />
|
||||
public async Task Update()
|
||||
{
|
||||
var model = await Discord.BaseClient.GetChannel(Id).ConfigureAwait(false);
|
||||
Update(model);
|
||||
}
|
||||
|
||||
IGuild IGuildChannel.Guild => Guild;
|
||||
async Task<IGuildInvite> IGuildChannel.CreateInvite(int? maxAge, int? maxUses, bool isTemporary, bool withXkcd)
|
||||
@@ -167,5 +160,7 @@ namespace Discord.WebSocket
|
||||
=> await GetUsers().ConfigureAwait(false);
|
||||
async Task<IUser> IChannel.GetUser(ulong id)
|
||||
=> await GetUser(id).ConfigureAwait(false);
|
||||
Task IUpdateable.Update()
|
||||
=> Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,8 +36,7 @@ namespace Discord.WebSocket
|
||||
|
||||
var args = new ModifyTextChannelParams();
|
||||
func(args);
|
||||
var model = await Discord.BaseClient.ModifyGuildChannel(Id, args).ConfigureAwait(false);
|
||||
Update(model);
|
||||
await Discord.BaseClient.ModifyGuildChannel(Id, args).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
protected override async Task<IEnumerable<GuildUser>> GetUsers()
|
||||
|
||||
@@ -29,8 +29,7 @@ namespace Discord.WebSocket
|
||||
|
||||
var args = new ModifyVoiceChannelParams();
|
||||
func(args);
|
||||
var model = await Discord.BaseClient.ModifyGuildChannel(Id, args).ConfigureAwait(false);
|
||||
Update(model);
|
||||
await Discord.BaseClient.ModifyGuildChannel(Id, args).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
protected override async Task<IEnumerable<GuildUser>> GetUsers()
|
||||
|
||||
@@ -110,13 +110,7 @@ namespace Discord.WebSocket
|
||||
role.Update(model);
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task Update()
|
||||
{
|
||||
var response = await Discord.BaseClient.GetGuild(Id).ConfigureAwait(false);
|
||||
Update(response);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task Modify(Action<ModifyGuildParams> func)
|
||||
{
|
||||
@@ -124,8 +118,7 @@ namespace Discord.WebSocket
|
||||
|
||||
var args = new ModifyGuildParams();
|
||||
func(args);
|
||||
var model = await Discord.BaseClient.ModifyGuild(Id, args).ConfigureAwait(false);
|
||||
Update(model);
|
||||
await Discord.BaseClient.ModifyGuild(Id, args).ConfigureAwait(false);
|
||||
}
|
||||
/// <inheritdoc />
|
||||
public async Task ModifyEmbed(Action<ModifyGuildEmbedParams> func)
|
||||
@@ -134,24 +127,17 @@ namespace Discord.WebSocket
|
||||
|
||||
var args = new ModifyGuildEmbedParams();
|
||||
func(args);
|
||||
var model = await Discord.BaseClient.ModifyGuildEmbed(Id, args).ConfigureAwait(false);
|
||||
|
||||
Update(model);
|
||||
await Discord.BaseClient.ModifyGuildEmbed(Id, args).ConfigureAwait(false);
|
||||
}
|
||||
/// <inheritdoc />
|
||||
public async Task ModifyChannels(IEnumerable<ModifyGuildChannelsParams> args)
|
||||
{
|
||||
if (args == null) throw new NullReferenceException(nameof(args));
|
||||
|
||||
await Discord.BaseClient.ModifyGuildChannels(Id, args).ConfigureAwait(false);
|
||||
}
|
||||
/// <inheritdoc />
|
||||
public async Task ModifyRoles(IEnumerable<ModifyGuildRolesParams> args)
|
||||
{
|
||||
if (args == null) throw new NullReferenceException(nameof(args));
|
||||
|
||||
var models = await Discord.BaseClient.ModifyGuildRoles(Id, args).ConfigureAwait(false);
|
||||
Update(models);
|
||||
{
|
||||
await Discord.BaseClient.ModifyGuildRoles(Id, args).ConfigureAwait(false);
|
||||
}
|
||||
/// <inheritdoc />
|
||||
public async Task Leave()
|
||||
@@ -370,5 +356,7 @@ namespace Discord.WebSocket
|
||||
=> await GetCurrentUser().ConfigureAwait(false);
|
||||
async Task<IEnumerable<IGuildUser>> IGuild.GetUsers()
|
||||
=> await GetUsers().ConfigureAwait(false);
|
||||
Task IUpdateable.Update()
|
||||
=> Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,9 +67,7 @@ namespace Discord.WebSocket
|
||||
|
||||
var args = new ModifyGuildIntegrationParams();
|
||||
func(args);
|
||||
var model = await Discord.BaseClient.ModifyGuildIntegration(Guild.Id, Id, args).ConfigureAwait(false);
|
||||
|
||||
Update(model);
|
||||
await Discord.BaseClient.ModifyGuildIntegration(Guild.Id, Id, args).ConfigureAwait(false);
|
||||
}
|
||||
/// <summary> </summary>
|
||||
public async Task Sync()
|
||||
|
||||
@@ -120,13 +120,11 @@ namespace Discord.WebSocket
|
||||
var args = new ModifyMessageParams();
|
||||
func(args);
|
||||
var guildChannel = Channel as GuildChannel;
|
||||
|
||||
Model model;
|
||||
|
||||
if (guildChannel != null)
|
||||
model = await Discord.BaseClient.ModifyMessage(guildChannel.Guild.Id, Channel.Id, Id, args).ConfigureAwait(false);
|
||||
await Discord.BaseClient.ModifyMessage(guildChannel.Guild.Id, Channel.Id, Id, args).ConfigureAwait(false);
|
||||
else
|
||||
model = await Discord.BaseClient.ModifyMessage(Channel.Id, Id, args).ConfigureAwait(false);
|
||||
Update(model);
|
||||
await Discord.BaseClient.ModifyMessage(Channel.Id, Id, args).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -58,8 +58,7 @@ namespace Discord.WebSocket
|
||||
|
||||
var args = new ModifyGuildRoleParams();
|
||||
func(args);
|
||||
var response = await Discord.BaseClient.ModifyGuildRole(Guild.Id, Id, args).ConfigureAwait(false);
|
||||
Update(response);
|
||||
await Discord.BaseClient.ModifyGuildRole(Guild.Id, Id, args).ConfigureAwait(false);
|
||||
}
|
||||
/// <summary> Deletes this message. </summary>
|
||||
public async Task Delete()
|
||||
|
||||
@@ -46,12 +46,6 @@ namespace Discord.WebSocket
|
||||
_roles = roles.ToImmutable();
|
||||
}
|
||||
|
||||
public async Task Update()
|
||||
{
|
||||
var model = await Discord.BaseClient.GetGuildMember(Guild.Id, Id).ConfigureAwait(false);
|
||||
Update(model);
|
||||
}
|
||||
|
||||
public bool HasRole(IRole role)
|
||||
{
|
||||
for (int i = 0; i < _roles.Length; i++)
|
||||
@@ -113,5 +107,7 @@ namespace Discord.WebSocket
|
||||
|
||||
ChannelPermissions IGuildUser.GetPermissions(IGuildChannel channel)
|
||||
=> GetPermissions(channel);
|
||||
Task IUpdateable.Update()
|
||||
=> Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,14 +26,7 @@ namespace Discord.WebSocket
|
||||
Email = model.Email;
|
||||
IsVerified = model.IsVerified;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task Update()
|
||||
{
|
||||
var model = await Discord.BaseClient.GetCurrentUser().ConfigureAwait(false);
|
||||
Update(model);
|
||||
}
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task Modify(Action<ModifyCurrentUserParams> func)
|
||||
{
|
||||
@@ -41,8 +34,10 @@ namespace Discord.WebSocket
|
||||
|
||||
var args = new ModifyCurrentUserParams();
|
||||
func(args);
|
||||
var model = await Discord.BaseClient.ModifyCurrentUser(args).ConfigureAwait(false);
|
||||
Update(model);
|
||||
await Discord.BaseClient.ModifyCurrentUser(args).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
Task IUpdateable.Update()
|
||||
=> Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user