From 0c5f2a8301e36d140d080fa2c1f3be70ed6859b4 Mon Sep 17 00:00:00 2001 From: Madpeter Date: Thu, 7 May 2020 12:51:03 +0100 Subject: [PATCH] new command: GroupActiveGroup allows the bot to set what group its currently active under (this should not update the title) --- Core/Commands/Group/GroupActiveGroup.cs | 41 +++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 Core/Commands/Group/GroupActiveGroup.cs diff --git a/Core/Commands/Group/GroupActiveGroup.cs b/Core/Commands/Group/GroupActiveGroup.cs new file mode 100644 index 0000000..71b0f73 --- /dev/null +++ b/Core/Commands/Group/GroupActiveGroup.cs @@ -0,0 +1,41 @@ +using OpenMetaverse; +using System; +using System.Collections.Generic; +using System.Text; + +namespace BSB.Commands.Group +{ + class GroupActiveGroup : CoreCommand_2arg + { + public override string[] ArgTypes { get { return new[] { "Group"}; } } + public override string[] ArgHints { get { return new[] { "Group UUID or name" }; } } + public override string Helpfile { get { return "Sets the selected group to the active group"; } } + public override bool CallFunction(string[] args) + { + if (base.CallFunction(args) == true) + { + UUID group_uuid = UUID.Zero; + if(UUID.TryParse(args[0],out group_uuid) == false) + { + foreach(KeyValuePair G in bot.MyGroups) + { + if(G.Value.Name == args[0]) + { + group_uuid = G.Key; + break; + } + } + if (group_uuid == UUID.Zero) + { + return Failed("Unable to find group"); + } + } + if (group_uuid != UUID.Zero) + { + bot.GetClient.Groups.ActivateGroup(group_uuid); + } + } + return false; + } + } +}