@@ -362,11 +362,11 @@ namespace Discord | |||||
return DataStore.RemoveUser(id); | 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; | const short batchSize = 50; | ||||
var cachedGuilds = guilds.Select(x => x as CachedGuild).ToArray(); | var cachedGuilds = guilds.Select(x => x as CachedGuild).ToArray(); | ||||
@@ -374,7 +374,7 @@ namespace Discord | |||||
return; | return; | ||||
else if (cachedGuilds.Length == 1) | else if (cachedGuilds.Length == 1) | ||||
{ | { | ||||
await cachedGuilds[0].DownloadMembersAsync().ConfigureAwait(false); | |||||
await cachedGuilds[0].DownloadUsersAsync().ConfigureAwait(false); | |||||
return; | return; | ||||
} | } | ||||
@@ -289,6 +289,10 @@ namespace Discord | |||||
model = await Discord.ApiClient.BeginGuildPruneAsync(Id, args).ConfigureAwait(false); | model = await Discord.ApiClient.BeginGuildPruneAsync(Id, args).ConfigureAwait(false); | ||||
return model.Pruned; | return model.Pruned; | ||||
} | } | ||||
public virtual Task DownloadUsersAsync() | |||||
{ | |||||
throw new NotSupportedException(); | |||||
} | |||||
internal GuildChannel ToChannel(API.Channel model) | internal GuildChannel ToChannel(API.Channel model) | ||||
{ | { | ||||
@@ -311,7 +315,6 @@ namespace Discord | |||||
IRole IGuild.EveryoneRole => EveryoneRole; | IRole IGuild.EveryoneRole => EveryoneRole; | ||||
IReadOnlyCollection<Emoji> IGuild.Emojis => Emojis; | IReadOnlyCollection<Emoji> IGuild.Emojis => Emojis; | ||||
IReadOnlyCollection<string> IGuild.Features => Features; | IReadOnlyCollection<string> IGuild.Features => Features; | ||||
Task IGuild.DownloadUsersAsync() { throw new NotSupportedException(); } | |||||
IAudioClient IGuild.AudioClient => null; | IAudioClient IGuild.AudioClient => null; | ||||
IRole IGuild.GetRole(ulong id) => GetRole(id); | IRole IGuild.GetRole(ulong id) => GetRole(id); | ||||
@@ -206,7 +206,7 @@ namespace Discord | |||||
return member; | return member; | ||||
return null; | return null; | ||||
} | } | ||||
public async Task DownloadMembersAsync() | |||||
public override async Task DownloadUsersAsync() | |||||
{ | { | ||||
if (!HasAllMembers) | if (!HasAllMembers) | ||||
await Discord.ApiClient.SendRequestMembersAsync(new ulong[] { Id }).ConfigureAwait(false); | await Discord.ApiClient.SendRequestMembersAsync(new ulong[] { Id }).ConfigureAwait(false); | ||||