From f6d2f4b6209b5d5ddeb56f3438cad4c6bf869a75 Mon Sep 17 00:00:00 2001 From: acw0 Date: Tue, 4 Aug 2020 18:43:17 -0400 Subject: [PATCH] Add -all flag in random command --- PluralKit.Bot/Commands/Member.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/PluralKit.Bot/Commands/Member.cs b/PluralKit.Bot/Commands/Member.cs index f9285f2b..92fb5dcb 100644 --- a/PluralKit.Bot/Commands/Member.cs +++ b/PluralKit.Bot/Commands/Member.cs @@ -1,5 +1,6 @@ using System.Linq; using System.Threading.Tasks; +using System.Collections.Generic; using PluralKit.Core; @@ -61,7 +62,11 @@ namespace PluralKit.Bot //Maybe move this somewhere else in the file structure since it doesn't need to get created at every command // TODO: don't buffer these, find something else to do ig - var members = await _data.GetSystemMembers(ctx.System).Where(m => m.MemberVisibility == PrivacyLevel.Public).ToListAsync(); + + List members; + if (ctx.MatchFlag("all", "a")) members = await _data.GetSystemMembers(ctx.System).ToListAsync(); + else members = await _data.GetSystemMembers(ctx.System).Where(m => m.MemberVisibility == PrivacyLevel.Public).ToListAsync(); + if (members == null || !members.Any()) throw Errors.NoMembersError; var randInt = randGen.Next(members.Count);