it works but it sucks

This commit is contained in:
Madpeter 2022-04-15 19:34:49 +01:00
parent 41bf241970
commit 3aa9ddc73f
11 changed files with 83 additions and 230 deletions

View file

@ -94,7 +94,7 @@ namespace SecondBotEvents.Commands
{ {
return Failure("Token not accepted"); return Failure("Token not accepted");
} }
return BasicReply(JsonConvert.SerializeObject(bot.GetIMChatWindowKeyNames()), "chatwindows"); return Failure("@todo chat windows list");
} }
[About("gets a list of chat windows with unread messages")] [About("gets a list of chat windows with unread messages")]
@ -107,14 +107,7 @@ namespace SecondBotEvents.Commands
return Failure("Token not accepted"); return Failure("Token not accepted");
} }
List<UUID> unreadimwindows = new List<UUID>(); List<UUID> unreadimwindows = new List<UUID>();
foreach (UUID window in bot.IMChatWindows()) return Failure("@todo chat windows list unread");
{
if (bot.ImChatWindowHasUnread(window) == true)
{
unreadimwindows.Add(window);
}
}
return BasicReply(JsonConvert.SerializeObject(unreadimwindows), "listwithunread");
} }
[About("gets if there are any unread im messages at all")] [About("gets if there are any unread im messages at all")]
@ -126,16 +119,7 @@ namespace SecondBotEvents.Commands
{ {
return Failure("Token not accepted"); return Failure("Token not accepted");
} }
bool reply = false; return Failure("@todo have any unread ims");
foreach (UUID window in bot.IMChatWindows())
{
if (bot.ImChatWindowHasUnread(window) == true)
{
reply = true;
break;
}
}
return BasicReply(reply.ToString(), "haveunreadims");
} }
[About("gets the chat from the selected window")] [About("gets the chat from the selected window")]
@ -153,7 +137,7 @@ namespace SecondBotEvents.Commands
{ {
return Failure("Window UUID invaild", "getimchat", new[] { window }); return Failure("Window UUID invaild", "getimchat", new[] { window });
} }
return BasicReply(JsonConvert.SerializeObject(bot.GetIMChatWindow(windowUUID)), "getimchat", new[] { window }); return Failure("@todo chat window fetch");
} }
} }

View file

@ -64,8 +64,7 @@ namespace SecondBotEvents.Commands
{ {
return Failure("bad status", "DialogTrack", new [] { status }); return Failure("bad status", "DialogTrack", new [] { status });
} }
bot.SetTrackDialogs(statuscode); return Failure("@todo dialog relay");
return BasicReply("updated", "DialogTrack", new [] { status });
} }
} }

View file

@ -2,6 +2,7 @@
using EmbedIO.Routing; using EmbedIO.Routing;
using OpenMetaverse; using OpenMetaverse;
using SecondBotEvents.Services; using SecondBotEvents.Services;
using Newtonsoft.Json;
namespace SecondBotEvents.Commands namespace SecondBotEvents.Commands
@ -11,7 +12,7 @@ namespace SecondBotEvents.Commands
public Friends(EventsSecondBot setmaster) : base(setmaster) public Friends(EventsSecondBot setmaster) : base(setmaster)
{ {
} }
[About("Gets the friendslist <br/>Formated as follows<br/>friendreplyobject<br/><ul><li>name: String</li><li>id: String</li><li>online: bool</li></ul>")] [About("Gets the friendslist")]
[ReturnHints("array UUID = friendreplyobject")] [ReturnHints("array UUID = friendreplyobject")]
[Route(HttpVerbs.Get, "/Friendslist/{token}")] [Route(HttpVerbs.Get, "/Friendslist/{token}")]
public object Friendslist(string token) public object Friendslist(string token)
@ -20,7 +21,7 @@ namespace SecondBotEvents.Commands
{ {
return Failure("Token not accepted"); return Failure("Token not accepted");
} }
return BasicReply(bot.getJsonFriendlist(), "Friendslist"); return BasicReply(JsonConvert.SerializeObject(getClient().Friends.FriendList));
} }
[About("Updates the friend perms for avatar avatar to State \n if true grants (Online/Map/Modify) perms")] [About("Updates the friend perms for avatar avatar to State \n if true grants (Online/Map/Modify) perms")]

View file

@ -34,26 +34,9 @@ namespace SecondBotEvents.Commands
{ {
return Failure("Invaild group UUID", "IsGroupMember", new [] { group, avatar }); return Failure("Invaild group UUID", "IsGroupMember", new [] { group, avatar });
} }
if (bot.MyGroups.ContainsKey(groupuuid) == false)
{
return Failure("Unknown group", "IsGroupMember", new [] { group, avatar });
}
if (bot.NeedReloadGroupData(groupuuid) == true)
{
getClient().Groups.RequestGroupMembers(groupuuid);
}
ProcessAvatar(avatar); ProcessAvatar(avatar);
KeyValuePair<bool, string> reply = waitForReady(true, true, groupuuid); return Failure("@todo group membership storage");
if (reply.Key == false) // IsGroupMemberReply object
{
return Failure(reply.Value, "IsGroupMember", new [] { group, avatar });
}
IsGroupMemberReply replyobject = new IsGroupMemberReply();
replyobject.membershipStatus = bot.FastCheckInGroup(groupuuid, avataruuid);
replyobject.AvatarUUID = avataruuid.ToString();
replyobject.AvatarnameIfKnown = bot.FindAvatarKey2Name(avataruuid);
replyobject.GroupUUID = groupuuid.ToString();
return BasicReply(JsonConvert.SerializeObject(replyobject), "IsGroupMember", new [] { group, avatar });
} }
[About("Gets membership of a group")] [About("Gets membership of a group")]
@ -74,25 +57,11 @@ namespace SecondBotEvents.Commands
{ {
return Failure("Invaild group UUID", "GetGroupMembers", new [] { group }); return Failure("Invaild group UUID", "GetGroupMembers", new [] { group });
} }
if (bot.MyGroups.ContainsKey(groupuuid) == false) return Failure("@todo group membership storage");
{
return Failure("Unknown group", "GetGroupMembers", new [] { group });
}
if (bot.NeedReloadGroupData(groupuuid) == true)
{
getClient().Groups.RequestGroupMembers(groupuuid);
}
KeyValuePair<bool, string> reply = waitForReady(false, true, groupuuid);
if (reply.Key == false)
{
return Failure(reply.Value, "GetGroupMembers", new [] { group });
}
SuccessNoReturn("GetGroupMembers", new [] { group });
return bot.GetGroupMembers(groupuuid);
} }
[About("Attempts to ban/unban a given avatar from a group")] [About("Attempts to ban/unban a given avatar from a group")]
[ReturnHints("? request accepted")] [ReturnHints("Accepted")]
[ReturnHintsFailure("Updating")] [ReturnHintsFailure("Updating")]
[ReturnHintsFailure("Unknown group")] [ReturnHintsFailure("Unknown group")]
[ReturnHintsFailure("Invaild group UUID")] [ReturnHintsFailure("Invaild group UUID")]
@ -112,39 +81,30 @@ namespace SecondBotEvents.Commands
{ {
return Failure("Invaild group UUID", "GroupBan", new[] { group, avatar, state }); return Failure("Invaild group UUID", "GroupBan", new[] { group, avatar, state });
} }
if (bot.MyGroups.ContainsKey(groupuuid) == false) if (getClient().Groups.GroupName2KeyCache.ContainsKey(groupuuid) == false)
{ {
return Failure("Unknown group", "GroupBan", new[] { group, avatar, state }); return Failure("Unknown group", "GroupBan", new[] { group, avatar, state });
} }
Group G = bot.MyGroups[groupuuid];
if (G.Powers.HasFlag(GroupPowers.GroupBanAccess) == false)
{
return Failure("Missing group GroupBanAccess power", "GroupBan", new [] { group, avatar, state });
}
if (bool.TryParse(state, out bool banstate) == false)
{
return Failure("Invaild ban state", "GroupBan", new [] { group, avatar, state });
}
ProcessAvatar(avatar); ProcessAvatar(avatar);
if(avataruuid == UUID.Zero) if(avataruuid == null)
{ {
return Failure("avatar lookup", "GroupBan", new [] { group, avatar, state }); return Failure("Unknown avatar", "GroupBan", new[] { group, avatar, state });
} }
GroupBanAction action = GroupBanAction.Unban; GroupBanAction Action = GroupBanAction.Ban;
string statename = "Unban"; if (state == "false")
if (banstate == true)
{ {
action = GroupBanAction.Ban; Action = GroupBanAction.Unban;
statename = "Ban";
} }
getClient().Groups.RequestBanAction(groupuuid, action, new UUID[] { avataruuid }); List<UUID> avatarstoaction = new List<UUID>();
return BasicReply(statename+" request accepted", "GroupBan", new [] { group, avatar, state }); avatarstoaction.Add(avataruuid);
getClient().Groups.RequestBanAction(groupuuid, Action, avatarstoaction.ToArray());
return BasicReply("Accepted");
} }
[About("Eject selected avatar from group")] [About("Eject selected avatar from group")]
[ReturnHints("Requested")] [ReturnHints("Accepted")]
[ReturnHintsFailure("Updating")] [ReturnHintsFailure("Updating")]
[ReturnHintsFailure("Unknown group")] [ReturnHintsFailure("Unknown group")]
[ReturnHintsFailure("Invaild group UUID")] [ReturnHintsFailure("Invaild group UUID")]
@ -164,22 +124,13 @@ namespace SecondBotEvents.Commands
{ {
return Failure("Invaild group UUID", "GroupEject", new [] { group, avatar }); return Failure("Invaild group UUID", "GroupEject", new [] { group, avatar });
} }
if (bot.MyGroups.ContainsKey(groupuuid) == false)
{
return Failure("Unknown group", "GroupEject", new [] { group, avatar });
}
Group G = bot.MyGroups[groupuuid];
if (G.Powers.HasFlag(GroupPowers.Eject) == false)
{
return Failure("Missing group Eject power", "GroupEject", new [] { group, avatar });
}
ProcessAvatar(avatar); ProcessAvatar(avatar);
if (avataruuid == UUID.Zero) if (avataruuid == null)
{ {
return Failure("avatar lookup", "GroupEject", new [] { group, avatar }); return Failure("Unknown avatar", "GroupEject", new[] { group, avatar});
} }
getClient().Groups.EjectUser(groupuuid, avataruuid); getClient().Groups.EjectUser(groupuuid, avataruuid);
return BasicReply("Requested", "GroupEject", new [] { group, avatar }); return BasicReply("Accepted");
} }
[About("Adds the avatar to the Group with the role \n if they are not in the group then it invites them at that role")] [About("Adds the avatar to the Group with the role \n if they are not in the group then it invites them at that role")]
@ -208,28 +159,7 @@ namespace SecondBotEvents.Commands
{ {
return Failure("Invaild role UUID", "GroupAddRole", new [] { group, avatar }); return Failure("Invaild role UUID", "GroupAddRole", new [] { group, avatar });
} }
if (bot.MyGroups.ContainsKey(groupuuid) == false) return Failure("@todo group membership storage");
{
return Failure("Unknown group", "GroupAddRole", new [] { group, avatar });
}
if (bot.NeedReloadGroupData(groupuuid) == true)
{
getClient().Groups.RequestGroupMembers(groupuuid);
}
ProcessAvatar(avatar);
KeyValuePair<bool, string> reply = waitForReady(true, true, groupuuid);
if (reply.Key == false)
{
return Failure(reply.Value, "GroupAddRole", new [] { group, avatar });
}
bool status = bot.FastCheckInGroup(groupuuid, avataruuid);
if (status == false)
{
getClient().Groups.Invite(groupuuid, new List<UUID>() { roleuuid }, avataruuid);
return BasicReply("Invite sent", "GroupAddRole", new [] { group, avatar });
}
getClient().Groups.AddToRole(groupuuid, roleuuid, avataruuid);
return BasicReply("Roles updated", "GroupAddRole", new [] { group, avatar });
} }
[About("Invites selected avatar to the group with the selected role")] [About("Invites selected avatar to the group with the selected role")]
@ -254,24 +184,11 @@ namespace SecondBotEvents.Commands
{ {
return Failure("Invaild group UUID", "GroupInvite", new [] { group, avatar, role }); return Failure("Invaild group UUID", "GroupInvite", new [] { group, avatar, role });
} }
if (bot.MyGroups.ContainsKey(groupuuid) == false)
{
return Failure("Unknown group", "GroupInvite", new [] { group, avatar, role });
}
if (bot.NeedReloadGroupData(groupuuid) == true)
{
getClient().Groups.RequestGroupMembers(groupuuid);
}
ProcessAvatar(avatar); ProcessAvatar(avatar);
if (avataruuid == UUID.Zero) if (avataruuid == UUID.Zero)
{ {
return Failure("avatar lookup", "GroupInvite", new [] { group, avatar, role }); return Failure("avatar lookup", "GroupInvite", new [] { group, avatar, role });
} }
bool status = bot.FastCheckInGroup(groupuuid, avataruuid);
if (status == true)
{
return BasicReply("Already in group", "GroupInvite", new[] { group, avatar, role });
}
if(role == "everyone") if(role == "everyone")
{ {
role = UUID.Zero.ToString(); role = UUID.Zero.ToString();
@ -280,11 +197,6 @@ namespace SecondBotEvents.Commands
{ {
return Failure("Unable to process role UUID", "GroupInvite", new [] { group, avatar, role }); return Failure("Unable to process role UUID", "GroupInvite", new [] { group, avatar, role });
} }
Group G = bot.MyGroups[groupuuid];
if(G.Powers.HasFlag(GroupPowers.Invite) == false)
{
return Failure("Missing group invite power", "GroupInvite", new [] { group, avatar, role });
}
getClient().Groups.Invite(groupuuid, new List<UUID>() { roleuuid }, avataruuid); getClient().Groups.Invite(groupuuid, new List<UUID>() { roleuuid }, avataruuid);
return BasicReply("Invite sent", "GroupInvite", new [] { group, avatar, role }); return BasicReply("Invite sent", "GroupInvite", new [] { group, avatar, role });
} }
@ -310,7 +222,7 @@ namespace SecondBotEvents.Commands
{ {
return Failure("Invaild group UUID", "Groupnotice", new [] { group, title, message }); return Failure("Invaild group UUID", "Groupnotice", new [] { group, title, message });
} }
if (bot.MyGroups.ContainsKey(groupuuid) == false) if (getClient().Groups.GroupName2KeyCache.ContainsKey(groupuuid) == false)
{ {
return Failure("Unknown group", "Groupnotice", new [] { group, title, message }); return Failure("Unknown group", "Groupnotice", new [] { group, title, message });
} }
@ -322,17 +234,15 @@ namespace SecondBotEvents.Commands
{ {
return Failure("Message empty", "Groupnotice", new [] { group, title, message }); return Failure("Message empty", "Groupnotice", new [] { group, title, message });
} }
Group G = bot.MyGroups[groupuuid]; return Failure("@todo groups stoage");
if (G.Powers.HasFlag(GroupPowers.SendNotices) == false) /*
{
return Failure("Missing group notice power", "Groupnotice", new [] { group, title, message });
}
GroupNotice NewNotice = new GroupNotice(); GroupNotice NewNotice = new GroupNotice();
NewNotice.Subject = title; NewNotice.Subject = title;
NewNotice.Message = message; NewNotice.Message = message;
NewNotice.OwnerID = getClient().Self.AgentID; NewNotice.OwnerID = getClient().Self.AgentID;
getClient().Groups.SendGroupNotice(groupuuid, NewNotice); getClient().Groups.SendGroupNotice(groupuuid, NewNotice);
return BasicReply("Sending notice", "Groupnotice", new [] { group, title, message }); return BasicReply("Sending notice", "Groupnotice", new [] { group, title, message });
*/
} }
[About("Activates the selected title")] [About("Activates the selected title")]
@ -357,7 +267,7 @@ namespace SecondBotEvents.Commands
{ {
return Failure("Invaild role UUID", "GroupActiveTitle", new [] { group, role }); return Failure("Invaild role UUID", "GroupActiveTitle", new [] { group, role });
} }
if (bot.MyGroups.ContainsKey(groupuuid) == false) if (getClient().Groups.GroupName2KeyCache.ContainsKey(groupuuid) == false)
{ {
return Failure("Unknown group", "GroupActiveTitle", new [] { group, role }); return Failure("Unknown group", "GroupActiveTitle", new [] { group, role });
} }
@ -381,7 +291,7 @@ namespace SecondBotEvents.Commands
{ {
return Failure("Invaild group UUID", "GroupActiveGroup", new [] { group }); return Failure("Invaild group UUID", "GroupActiveGroup", new [] { group });
} }
if (bot.MyGroups.ContainsKey(groupuuid) == false) if (getClient().Groups.GroupName2KeyCache.ContainsKey(groupuuid) == false)
{ {
return Failure("Unknown group", "GroupActiveGroup", new[] { group }); return Failure("Unknown group", "GroupActiveGroup", new[] { group });
} }
@ -416,7 +326,7 @@ namespace SecondBotEvents.Commands
{ {
return Failure("Invaild inventory UUID", "GroupnoticeWithAttachment", new [] { group, title, message, attachment }); return Failure("Invaild inventory UUID", "GroupnoticeWithAttachment", new [] { group, title, message, attachment });
} }
if (bot.MyGroups.ContainsKey(groupuuid) == false) if (getClient().Groups.GroupName2KeyCache.ContainsKey(groupuuid) == false)
{ {
return Failure("Unknown group", "GroupnoticeWithAttachment", new [] { group, title, message, attachment }); return Failure("Unknown group", "GroupnoticeWithAttachment", new [] { group, title, message, attachment });
} }
@ -428,6 +338,8 @@ namespace SecondBotEvents.Commands
{ {
return Failure("Message empty", "GroupnoticeWithAttachment", new [] { group, title, message, attachment }); return Failure("Message empty", "GroupnoticeWithAttachment", new [] { group, title, message, attachment });
} }
return Failure("@togo groups storage");
/*
Group G = bot.MyGroups[groupuuid]; Group G = bot.MyGroups[groupuuid];
if (G.Powers.HasFlag(GroupPowers.SendNotices) == false) if (G.Powers.HasFlag(GroupPowers.SendNotices) == false)
{ {
@ -440,6 +352,7 @@ namespace SecondBotEvents.Commands
NewNotice.AttachmentID = inventoryuuid; NewNotice.AttachmentID = inventoryuuid;
getClient().Groups.SendGroupNotice(groupuuid, NewNotice); getClient().Groups.SendGroupNotice(groupuuid, NewNotice);
return BasicReply("Sending notice with attachment", "GroupnoticeWithAttachment", new [] { group, title, message, attachment }); return BasicReply("Sending notice with attachment", "GroupnoticeWithAttachment", new [] { group, title, message, attachment });
*/
} }
@ -452,12 +365,15 @@ namespace SecondBotEvents.Commands
{ {
return Failure("Token not accepted"); return Failure("Token not accepted");
} }
return Failure("@togo groups storage");
/*
Dictionary<string, string> grouppackage = new Dictionary<string, string>(); Dictionary<string, string> grouppackage = new Dictionary<string, string>();
foreach (KeyValuePair<UUID, Group> entry in bot.MyGroups) foreach (KeyValuePair<UUID, Group> entry in bot.MyGroups)
{ {
grouppackage.Add(entry.Value.ID.ToString(), entry.Value.Name); grouppackage.Add(entry.Value.ID.ToString(), entry.Value.Name);
} }
return BasicReply(JsonConvert.SerializeObject(grouppackage), "GetGroupList"); return BasicReply(JsonConvert.SerializeObject(grouppackage), "GetGroupList");
*/
} }
[About("Requests the roles for the selected group<br/>Replys with GroupRoleDetails object formated as follows <ul><li>UpdateUnderway (Bool)</li><li>RoleDataAge (Int) [default -1]</li><li>Roles (KeyPair array of UUID=Name)</li></ul><br/>")] [About("Requests the roles for the selected group<br/>Replys with GroupRoleDetails object formated as follows <ul><li>UpdateUnderway (Bool)</li><li>RoleDataAge (Int) [default -1]</li><li>Roles (KeyPair array of UUID=Name)</li></ul><br/>")]
@ -477,10 +393,12 @@ namespace SecondBotEvents.Commands
{ {
return Failure("Invaild group UUID", "GetGroupRoles", new [] { group }); return Failure("Invaild group UUID", "GetGroupRoles", new [] { group });
} }
if (bot.MyGroups.ContainsKey(groupuuid) == false) if (getClient().Groups.GroupName2KeyCache.ContainsKey(groupuuid) == false)
{ {
return Failure("Unknown group", "GetGroupRoles", new [] { group }); return Failure("Unknown group", "GetGroupRoles", new [] { group });
} }
return Failure("@todo group role storage");
/*
GroupRoleDetails reply = new GroupRoleDetails(); GroupRoleDetails reply = new GroupRoleDetails();
reply.UpdateUnderway = false; reply.UpdateUnderway = false;
reply.RoleDataAge = -1; reply.RoleDataAge = -1;
@ -511,6 +429,7 @@ namespace SecondBotEvents.Commands
} }
} }
return BasicReply(JsonConvert.SerializeObject(reply), "GetGroupRoles", new [] { group }); return BasicReply(JsonConvert.SerializeObject(reply), "GetGroupRoles", new [] { group });
*/
} }
[About("fetchs a list of all groups with unread messages")] [About("fetchs a list of all groups with unread messages")]
@ -522,7 +441,7 @@ namespace SecondBotEvents.Commands
{ {
return Failure("Token not accepted"); return Failure("Token not accepted");
} }
return BasicReply(JsonConvert.SerializeObject(bot.UnreadGroupchatGroups()), "GroupchatListAllUnreadGroups"); return Failure("@todo group message storage");
} }
[About("fetchs a list of all groups with unread messages")] [About("fetchs a list of all groups with unread messages")]
@ -542,11 +461,11 @@ namespace SecondBotEvents.Commands
{ {
return Failure("group value is invaild", "GroupchatGroupHasUnread", new [] { group }); return Failure("group value is invaild", "GroupchatGroupHasUnread", new [] { group });
} }
if(bot.MyGroups.ContainsKey(groupUUID) == false) if(getClient().Groups.GroupName2KeyCache.ContainsKey(groupUUID) == false)
{ {
return Failure("Unknown group", "GroupchatGroupHasUnread", new [] { group }); return Failure("Unknown group", "GroupchatGroupHasUnread", new [] { group });
} }
return BasicReply(bot.GroupHasUnread(groupUUID).ToString(), "GroupchatGroupHasUnread", new [] { group }); return Failure("@todo group message storage");
} }
@ -559,7 +478,7 @@ namespace SecondBotEvents.Commands
{ {
return Failure("Token not accepted"); return Failure("Token not accepted");
} }
return BasicReply(bot.HasUnreadGroupchats().ToString(), "GroupchatAnyUnread"); return Failure("@todo group message storage");
} }
[About("Clears all group chat buffers at once")] [About("Clears all group chat buffers at once")]
@ -571,8 +490,7 @@ namespace SecondBotEvents.Commands
{ {
return Failure("Token not accepted"); return Failure("Token not accepted");
} }
bot.ClearAllGroupchat(); return Failure("@todo group message storage");
return BasicReply("ok", "GroupchatClearAll");
} }
[About("fetchs the groupchat history")] [About("fetchs the groupchat history")]
@ -590,7 +508,7 @@ namespace SecondBotEvents.Commands
{ {
return Failure("Group UUID invaild", "GroupchatHistory", new [] { group }); return Failure("Group UUID invaild", "GroupchatHistory", new [] { group });
} }
return BasicReply(JsonConvert.SerializeObject(bot.GetGroupchat(groupUUID)), "GroupchatHistory", new [] { group }); return Failure("@todo group message storage");
} }
[About("sends a message to the groupchat")] [About("sends a message to the groupchat")]
@ -612,22 +530,11 @@ namespace SecondBotEvents.Commands
{ {
return Failure("group value is invaild", "Groupchat", new [] { group, message }); return Failure("group value is invaild", "Groupchat", new [] { group, message });
} }
if (bot.MyGroups.ContainsKey(groupUUID) == false) if (getClient().Groups.GroupName2KeyCache.ContainsKey(groupUUID) == false)
{ {
return Failure("Unknown group", "Groupchat", new [] { group, message }); return Failure("Unknown group", "Groupchat", new [] { group, message });
} }
Group G = bot.MyGroups[groupUUID]; return Failure("@todo groupchat");
if (G.Powers.HasFlag(GroupPowers.JoinChat) == false)
{
return Failure("Missing group JoinChat power", "Groupchat", new [] { group, message });
}
if (bot.GetActiveGroupchatSessions.Contains(groupUUID) == false)
{
getClient().Self.RequestJoinGroupChat(groupUUID);
return Failure("Opening groupchat - Please retry later", "Groupchat", new [] { group, message });
}
getClient().Self.InstantMessageGroup(groupUUID, message);
return BasicReply("Sending", "Groupchat", new [] { group, message });
} }
protected KeyValuePair<bool, string> waitForReady(bool avatar, bool group, UUID groupuuid) protected KeyValuePair<bool, string> waitForReady(bool avatar, bool group, UUID groupuuid)

View file

@ -31,7 +31,7 @@ namespace SecondBotEvents.Commands
{ {
return Failure("Token not accepted"); return Failure("Token not accepted");
} }
return BasicReply(bot.addInventoryUpdateEvent(inventoryType, outputTarget), "SetInventoryUpdate"); return Failure("@todo inventory update events");
} }
[About("Uploads a new sound file to inventory")] [About("Uploads a new sound file to inventory")]
@ -114,7 +114,7 @@ namespace SecondBotEvents.Commands
{ {
return Failure("Item name is to short", "RenameInventory", new [] { item, newname }); return Failure("Item name is to short", "RenameInventory", new [] { item, newname });
} }
InventoryItem realitem = HelperInventory.getItemByInventoryUUID(bot, target); InventoryItem realitem = HelperInventory.getItemByInventoryUUID(getClient(), target);
if (realitem == null) if (realitem == null)
{ {
return Failure("Unable to find inventory item", "RenameInventory", new [] { item, newname }); return Failure("Unable to find inventory item", "RenameInventory", new [] { item, newname });
@ -177,7 +177,7 @@ namespace SecondBotEvents.Commands
{ {
return Failure("invaild item uuid", "Attach", new [] { item }); return Failure("invaild item uuid", "Attach", new [] { item });
} }
InventoryItem realitem = HelperInventory.getItemByInventoryUUID(bot, itemuuid); InventoryItem realitem = HelperInventory.getItemByInventoryUUID(getClient(), itemuuid);
getClient().Appearance.AddAttachments(new List<InventoryItem>() { realitem }, false, false); getClient().Appearance.AddAttachments(new List<InventoryItem>() { realitem }, false, false);
return BasicReply("Ok", "Attach", new [] { item }); return BasicReply("Ok", "Attach", new [] { item });
} }
@ -197,7 +197,7 @@ namespace SecondBotEvents.Commands
{ {
return Failure("invaild item uuid", "Detach", new [] { item }); return Failure("invaild item uuid", "Detach", new [] { item });
} }
InventoryItem realitem = HelperInventory.getItemByInventoryUUID(bot, itemuuid); InventoryItem realitem = HelperInventory.getItemByInventoryUUID(getClient(), itemuuid);
getClient().Appearance.RemoveFromOutfit(realitem); getClient().Appearance.RemoveFromOutfit(realitem);
return BasicReply("Ok", "Detach", new [] { item }); return BasicReply("Ok", "Detach", new [] { item });
} }
@ -331,7 +331,7 @@ namespace SecondBotEvents.Commands
{ {
return Failure("Invaild item uuid", "getRealUUID", new [] { item }); return Failure("Invaild item uuid", "getRealUUID", new [] { item });
} }
UUID reply = HelperInventory.GetAssetUUID(bot, itemUUID); UUID reply = HelperInventory.GetAssetUUID(getClient(), itemUUID);
return BasicReply(reply.ToString(), "getRealUUID", new [] { item }); return BasicReply(reply.ToString(), "getRealUUID", new [] { item });
} }
@ -392,7 +392,7 @@ namespace SecondBotEvents.Commands
{ {
return Failure("Invaild folder uuid", "SendFolder", new [] { folder, avatar }); return Failure("Invaild folder uuid", "SendFolder", new [] { folder, avatar });
} }
InventoryBase FindFolderHelper = HelperInventory.FindFolder(bot, getClient().Inventory.Store.RootFolder, targetfolder); InventoryBase FindFolderHelper = HelperInventory.FindFolder(getClient(), getClient().Inventory.Store.RootFolder, targetfolder);
if (FindFolderHelper == null) if (FindFolderHelper == null)
{ {
return Failure("Unable to find folder", "SendFolder", new [] { folder, avatar }); return Failure("Unable to find folder", "SendFolder", new [] { folder, avatar });
@ -478,7 +478,7 @@ namespace SecondBotEvents.Commands
{ {
return Failure("Token not accepted"); return Failure("Token not accepted");
} }
string reply = HelperInventory.MapFolderJson(bot); string reply = HelperInventory.MapFolderJson(getClient());
if (reply != null) return BasicReply(reply, "InventoryFolders"); if (reply != null) return BasicReply(reply, "InventoryFolders");
return Failure("Error", "InventoryFolders"); return Failure("Error", "InventoryFolders");
} }
@ -494,7 +494,7 @@ namespace SecondBotEvents.Commands
{ {
return Failure("Token not accepted"); return Failure("Token not accepted");
} }
string reply = HelperInventory.MapFolderJson(bot, targetfolder,false); string reply = HelperInventory.MapFolderJson(getClient(), targetfolder,false);
if (reply != null) return BasicReply(reply, "InventoryFoldersLimited"); if (reply != null) return BasicReply(reply, "InventoryFoldersLimited");
return Failure("Error", "InventoryFoldersLimited"); return Failure("Error", "InventoryFoldersLimited");
} }
@ -514,7 +514,7 @@ namespace SecondBotEvents.Commands
{ {
return Failure("Invaild folder UUID", "InventoryContents", new [] { folderUUID }); return Failure("Invaild folder UUID", "InventoryContents", new [] { folderUUID });
} }
return BasicReply(HelperInventory.MapFolderInventoryJson(bot, folder), "InventoryContents", new [] { folderUUID }); return BasicReply(HelperInventory.MapFolderInventoryJson(getClient(), folder), "InventoryContents", new [] { folderUUID });
} }
} }
} }

View file

@ -105,7 +105,7 @@ namespace SecondBotEvents.Commands
{ {
return Failure("Invaild avatar UUID", "RequestTeleport", new [] { avatar }); return Failure("Invaild avatar UUID", "RequestTeleport", new [] { avatar });
} }
bot.Add_action_from("teleport", avataruuid, bot.FindAvatarKey2Name(avataruuid)); // @todo action from event log with accept
getClient().Self.SendTeleportLureRequest(avataruuid, "I would like to teleport to you"); getClient().Self.SendTeleportLureRequest(avataruuid, "I would like to teleport to you");
return BasicReply("ok", "RequestTeleport", new [] { avatar }); return BasicReply("ok", "RequestTeleport", new [] { avatar });
} }
@ -248,7 +248,6 @@ namespace SecondBotEvents.Commands
{ {
return Failure("Error Unable to Teleport to location", "Teleport", new [] { region, x, y, z }); return Failure("Error Unable to Teleport to location", "Teleport", new [] { region, x, y, z });
} }
bot.SetTeleported();
return BasicReply("Accepted", "Teleport", new [] { region, x, y, z }); return BasicReply("Accepted", "Teleport", new [] { region, x, y, z });
} }
@ -268,7 +267,6 @@ namespace SecondBotEvents.Commands
{ {
return Failure("slurl is empty", "TeleportSLURL", new [] { slurl }); return Failure("slurl is empty", "TeleportSLURL", new [] { slurl });
} }
bot.SetTeleported();
return BasicReply(TeleportRequest(new [] { slurl }).ToString(), "TeleportSLURL", new [] { slurl }); return BasicReply(TeleportRequest(new [] { slurl }).ToString(), "TeleportSLURL", new [] { slurl });
} }
@ -277,11 +275,7 @@ namespace SecondBotEvents.Commands
getClient().Self.AutoPilotCancel(); getClient().Self.AutoPilotCancel();
if (args[0].Contains("http://maps.secondlife.com/secondlife/") == true) if (args[0].Contains("http://maps.secondlife.com/secondlife/") == true)
{ {
if (bot.TeleportWithSLurl(args[0]) == "ok") return false; // @todo SL url teleport
{
return true;
}
return false;
} }
else else
{ {
@ -298,9 +292,7 @@ namespace SecondBotEvents.Commands
float.TryParse(argvalues[1], out float posX); float.TryParse(argvalues[1], out float posX);
float.TryParse(argvalues[2], out float posY); float.TryParse(argvalues[2], out float posY);
float.TryParse(argvalues[3], out float posZ); float.TryParse(argvalues[3], out float posZ);
bot.SetTeleported();
bool status = getClient().Self.Teleport(regionName, new Vector3(posX, posY, posZ)); bool status = getClient().Self.Teleport(regionName, new Vector3(posX, posY, posZ));
bot.ResetAnimations();
return true; return true;
} }
else else

View file

@ -34,8 +34,8 @@ namespace SecondBotEvents.Commands
{ {
return Failure("Content value is empty", "NotecardAdd", new [] { collection, content }); return Failure("Content value is empty", "NotecardAdd", new [] { collection, content });
} }
bot.NotecardAddContent(collection, content); return Failure("@todo notecard temp stroage");
return BasicReply("ok", "NotecardAdd", new [] { collection, content }); //return BasicReply("ok", "NotecardAdd", new [] { collection, content });
} }
[About("Clears the contents of a collection")] [About("Clears the contents of a collection")]
@ -53,8 +53,7 @@ namespace SecondBotEvents.Commands
{ {
return Failure("Collection value is empty", "NotecardClear", new [] { collection }); return Failure("Collection value is empty", "NotecardClear", new [] { collection });
} }
bot.ClearNotecardStorage(collection); return Failure("@todo notecard storage");
return BasicReply("ok", "NotecardClear", new [] { collection });
} }
[About("Sends a notecard to a avatar using the text in the prebuilt collection [see NotecardAdd] and also clears the collection just before sending [see NotecardClear]")] [About("Sends a notecard to a avatar using the text in the prebuilt collection [see NotecardAdd] and also clears the collection just before sending [see NotecardClear]")]
@ -86,13 +85,7 @@ namespace SecondBotEvents.Commands
{ {
return Failure("Invaild avatar uuid", "NotecardSend", new [] { avatar, collection, notecardname }); return Failure("Invaild avatar uuid", "NotecardSend", new [] { avatar, collection, notecardname });
} }
string content = bot.GetNotecardContent(collection); return Failure("@todo notecard storage");
if (content == null)
{
return Failure("No content in notecard storage " + collection, "NotecardSend", new [] { avatar, collection, notecardname });
}
bot.ClearNotecardStorage(collection);
return BasicReply(bot.SendNotecard(notecardname, content, avataruuid).ToString(), "NotecardSend", new [] { avatar, collection, notecardname });
} }
[About("Creates and sends a notecard in one command good if you are using HTTP otherwise see [NotecardSend]")] [About("Creates and sends a notecard in one command good if you are using HTTP otherwise see [NotecardSend]")]
@ -123,7 +116,7 @@ namespace SecondBotEvents.Commands
{ {
return Failure("Invaild avatar uuid", "NotecardDirectSend", new[] { avatar, content, notecardname }); return Failure("Invaild avatar uuid", "NotecardDirectSend", new[] { avatar, content, notecardname });
} }
return BasicReply(bot.SendNotecard(notecardname, content, avataruuid).ToString(), "NotecardDirectSend", new[] { avatar, content, notecardname }); return Failure("@todo notecard sending");
} }
} }
} }

View file

@ -362,7 +362,7 @@ namespace SecondBotEvents.Commands
{ {
return Failure(tests.Value, "SetParcelMusic", new [] { musicurl }); return Failure(tests.Value, "SetParcelMusic", new [] { musicurl });
} }
bool status = parcel_static.set_parcel_music(bot, targetparcel, musicurl); bool status = parcel_static.set_parcel_music(getClient(), targetparcel, musicurl);
return BasicReply(status.ToString(), "SetParcelMusic", new [] { musicurl }); return BasicReply(status.ToString(), "SetParcelMusic", new [] { musicurl });
} }
@ -417,7 +417,7 @@ namespace SecondBotEvents.Commands
{ {
return Failure("No accepted flags", "SetParcelFlag", new [] { escapedflagdata }); return Failure("No accepted flags", "SetParcelFlag", new [] { escapedflagdata });
} }
if (parcel_static.has_parcel_perm(targetparcel, bot) == false) if (parcel_static.has_parcel_perm(targetparcel, getClient()) == false)
{ {
return Failure("Incorrect perms to control parcel", "SetParcelFlag", new [] { escapedflagdata }); return Failure("Incorrect perms to control parcel", "SetParcelFlag", new [] { escapedflagdata });
} }
@ -482,7 +482,7 @@ namespace SecondBotEvents.Commands
{ {
return Failure("Invaild group uuid", "ParcelDeedToGroup", new [] { group }); return Failure("Invaild group uuid", "ParcelDeedToGroup", new [] { group });
} }
if (bot.MyGroups.ContainsKey(groupuuid) == false) if (getClient().Groups.GroupName2KeyCache.ContainsKey(groupuuid) == false)
{ {
return Failure("Not in group", "ParcelDeedToGroup", new [] { group }); return Failure("Not in group", "ParcelDeedToGroup", new [] { group });
} }
@ -597,10 +597,7 @@ namespace SecondBotEvents.Commands
{ {
if (e.AgentID != UUID.Zero) if (e.AgentID != UUID.Zero)
{ {
if (bot.FindAvatarKey2Name(e.AgentID) == "lookup") break;
{
haslookup = true;
}
} }
} }
if(haslookup == true) if(haslookup == true)

View file

@ -23,8 +23,7 @@ namespace SecondBotEvents.Commands
{ {
return Failure("Token not accepted"); return Failure("Token not accepted");
} }
bot.GotoNextHomeRegion(); return Failure("@todo home system");
return BasicReply("ok", "GoHome");
} }
[About("Makes the bot turn to face avatar and point at them (if found)")] [About("Makes the bot turn to face avatar and point at them (if found)")]
@ -42,7 +41,6 @@ namespace SecondBotEvents.Commands
{ {
return Failure("Cant find UUID in sim", "PointAt", new [] { avatar }); return Failure("Cant find UUID in sim", "PointAt", new [] { avatar });
} }
bot.ResetAnimations();
getClient().Self.Stand(); getClient().Self.Stand();
getClient().Self.Movement.TurnToward(getClient().Network.CurrentSim.AvatarPositions[avataruuid]); getClient().Self.Movement.TurnToward(getClient().Network.CurrentSim.AvatarPositions[avataruuid]);
getClient().Self.Movement.SendUpdate(); getClient().Self.Movement.SendUpdate();
@ -63,11 +61,7 @@ namespace SecondBotEvents.Commands
{ {
return Failure("Token not accepted"); return Failure("Token not accepted");
} }
if (bot.HaveLocalKeyStorage(Key) == true) return Failure("@todo key value storage");
{
return BasicReply(bot.ReadLocalKeyStorage(Key), "ReadKeyValue");
}
return Failure("Unknown Key: "+Key, "ReadKeyValue");
} }
[About("sets a value for KeyValue storage (temp unless SQL is enabled)")] [About("sets a value for KeyValue storage (temp unless SQL is enabled)")]
@ -91,8 +85,7 @@ namespace SecondBotEvents.Commands
{ {
return Failure("Value is empty", "SetKeyValue", new[] { Key, Value }); return Failure("Value is empty", "SetKeyValue", new[] { Key, Value });
} }
bot.setLocalKeyStorage(Key, Value); return Failure("@todo key value storage");
return BasicReply("ok", "SetKeyValue");
} }
[About("Reads a value from the KeyValue storage (temp unless SQL is enabled)")] [About("Reads a value from the KeyValue storage (temp unless SQL is enabled)")]
@ -110,8 +103,7 @@ namespace SecondBotEvents.Commands
{ {
return Failure("Key is empty", "SetKeyValue", new[] { Key }); return Failure("Key is empty", "SetKeyValue", new[] { Key });
} }
bot.clearLocalKeyStorage(Key); return Failure("@todo key value storage");
return BasicReply("ok", "SetKeyValue");
} }
[About("Makes the bot sit on the ground or on a object if it can see it")] [About("Makes the bot sit on the ground or on a object if it can see it")]
@ -148,7 +140,6 @@ namespace SecondBotEvents.Commands
return Failure("Token not accepted"); return Failure("Token not accepted");
} }
getClient().Self.Stand(); getClient().Self.Stand();
bot.ResetAnimations();
return BasicReply("ok", "Stand"); return BasicReply("ok", "Stand");
} }
@ -195,11 +186,7 @@ namespace SecondBotEvents.Commands
{ {
return Failure("Token not accepted"); return Failure("Token not accepted");
} }
if (bot.KillMe == false) getClient().Network.BeginLogout();
{
getClient().Self.Chat("Laters im out", 0, ChatType.Normal);
bot.KillMePlease();
}
return BasicReply("ok", "Logoff"); return BasicReply("ok", "Logoff");
} }
@ -213,7 +200,7 @@ namespace SecondBotEvents.Commands
return Failure("Token not accepted"); return Failure("Token not accepted");
} }
SuccessNoReturn("GetLastCommands"); SuccessNoReturn("GetLastCommands");
return bot.GetLastCommands(5); return Failure("@todo command storage");
} }
[About("Sets the bot to accept a request type from the avatar (or a object owned by the avatar)\n " + [About("Sets the bot to accept a request type from the avatar (or a object owned by the avatar)\n " +

View file

@ -68,14 +68,7 @@ namespace SecondBotEvents.Commands
{ {
return Failure("Notecard title is to short", "FetchNextNotecard", new [] { endpoint, endpointcode }); return Failure("Notecard title is to short", "FetchNextNotecard", new [] { endpoint, endpointcode });
} }
return BasicReply return Failure("@todo notecard sending");
(
bot.SendNotecard(server_reply.NotecardTitle,
server_reply.NotecardContent,
(UUID)server_reply.AvatarUUID).ToString(),
"FetchNextNotecard",
new [] { endpoint, endpointcode }
);
} }
catch (Exception e) catch (Exception e)
{ {

View file

@ -62,7 +62,7 @@ namespace SecondBotEvents
{ {
fromFolder = args[0]; fromFolder = args[0];
} }
RestartServices(); StartServices();
} }
public void RestartServices() public void RestartServices()