mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-08 06:47:56 +00:00
Upgrade various store methods to IAsyncEnumerable
This commit is contained in:
parent
9a3355eb4b
commit
8a689ac0f2
7 changed files with 62 additions and 38 deletions
|
|
@ -239,10 +239,13 @@ namespace PluralKit.Bot.Commands
|
|||
if (system == null) throw Errors.NoSystemError;
|
||||
ctx.CheckSystemPrivacy(system, system.FrontHistoryPrivacy);
|
||||
|
||||
var sws = (await _data.GetSwitches(system, 10)).ToList();
|
||||
if (sws.Count == 0) throw Errors.NoRegisteredSwitches;
|
||||
var sws = _data.GetSwitches(system).Take(10);
|
||||
var embed = await _embeds.CreateFrontHistoryEmbed(sws, system.Zone);
|
||||
|
||||
await ctx.Reply(embed: await _embeds.CreateFrontHistoryEmbed(sws, system.Zone));
|
||||
// Moving the count check to the CreateFrontHistoryEmbed function to avoid a double-iteration
|
||||
// If embed == null, then there's no switches, so error
|
||||
if (embed == null) throw Errors.NoRegisteredSwitches;
|
||||
await ctx.Reply(embed: embed);
|
||||
}
|
||||
|
||||
public async Task SystemFrontPercent(Context ctx, PKSystem system)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue