Restrict pk;random to public members

This commit is contained in:
Ske 2020-01-14 12:41:28 +01:00
parent f10685acd4
commit 335f6203cc

View File

@ -65,7 +65,7 @@ namespace PluralKit.Bot.Commands
var randGen = new System.Random(); var randGen = new System.Random();
//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
var members = (await _data.GetSystemMembers(ctx.System)).ToList(); var members = (await _data.GetSystemMembers(ctx.System)).Where(m => m.MemberPrivacy == PrivacyLevel.Public).ToList();
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);