From 87ad36e2cf3004f7303089a20daa03025fc98144 Mon Sep 17 00:00:00 2001 From: Madpeterz <57852827+Madpeterz@users.noreply.github.com> Date: Mon, 22 Mar 2021 23:59:00 +0000 Subject: [PATCH] Update Group.cs adds group invite power check --- Core/Commands/Group.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Core/Commands/Group.cs b/Core/Commands/Group.cs index 80d230d..6ec3d1a 100644 --- a/Core/Commands/Group.cs +++ b/Core/Commands/Group.cs @@ -270,6 +270,15 @@ namespace BetterSecondBot.HttpService { return Failure("Unable to process role UUID", "GroupInvite", new string[] { group, avatar, role }); } + if(bot.MyGroups.ContainsKey(groupuuid) == false) + { + return Failure("Group missing from MyGroups", "GroupInvite", new string[] { group, avatar, role }); + } + Group G = bot.MyGroups[groupuuid]; + if(G.Powers.HasFlag(GroupPowers.Invite) == false) + { + return Failure("Missing group invite power", "GroupInvite", new string[] { group, avatar, role }); + } bot.GetClient.Groups.Invite(groupuuid, new List() { roleuuid }, avataruuid); return BasicReply("Invite sent", "GroupInvite", new string[] { group, avatar, role }); }