cleanup and fast check support

This commit is contained in:
Madpeter 2020-10-26 04:13:40 +00:00
parent 6833edbc4a
commit 68af66b16d

View file

@ -19,23 +19,36 @@ namespace BSB.Commands.Group
{ {
if (UUID.TryParse(args[2], out UUID testavatar) == true) 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<string, string> reply = new Dictionary<string, string>
{ {
bot.GetClient.Groups.RequestGroupMembers(targetgroup); { "group", args[0] },
InfoBlob = "Requesting group membership"; { "avatar", args[2] },
return true; { "ingroup", "1" }
} };
else return bot.GetCommandsInterface.SmartCommandReply(true, args[1], JsonConvert.SerializeObject(reply), CommandName);
{
return Failed("Unable to await reply");
}
} }
else 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 else
@ -65,10 +78,12 @@ namespace BSB.Commands.Group
break; break;
} }
} }
Dictionary<string,string> reply = new Dictionary<string, string>(); Dictionary<string, string> reply = new Dictionary<string, string>
reply.Add("group", args[0]); {
reply.Add("avatar", args[2]); { "group", args[0] },
reply.Add("ingroup", return_status); { "avatar", args[2] },
{ "ingroup", return_status }
};
bot.GetCommandsInterface.SmartCommandReply(true, args[1], JsonConvert.SerializeObject(reply), CommandName); bot.GetCommandsInterface.SmartCommandReply(true, args[1], JsonConvert.SerializeObject(reply), CommandName);
} }
base.Callback(args, e); base.Callback(args, e);