mirror of
https://github.com/NoiTheCat/BirthdayBot.git
synced 2024-11-21 21:54:36 +00:00
Add log message
This commit is contained in:
parent
c280904cb8
commit
2a1478fb0b
1 changed files with 5 additions and 1 deletions
|
@ -16,14 +16,18 @@ class AutoUserDownload : BackgroundService {
|
|||
// ...and if the guild contains any user data
|
||||
var mustFetch = db.UserEntries.Where(e => incompleteCaches.Contains(e.GuildId)).Select(e => e.GuildId).Distinct();
|
||||
|
||||
int processed = 0;
|
||||
foreach (var item in mustFetch) {
|
||||
// May cause a disconnect in certain situations. Cancel all further attempts until the next pass if it happens.
|
||||
if (ShardInstance.DiscordClient.ConnectionState != ConnectionState.Connected) return;
|
||||
if (ShardInstance.DiscordClient.ConnectionState != ConnectionState.Connected) break;
|
||||
|
||||
var guild = ShardInstance.DiscordClient.GetGuild((ulong)item);
|
||||
if (guild == null) continue; // A guild disappeared...?
|
||||
await guild.DownloadUsersAsync().ConfigureAwait(false); // We're already on a seperate thread, no need to use Task.Run
|
||||
await Task.Delay(200, CancellationToken.None).ConfigureAwait(false); // Must delay, or else it seems to hang...
|
||||
}
|
||||
processed++;
|
||||
}
|
||||
|
||||
if (processed > 0) Log($"Explicit user list request processed for {processed} guild(s).");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue