Browse Source

Renamed DownloadAllMembers -> DownloadAllUsers, fixed overriding CachedGuild's DownloadUsers

tags/1.0-rc
RogueException 9 years ago
parent
commit
6d6af08815
3 changed files with 11 additions and 8 deletions
  1. +6
    -6
      src/Discord.Net/DiscordSocketClient.cs
  2. +4
    -1
      src/Discord.Net/Entities/Guilds/Guild.cs
  3. +1
    -1
      src/Discord.Net/Entities/WebSocket/CachedGuild.cs

+ 6
- 6
src/Discord.Net/DiscordSocketClient.cs View File

@@ -362,11 +362,11 @@ namespace Discord
return DataStore.RemoveUser(id);
}

/// <summary> Downloads the members list for all large guilds. </summary>
public Task DownloadAllMembersAsync()
=> DownloadMembersAsync(DataStore.Guilds.Where(x => !x.HasAllMembers));
/// <summary> Downloads the members list for the provided guilds, if they don't have a complete list. </summary>
public async Task DownloadMembersAsync(IEnumerable<IGuild> guilds)
/// <summary> Downloads the users list for all large guilds. </summary>
public Task DownloadAllUsersAsync()
=> DownloadUsersAsync(DataStore.Guilds.Where(x => !x.HasAllMembers));
/// <summary> Downloads the users list for the provided guilds, if they don't have a complete list. </summary>
public async Task DownloadUsersAsync(IEnumerable<IGuild> guilds)
{
const short batchSize = 50;
var cachedGuilds = guilds.Select(x => x as CachedGuild).ToArray();
@@ -374,7 +374,7 @@ namespace Discord
return;
else if (cachedGuilds.Length == 1)
{
await cachedGuilds[0].DownloadMembersAsync().ConfigureAwait(false);
await cachedGuilds[0].DownloadUsersAsync().ConfigureAwait(false);
return;
}



+ 4
- 1
src/Discord.Net/Entities/Guilds/Guild.cs View File

@@ -289,6 +289,10 @@ namespace Discord
model = await Discord.ApiClient.BeginGuildPruneAsync(Id, args).ConfigureAwait(false);
return model.Pruned;
}
public virtual Task DownloadUsersAsync()
{
throw new NotSupportedException();
}

internal GuildChannel ToChannel(API.Channel model)
{
@@ -311,7 +315,6 @@ namespace Discord
IRole IGuild.EveryoneRole => EveryoneRole;
IReadOnlyCollection<Emoji> IGuild.Emojis => Emojis;
IReadOnlyCollection<string> IGuild.Features => Features;
Task IGuild.DownloadUsersAsync() { throw new NotSupportedException(); }
IAudioClient IGuild.AudioClient => null;

IRole IGuild.GetRole(ulong id) => GetRole(id);


+ 1
- 1
src/Discord.Net/Entities/WebSocket/CachedGuild.cs View File

@@ -206,7 +206,7 @@ namespace Discord
return member;
return null;
}
public async Task DownloadMembersAsync()
public override async Task DownloadUsersAsync()
{
if (!HasAllMembers)
await Discord.ApiClient.SendRequestMembersAsync(new ulong[] { Id }).ConfigureAwait(false);


Loading…
Cancel
Save