Renamed DownloadAllMembers -> DownloadAllUsers, fixed overriding CachedGuild's DownloadUsers
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user