From 68af66b16d7acbb22010e72618671f8fcd30dae3 Mon Sep 17 00:00:00 2001 From: Madpeter Date: Mon, 26 Oct 2020 04:13:40 +0000 Subject: [PATCH] cleanup and fast check support --- Core/Commands/Group/IsGroupMember.cs | 47 ++++++++++++++++++---------- 1 file changed, 31 insertions(+), 16 deletions(-) diff --git a/Core/Commands/Group/IsGroupMember.cs b/Core/Commands/Group/IsGroupMember.cs index f82ff3b..26f80b3 100644 --- a/Core/Commands/Group/IsGroupMember.cs +++ b/Core/Commands/Group/IsGroupMember.cs @@ -19,23 +19,36 @@ namespace BSB.Commands.Group { if (UUID.TryParse(args[2], out UUID testavatar) == true) { - if (bot.MyGroups.ContainsKey(targetgroup) == true) + if (bot.FastCheckInGroup(targetgroup, testavatar) == true) { - if (bot.CreateAwaitEventReply("groupmembersreply", this, args) == true) + Dictionary reply = new Dictionary { - bot.GetClient.Groups.RequestGroupMembers(targetgroup); - InfoBlob = "Requesting group membership"; - return true; - } - else - { - return Failed("Unable to await reply"); - } - + { "group", args[0] }, + { "avatar", args[2] }, + { "ingroup", "1" } + }; + return bot.GetCommandsInterface.SmartCommandReply(true, args[1], JsonConvert.SerializeObject(reply), CommandName); } else { - return Failed("Unknown group"); + if (bot.MyGroups.ContainsKey(targetgroup) == true) + { + if (bot.CreateAwaitEventReply("groupmembersreply", this, args) == true) + { + bot.GetClient.Groups.RequestGroupMembers(targetgroup); + InfoBlob = "Requesting group membership"; + return true; + } + else + { + return Failed("Unable to await reply"); + } + + } + else + { + return Failed("Unknown group"); + } } } else @@ -65,10 +78,12 @@ namespace BSB.Commands.Group break; } } - Dictionary reply = new Dictionary(); - reply.Add("group", args[0]); - reply.Add("avatar", args[2]); - reply.Add("ingroup", return_status); + Dictionary reply = new Dictionary + { + { "group", args[0] }, + { "avatar", args[2] }, + { "ingroup", return_status } + }; bot.GetCommandsInterface.SmartCommandReply(true, args[1], JsonConvert.SerializeObject(reply), CommandName); } base.Callback(args, e);