Add -all flag in random command
This commit is contained in:
parent
687eaaa928
commit
f6d2f4b620
@ -1,5 +1,6 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
using PluralKit.Core;
|
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
|
//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
|
// 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<PKMember> 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())
|
if (members == null || !members.Any())
|
||||||
throw Errors.NoMembersError;
|
throw Errors.NoMembersError;
|
||||||
var randInt = randGen.Next(members.Count);
|
var randInt = randGen.Next(members.Count);
|
||||||
|
Loading…
Reference in New Issue
Block a user