From 30cd3a4116ed83ea953a1c5b361065c8a8f927d3 Mon Sep 17 00:00:00 2001 From: Madpeterz <57852827+Madpeterz@users.noreply.github.com> Date: Wed, 17 Mar 2021 16:28:17 +0000 Subject: [PATCH] readds commands log and master teleport lockout --- BetterSecondbot/BetterAtHome/BetterAtHome.cs | 5 + Core/Commands/Animation.cs | 18 +- Core/Commands/Avatars.cs | 15 +- Core/Commands/Chat.cs | 22 +-- Core/Commands/Core.cs | 15 +- Core/Commands/Dialogs.cs | 24 +-- Core/Commands/Discord.cs | 76 +++++---- Core/Commands/Estate.cs | 58 +++---- Core/Commands/Friends.cs | 28 +-- Core/Commands/Funds.cs | 32 ++-- Core/Commands/Group.cs | 169 ++++++++++--------- Core/Commands/Home.cs | 8 +- Core/Commands/Im.cs | 20 +-- Core/Commands/Info.cs | 32 ++-- Core/Commands/Inventory.cs | 116 ++++++------- Core/Commands/Movement.cs | 74 ++++---- Core/Commands/Notecard.cs | 26 +-- Core/Commands/Parcel.cs | 127 +++++++------- Core/Commands/Self.cs | 55 +++--- Core/Commands/StreamAdmin.cs | 16 +- Core/HttpService/HttpAsService.cs | 11 +- Shared/BotTypes/BasicBot.cs | 5 + 22 files changed, 487 insertions(+), 465 deletions(-) diff --git a/BetterSecondbot/BetterAtHome/BetterAtHome.cs b/BetterSecondbot/BetterAtHome/BetterAtHome.cs index 1c12ddc..1231fe2 100644 --- a/BetterSecondbot/BetterAtHome/BetterAtHome.cs +++ b/BetterSecondbot/BetterAtHome/BetterAtHome.cs @@ -323,6 +323,11 @@ namespace BetterSecondbot.BetterAtHome SetBetterAtHomeAction("No home regions"); return; } + if(controler.Bot.TeleportStatus() == true) + { + SetBetterAtHomeAction("Teleported"); + return; + } if (IsAtHome() == true) { SetBetterAtHomeAction("AtHome"); diff --git a/Core/Commands/Animation.cs b/Core/Commands/Animation.cs index 5ee1267..409d9a2 100644 --- a/Core/Commands/Animation.cs +++ b/Core/Commands/Animation.cs @@ -26,20 +26,20 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "animation", "addtoallowanimations", handleGetClientIP()) == false) { - return BasicReply("Token not accepted"); + return BasicReply("Token not accepted", "addtoallowanimations", new string[] { avatar }); } ProcessAvatar(avatar); if (avataruuid == UUID.Zero) { - return BasicReply("avatar lookup"); + return BasicReply("avatar lookup", "addtoallowanimations", new string[] { avatar }); } if (bot.Accept_action_from("animation", avataruuid) == false) { bot.Add_action_from("animation", avataruuid); - return BasicReply("Granted perm animation"); + return BasicReply("Granted perm animation", "addtoallowanimations", new string[] { avatar }); } bot.Remove_action_from("animation", avataruuid, true); - return BasicReply("Removed perm animation"); + return BasicReply("Removed perm animation", "addtoallowanimations", new string[] { avatar }); } [About("Attempts to play a gesture")] @@ -51,15 +51,15 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "animation", "gesture", handleGetClientIP()) == false) { - return BasicReply("Token not accepted"); + return BasicReply("Token not accepted", "gesture", new string[] { gesture }); } if (UUID.TryParse(gesture, out UUID gestureUUID) == false) { - return BasicReply("Error with gesture"); + return BasicReply("Error with gesture", "gesture", new string[] { gesture }); } InventoryItem itm = bot.GetClient.Inventory.FetchItem(gestureUUID, bot.GetClient.Self.AgentID, (3 * 1000)); bot.GetClient.Self.PlayGesture(itm.AssetUUID); - return BasicReply("Accepted"); + return BasicReply("Accepted", "gesture", new string[] { gesture }); } [About("Resets the animation stack for the bot")] @@ -69,10 +69,10 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "animation", "resetanimations", handleGetClientIP()) == false) { - return BasicReply("Token not accepted"); + return BasicReply("Token not accepted", "resetanimations", new string[] { }); } bot.ResetAnimations(); - return BasicReply("Accepted"); + return BasicReply("Accepted", "resetanimations", new string[] { }); } } diff --git a/Core/Commands/Avatars.cs b/Core/Commands/Avatars.cs index a1df14d..b864995 100644 --- a/Core/Commands/Avatars.cs +++ b/Core/Commands/Avatars.cs @@ -24,11 +24,11 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "avatars", "nearmewithdetails", handleGetClientIP()) == false) { - return BasicReply("Token not accepted"); + return BasicReply("Token not accepted", "nearmewithdetails", new string[] { }); } if (bot.GetClient.Network.CurrentSim == null) { - return BasicReply("Error not in a sim"); + return BasicReply("Error not in a sim", "nearmewithdetails", new string[] { }); } List BetterNearMe = new List(); Dictionary avcopy = bot.GetClient.Network.CurrentSim.ObjectsAvatars.Copy(); @@ -46,7 +46,7 @@ namespace BetterSecondBot.HttpService BetterNearMe.Add(details); } } - return BasicReply(JsonConvert.SerializeObject(BetterNearMe)); + return BasicReply(JsonConvert.SerializeObject(BetterNearMe), "nearmewithdetails", new string[] { }); } [About("returns a list of all known avatars nearby")] @@ -57,11 +57,11 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "avatars", "nearme", handleGetClientIP()) == false) { - return BasicReply("Token not accepted"); + return BasicReply("Token not accepted", "nearme", new string[] { }); } if (bot.GetClient.Network.CurrentSim == null) { - return BasicReply("Error not in a sim"); + return BasicReply("Error not in a sim", "nearme", new string[] { }); } Dictionary NearMe = new Dictionary(); Dictionary avcopy = bot.GetClient.Network.CurrentSim.ObjectsAvatars.Copy(); @@ -72,10 +72,7 @@ namespace BetterSecondBot.HttpService NearMe.Add(av.ID, av.Name); } } - return BasicReply(JsonConvert.SerializeObject(NearMe)); + return BasicReply(JsonConvert.SerializeObject(NearMe), "nearme", new string[] { }); } - - - } } diff --git a/Core/Commands/Chat.cs b/Core/Commands/Chat.cs index 22ae02f..563d568 100644 --- a/Core/Commands/Chat.cs +++ b/Core/Commands/Chat.cs @@ -23,9 +23,9 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "chat", "LocalChatHistory", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "LocalChatHistory", new string[] { }); } - return BasicReply(JsonConvert.SerializeObject(bot.getLocalChatHistory())); + return BasicReply(JsonConvert.SerializeObject(bot.getLocalChatHistory()), "LocalChatHistory", new string[] { }); } [About("sends a message to localchat")] @@ -39,22 +39,22 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "chat", "Say", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "Say", new string[] { channel, message }); } if (helpers.isempty(message) == true) { - return Failure("Message empty"); + return Failure("Message empty", "Say", new string[] { channel, message }); } if(int.TryParse(channel,out int channelnum) == false) { - return Failure("Invaild channel"); + return Failure("Invaild channel", "Say", new string[] { channel, message }); } if(channelnum < 0) { - return Failure("Invaild channel"); + return Failure("Invaild channel", "Say", new string[] { channel, message }); } bot.GetClient.Self.Chat(message, channelnum, ChatType.Normal); - return BasicReply(JsonConvert.SerializeObject(bot.getLocalChatHistory())); + return BasicReply(JsonConvert.SerializeObject(bot.getLocalChatHistory()), "Say", new string[] { channel, message }); } @@ -69,19 +69,19 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "chat", "IM", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "IM", new string[] { avatar, message }); } ProcessAvatar(avatar); if(avataruuid == UUID.Zero) { - return Failure("avatar lookup"); + return Failure("avatar lookup", "IM", new string[] { avatar, message }); } if (helpers.isempty(message) == true) { - return Failure("Message empty"); + return Failure("Message empty", "IM", new string[] { avatar, message }); } bot.SendIM(avataruuid, message); - return BasicReply("ok"); + return BasicReply("ok", "IM", new string[] { avatar, message }); } } diff --git a/Core/Commands/Core.cs b/Core/Commands/Core.cs index 85db105..b348659 100644 --- a/Core/Commands/Core.cs +++ b/Core/Commands/Core.cs @@ -39,10 +39,10 @@ namespace BetterSecondBot.HttpService if (hash == authcode) { string newtoken = tokens.CreateToken(handleGetClientIP()); - if(newtoken != null) return BasicReply(newtoken); + if(newtoken != null) return BasicReply(newtoken, "GetToken", new string[] { authcode, unixtimegiven }); } } - return Failure("Authcode not accepted"); + return Failure("Authcode not accepted", "GetToken", new string[] { authcode, unixtimegiven }); } [About("Used to check HTTP connections")] @@ -51,7 +51,7 @@ namespace BetterSecondBot.HttpService [Route(HttpVerbs.Get, "/Hello")] public object Hello() { - return BasicReply("world"); + return BasicReply("world", "Hello", new string[] { }); } [About("Delays a thead by X ms
Mostly pointless but good if your doing custom commands")] @@ -62,14 +62,14 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "core", "Delay", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "Delay", new string[] { amount }); } if(int.TryParse(amount,out int amountvalue) == false) { - return Failure("Invaild amount"); + return Failure("Invaild amount", "Delay", new string[] { amount }); } Thread.Sleep(amountvalue); - return BasicReply("Ok"); + return BasicReply("Ok", "Delay", new string[] { amount }); } [About("Removes the given token from the accepted token pool")] @@ -80,8 +80,9 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "core", "LogoutUI", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "LogoutUI", new string[] { }); } + SuccessNoReturn("LogoutUI", new string[] { }); return tokens.Expire(token); } } diff --git a/Core/Commands/Dialogs.cs b/Core/Commands/Dialogs.cs index 1eadfa6..fe0a6b8 100644 --- a/Core/Commands/Dialogs.cs +++ b/Core/Commands/Dialogs.cs @@ -28,32 +28,32 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "dialogs", "DialogRelay", handleGetClientIP()) == false) { - return BasicReply("Token not accepted"); + return Failure("Token not accepted", "DialogRelay", new string[] { target }); } if (target == "clear") { bot.SetRelayDialogsAvatar(UUID.Zero); bot.SetRelayDialogsChannel(0); bot.SetRelayDialogsHTTP(""); - return BasicReply("cleared"); + return BasicReply("cleared", "DialogRelay", new string[] { target }); } ProcessAvatar(target); if (avataruuid != UUID.Zero) { bot.SetRelayDialogsAvatar(avataruuid); - return BasicReply("set/avatar"); + return BasicReply("set/avatar", "DialogRelay", new string[] { target }); } if (target.StartsWith("http") == true) { bot.SetRelayDialogsHTTP(target); - return BasicReply("set/http"); + return BasicReply("set/http", "DialogRelay", new string[] { target }); } if (int.TryParse(target, out int channel) == true) { bot.SetRelayDialogsChannel(channel); - return BasicReply("set/channel"); + return BasicReply("set/channel", "DialogRelay", new string[] { target }); } - return BasicReply("Not a vaild option"); + return Failure("Not a vaild option", "DialogRelay", new string[] { target }); } @@ -67,13 +67,13 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "dialogs", "DialogResponce", handleGetClientIP()) == false) { - return BasicReply("Token not accepted"); + return Failure("Token not accepted", "DialogResponce", new string[] { dialogid, buttontext }); } if (int.TryParse(dialogid, out int dialogidnum) == false) { - return BasicReply("bad dialog id"); + return Failure("bad dialog id", "DialogResponce", new string[] { dialogid, buttontext }); } - return BasicReply(bot.DialogReply(dialogidnum, buttontext).ToString()); + return BasicReply(bot.DialogReply(dialogidnum, buttontext).ToString(), "DialogResponce", new string[] { dialogid, buttontext }); } [About("Should the bot track dialogs and send them to the relays setup?")] @@ -85,14 +85,14 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "dialogs", "DialogTrack", handleGetClientIP()) == false) { - return BasicReply("Token not accepted"); + return Failure("Token not accepted", "DialogTrack", new string[] { status }); } if (bool.TryParse(status, out bool statuscode) == false) { - return BasicReply("bad status"); + return Failure("bad status", "DialogTrack", new string[] { status }); } bot.SetTrackDialogs(statuscode); - return BasicReply("updated"); + return BasicReply("updated", "DialogTrack", new string[] { status }); } } diff --git a/Core/Commands/Discord.cs b/Core/Commands/Discord.cs index 59ff225..eca2da7 100644 --- a/Core/Commands/Discord.cs +++ b/Core/Commands/Discord.cs @@ -32,13 +32,13 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "discord", "Discord_AddRole", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "Discord_AddRole", new string[] { serverid, roleid, memberid }); } if (bot.discordReady() == false) { - return Failure("Discord client not ready"); + return Failure("Discord client not ready", "Discord_AddRole", new string[] { serverid, roleid, memberid }); } - return BasicReply(addRoleToMember(serverid, roleid, memberid).Result.ToString()); + return BasicReply(addRoleToMember(serverid, roleid, memberid).Result.ToString(), "Discord_AddRole", new string[] { serverid, roleid, memberid }); } [About("Adds the selected user to the ban list - Disallows rejoining untill they are removed from the list")] @@ -53,17 +53,17 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "discord", "Discord_BanMember", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "Discord_BanMember", new string[] { serverid, memberid, why }); } if (bot.discordReady() == false) { - return Failure("Discord client not ready"); + return Failure("Discord client not ready", "Discord_BanMember", new string[] { serverid, memberid, why }); } if (helpers.notempty(why) == false) { - return Failure("Why empty"); + return Failure("Why empty", "Discord_BanMember", new string[] { serverid, memberid, why }); } - return BasicReply(BanMember(serverid, memberid, why).Result.ToString()); + return BasicReply(BanMember(serverid, memberid, why).Result.ToString(), "Discord_BanMember", new string[] { serverid, memberid, why }); } [About("Clears messages on the server sent by the member in the last 13 days, 22hours 59mins")] @@ -76,12 +76,13 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "discord", "Discord_BulkClear_Messages", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "Discord_BulkClear_Messages", new string[] { serverid, memberid }); } if (bot.discordReady() == false) { - return Failure("Discord client not ready"); + return Failure("Discord client not ready", "Discord_BulkClear_Messages", new string[] { serverid, memberid }); } + SuccessNoReturn("Discord_BulkClear_Messages", new string[] { serverid, memberid }); return ClearMessages(serverid, memberid).Result; } @@ -96,13 +97,13 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "discord", "Discord_Dm_Member", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "Discord_Dm_Member", new string[] { serverid, memberid, message }); } if (bot.discordReady() == false) { - return Failure("Discord client not ready"); + return Failure("Discord client not ready", "Discord_Dm_Member", new string[] { serverid, memberid, message }); } - return BasicReply(MessageMember(serverid, memberid, message).Result.ToString()); + return BasicReply(MessageMember(serverid, memberid, message).Result.ToString(), "Discord_Dm_Member", new string[] { serverid, memberid, message }); } [About("Returns a list of members in a server \n collection is userid: username \n if the user has set a nickname: userid: nickname|username \n" + @@ -116,12 +117,13 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "discord", "Discord_MembersList", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "Discord_MembersList", new string[] { serverid }); } if (bot.discordReady() == false) { - return Failure("Discord client not ready"); + return Failure("Discord client not ready", "Discord_MembersList", new string[] { serverid }); } + SuccessNoReturn("Discord_MembersList", new string[] { serverid }); return ListMembers(serverid).Result; } @@ -137,17 +139,17 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "discord", "Discord_MessageChannel", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "Discord_MessageChannel", new string[] { serverid, channelid, tts, message }); } if (bot.discordReady() == false) { - return Failure("Discord client not ready"); + return Failure("Discord client not ready", "Discord_MessageChannel", new string[] { serverid, channelid, tts, message }); } if (helpers.notempty(message) == false) { - return Failure("message empty"); + return Failure("message empty", "Discord_MessageChannel", new string[] { serverid, channelid, tts, message }); } - return BasicReply(MessageChannel(serverid, channelid, message, tts).Result.ToString()); + return BasicReply(MessageChannel(serverid, channelid, message, tts).Result.ToString(), "Discord_MessageChannel", new string[] { serverid, channelid, tts, message }); } [About("Sends a message to the selected channel - Optional TTS usage")] @@ -161,13 +163,13 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "discord", "Discord_MuteMember", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "Discord_MuteMember", new string[] { serverid, memberid, mode }); } if (bot.discordReady() == false) { - return Failure("Discord client not ready"); + return Failure("Discord client not ready", "Discord_MuteMember", new string[] { serverid, memberid, mode }); } - return BasicReply(MuteMember(serverid, memberid, mode).Result.ToString()); + return BasicReply(MuteMember(serverid, memberid, mode).Result.ToString(), "Discord_MuteMember", new string[] { serverid, memberid, mode }); } [About("returns a collection of settings for the given role \n This command requires Discord full client mode enabled and connected")] @@ -181,12 +183,13 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "discord", "Discord_Role_GetSettings", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "Discord_Role_GetSettings", new string[] { serverid, roleid }); } if (bot.discordReady() == false) { - return Failure("Discord client not ready"); + return Failure("Discord client not ready", "Discord_Role_GetSettings", new string[] { serverid, roleid }); } + SuccessNoReturn("Discord_Role_GetSettings", new string[] { serverid, roleid }); return RoleSettings(serverid,roleid); } @@ -202,13 +205,13 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "discord", "Discord_Role_UpdatePerms", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "Discord_Role_UpdatePerms", new string[] { serverid, roleid, flagscsv }); } if (bot.discordReady() == false) { - return Failure("Discord client not ready"); + return Failure("Discord client not ready", "Discord_Role_UpdatePerms", new string[] { serverid, roleid, flagscsv }); } - return BasicReply(UpdateRolePerms(serverid, roleid, flagscsv).Result.ToString()); + return BasicReply(UpdateRolePerms(serverid, roleid, flagscsv).Result.ToString(), "Discord_Role_UpdatePerms", new string[] { serverid, roleid, flagscsv }); } [About("Updates perm flags for the selected role \n example CSV format: Speak=True,SendMessages=False \n for a full list of perms see output of Discord_Role_GetSettings \n" + @@ -222,12 +225,13 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "discord", "Discord_RoleCreate", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "Discord_RoleCreate", new string[] { serverid, role }); } if (bot.discordReady() == false) { - return Failure("Discord client not ready"); + return Failure("Discord client not ready", "Discord_RoleCreate", new string[] { serverid, role }); } + SuccessNoReturn("Discord_RoleCreate", new string[] { serverid, role }); return CreateRole(serverid,role).Result; } @@ -240,13 +244,13 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "discord", "Discord_RoleList", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "Discord_RoleList", new string[] { serverid }); } if (bot.discordReady() == false) { - return Failure("Discord client not ready"); + return Failure("Discord client not ready", "Discord_RoleList", new string[] { serverid }); } - return BasicReply(ListRoles(serverid).ToString()); + return BasicReply(ListRoles(serverid).ToString(), "Discord_RoleList", new string[] { serverid }); } [About("Remove a role from a server \n This command requires Discord full client mode enabled and connected")] @@ -258,13 +262,13 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "discord", "Discord_RoleRemove", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "Discord_RoleRemove", new string[] { serverid, roleid }); } if (bot.discordReady() == false) { - return Failure("Discord client not ready"); + return Failure("Discord client not ready", "Discord_RoleRemove", new string[] { serverid, roleid }); } - return BasicReply(RemoveRole(serverid, roleid).Result.ToString()); + return BasicReply(RemoveRole(serverid, roleid).Result.ToString(), "Discord_RoleRemove", new string[] { serverid, roleid }); } [About("Returns a list of text channels in a server")] @@ -276,11 +280,11 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "discord", "Discord_TextChannels_List", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "Discord_TextChannels_List", new string[] { serverid }); } if (bot.discordReady() == false) { - return Failure("Discord client not ready"); + return Failure("Discord client not ready", "Discord_TextChannels_List", new string[] { serverid }); } return ListTextChannels(serverid); } diff --git a/Core/Commands/Estate.cs b/Core/Commands/Estate.cs index 3dfc990..0b3c7f3 100644 --- a/Core/Commands/Estate.cs +++ b/Core/Commands/Estate.cs @@ -16,10 +16,7 @@ namespace BetterSecondBot.HttpService public class HTTP_Estate : WebApiControllerWithTokens { - public HTTP_Estate(SecondBot mainbot, TokenStorage setuptokens) : base(mainbot, setuptokens) - { - - } + public HTTP_Estate(SecondBot mainbot, TokenStorage setuptokens) : base(mainbot, setuptokens) { } [About("Sends the message to the current sim")] [ReturnHints("Not an estate manager here")] @@ -31,19 +28,19 @@ namespace BetterSecondBot.HttpService [Route(HttpVerbs.Get, "/SimRestart/{delay}/{mode}/{token}")] public object SimRestart(string delay, string mode, string token) { - if (tokens.Allow(token, "estate", "SimMessage", handleGetClientIP()) == false) + if (tokens.Allow(token, "estate", "SimRestart", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "SimRestart", new string[] { delay, mode }); } if (bot.GetClient.Network.CurrentSim.IsEstateManager == false) { - return Failure("Not an estate manager here"); + return Failure("Not an estate manager here", "SimRestart", new string[] { delay, mode }); } bool.TryParse(mode, out bool modeflag); if (modeflag == false) { bot.GetClient.Estate.CancelRestart(); - return BasicReply("canceled"); + return BasicReply("canceled", "SimRestart", new string[] { delay, mode }); } int delay_restart = 60; int.TryParse(delay, out delay_restart); @@ -52,7 +49,7 @@ namespace BetterSecondBot.HttpService delay_restart = 240; } bot.GetClient.Estate.RestartRegion(delay_restart); - return BasicReply("restarting"); + return BasicReply("restarting", "SimRestart", new string[] { delay, mode }); } [About("Sends the message to the current sim")] @@ -65,18 +62,18 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "estate", "SimMessage", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "SimMessage", new string[] { message }); } if (helpers.notempty(message) == false) { - return Failure("Message empty"); + return Failure("Message empty", "SimMessage", new string[] { message }); } if (bot.GetClient.Network.CurrentSim.IsEstateManager == false) { - return Failure("Not an estate manager here"); + return Failure("Not an estate manager here", "SimMessage", new string[] { message }); } bot.GetClient.Estate.SimulatorMessage(message); - return BasicReply("ok"); + return BasicReply("ok", "SimMessage", new string[] { message }); } [About("Fetchs the regions map tile")] @@ -88,13 +85,13 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "estate", "GetSimTexture", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "GetSimTexture", new string[] { regionname }); } if (bot.GetClient.Grid.GetGridRegion(regionname, GridLayerType.Objects, out GridRegion region) == false) { - return Failure("Unable to find region"); + return Failure("Unable to find region", "GetSimTexture", new string[] { regionname }); } - return BasicReply(region.MapImageID.ToString()); + return BasicReply(region.MapImageID.ToString(), "GetSimTexture", new string[] { regionname }); } [About("Reclaims ownership of the current parcel")] @@ -105,15 +102,15 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "estate", "EstateParcelReclaim", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "EstateParcelReclaim", new string[] { }); } if (bot.GetClient.Network.CurrentSim.IsEstateManager == false) { - return Failure("Not an estate manager here"); + return Failure("Not an estate manager here", "EstateParcelReclaim", new string[] { }); } int localid = bot.GetClient.Parcels.GetParcelLocalID(bot.GetClient.Network.CurrentSim, bot.GetClient.Self.SimPosition); bot.GetClient.Parcels.Reclaim(bot.GetClient.Network.CurrentSim, localid); - return BasicReply("ok"); + return BasicReply("ok", "EstateParcelReclaim", new string[] { }); } [About("Reclaims ownership of the current parcel")] @@ -124,16 +121,17 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "estate", "GetSimGlobalPos", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "GetSimGlobalPos", new string[] { regionname }); } if (bot.GetClient.Grid.GetGridRegion(regionname, GridLayerType.Objects, out GridRegion region) == false) { - return Failure("Unable to find region"); + return Failure("Unable to find region", "GetSimGlobalPos", new string[] { regionname }); } Dictionary reply = new Dictionary(); reply.Add("region", regionname); reply.Add("X", region.X.ToString()); reply.Add("Y", region.Y.ToString()); + SuccessNoReturn("GetSimGlobalPos", new string[] { regionname }); return reply; } @@ -144,9 +142,9 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "estate", "banlist", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "banlist", new string[] { }); } - return BasicReply(JsonConvert.SerializeObject(bot._lastUpdatedSimBlacklist)); + return BasicReply(JsonConvert.SerializeObject(bot._lastUpdatedSimBlacklist), "banlist", new string[] { }); } [About("Attempts to add/remove the avatar to/from the Estate banlist")] @@ -162,31 +160,31 @@ namespace BetterSecondBot.HttpService public Object UpdateEstateBanlist(string avatar, string mode, string global, string token) { - if (tokens.Allow(token, "estate", "banlist-add", handleGetClientIP()) == false) + if (tokens.Allow(token, "estate", "UpdateEstateBanlist", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "UpdateEstateBanlist", new string[] { avatar, mode, global }); } if (bot.GetClient.Network.CurrentSim.IsEstateManager == false) { - return Failure("Not an estate manager on region " + bot.GetClient.Network.CurrentSim.Name); + return Failure("Not an estate manager on region " + bot.GetClient.Network.CurrentSim.Name, "UpdateEstateBanlist", new string[] { avatar, mode, global }); } UUID avataruuid = UUID.Zero; if (UUID.TryParse(avatar, out avataruuid) == false) { - return Failure("Unable to find avatar UUID"); + return Failure("Unable to find avatar UUID", "UpdateEstateBanlist", new string[] { avatar, mode, global }); } bool globalban = false; if (bool.TryParse(global, out globalban) == false) { - return Failure("Unable to process global value please use true or false"); + return Failure("Unable to process global value please use true or false", "UpdateEstateBanlist", new string[] { avatar, mode, global }); } if (mode != "add") { bot.GetClient.Estate.UnbanUser(avataruuid, globalban); - return BasicReply("Unban request accepted"); + return BasicReply("Unban request accepted", "UpdateEstateBanlist", new string[] { avatar, mode, global }); } bot.GetClient.Estate.BanUser(avataruuid, globalban); - return BasicReply("Ban request accepted"); + return BasicReply("Ban request accepted", "UpdateEstateBanlist", new string[] { avatar, mode, global }); } } } diff --git a/Core/Commands/Friends.cs b/Core/Commands/Friends.cs index 405ba6e..447797f 100644 --- a/Core/Commands/Friends.cs +++ b/Core/Commands/Friends.cs @@ -23,9 +23,9 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "friends", "Friendslist", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "Friendslist", new string[] { }); } - return BasicReply(bot.getJsonFriendlist()); + return BasicReply(bot.getJsonFriendlist(), "Friendslist", new string[] { }); } [About("Updates the friend perms for avatar avatar to State \n if true grants (Online/Map/Modify) perms")] @@ -41,29 +41,29 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "friends", "FriendFullPerms", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "FriendFullPerms", new string[] { avatar , state }); } ProcessAvatar(avatar); if (avataruuid == UUID.Zero) { - return Failure("avatar lookup"); + return Failure("avatar lookup", "FriendFullPerms", new string[] { avatar, state }); } bool status = false; if (bool.TryParse(state, out status) == false) { - return Failure("state invaild"); + return Failure("state invaild", "FriendFullPerms", new string[] { avatar, state }); } if (bot.GetClient.Friends.FriendList.ContainsKey(avataruuid) == false) { - return Failure("Not A friend"); + return Failure("Not A friend", "FriendFullPerms", new string[] { avatar, state }); } if (status == true) { bot.GetClient.Friends.GrantRights(avataruuid, FriendRights.CanSeeOnline | FriendRights.CanSeeOnMap | FriendRights.CanModifyObjects); - return BasicReply("granted"); + return BasicReply("granted", "FriendFullPerms", new string[] { avatar, state }); } bot.GetClient.Friends.GrantRights(avataruuid, FriendRights.None); - return BasicReply("removed"); + return BasicReply("removed", "FriendFullPerms", new string[] { avatar, state }); } [About("Updates the friend perms for avatar avatar to State \n if true grants (Online/Map/Modify) perms")] @@ -80,32 +80,32 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "friends", "FriendRequest", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "FriendRequest", new string[] { avatar, state }); } ProcessAvatar(avatar); if (avataruuid == UUID.Zero) { - return Failure("avatar lookup"); + return Failure("avatar lookup", "FriendRequest", new string[] { avatar, state }); } bool status = false; if (bool.TryParse(state, out status) == false) { - return Failure("state invaild"); + return Failure("state invaild", "FriendRequest", new string[] { avatar, state }); } if (bot.GetClient.Friends.FriendList.ContainsKey(avataruuid) == true) { if (status == false) { bot.GetClient.Friends.TerminateFriendship(avataruuid); - return BasicReply("Removed"); + return BasicReply("Removed", "FriendRequest", new string[] { avatar, state }); } } if (status == false) { - return Failure("Not in friendslist"); + return Failure("Not in friendslist", "FriendRequest", new string[] { avatar, state }); } bot.GetClient.Friends.OfferFriendship(avataruuid); - return BasicReply("Request sent"); + return BasicReply("Request sent", "FriendRequest", new string[] { avatar, state }); } } diff --git a/Core/Commands/Funds.cs b/Core/Commands/Funds.cs index 3a44da5..1e5166b 100644 --- a/Core/Commands/Funds.cs +++ b/Core/Commands/Funds.cs @@ -24,14 +24,14 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "funds", "Balance", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "Balance", new string[] { }); } if (bot.GetAllowFunds == false) { - return Failure("Funds commands are disabled"); + return Failure("Funds commands are disabled", "Balance", new string[] { }); } bot.GetClient.Self.RequestBalance(); - return BasicReply(bot.GetClient.Self.Balance.ToString()); + return BasicReply(bot.GetClient.Self.Balance.ToString(), "Balance", new string[] { }); } [About("Makes the bot pay a avatar")] @@ -47,27 +47,27 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "funds", "PayAvatar", handleGetClientIP()) == false) { - return BasicReply("Token not accepted"); + return Failure("Token not accepted", "PayAvatar", new string[] { avatar, amount }); } if (bot.GetAllowFunds == false) { - return BasicReply("Transfer funds to avatars disabled"); + return Failure("Transfer funds to avatars disabled", "PayAvatar", new string[] { avatar, amount }); } ProcessAvatar(avatar); if (avataruuid == UUID.Zero) { - return BasicReply("avatar lookup"); + return BasicReply("avatar lookup", "PayAvatar", new string[] { avatar, amount }); } if (int.TryParse(amount, out int amountvalue) == false) { - return BasicReply("Invaild amount"); + return Failure("Invaild amount", "PayAvatar", new string[] { avatar, amount }); } if ((amountvalue < 0) || (amountvalue > bot.GetClient.Self.Balance)) { - return Failure("Amount out of range"); + return Failure("Amount out of range", "PayAvatar", new string[] { avatar, amount }); } bot.GetClient.Self.GiveAvatarMoney(avataruuid, amountvalue); - return BasicReply("Accepted"); + return BasicReply("Accepted", "PayAvatar", new string[] { avatar, amount }); } [About("Makes the bot pay a object")] @@ -86,30 +86,30 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "funds", "PayObject", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "PayObject", new string[] { objectuuid, primname, amount }); } if (bot.GetAllowFunds == false) { - return Failure("Funds commands are disabled"); + return Failure("Funds commands are disabled", "PayObject", new string[] { objectuuid, primname, amount }); } if (UUID.TryParse(objectuuid, out UUID objectUUID) == false) { - return Failure("Invaild object UUID"); + return Failure("Invaild object UUID", "PayObject", new string[] { objectuuid, primname, amount }); } if (int.TryParse(amount, out int amountvalue) == false) { - return Failure("Invaild amount"); + return Failure("Invaild amount", "PayObject", new string[] { objectuuid, primname, amount }); } if((amountvalue < 0) || (amountvalue > bot.GetClient.Self.Balance)) { - return Failure("Amount out of range"); + return Failure("Amount out of range", "PayObject", new string[] { objectuuid, primname, amount }); } if(helpers.notempty(primname) == false) { - return Failure("Primname is empty"); + return Failure("Primname is empty", "PayObject", new string[] { objectuuid, primname, amount }); } bot.GetClient.Self.GiveObjectMoney(objectUUID, amountvalue, primname); - return BasicReply("ok"); + return BasicReply("ok", "PayObject", new string[] { objectuuid, primname, amount }); } } } diff --git a/Core/Commands/Group.cs b/Core/Commands/Group.cs index 302f612..80d230d 100644 --- a/Core/Commands/Group.cs +++ b/Core/Commands/Group.cs @@ -31,15 +31,15 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "groups", "IsGroupMember", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "IsGroupMember", new string[] { group, avatar }); } if (UUID.TryParse(group, out UUID groupuuid) == false) { - return Failure("Invaild group UUID"); + return Failure("Invaild group UUID", "IsGroupMember", new string[] { group, avatar }); } if (bot.MyGroups.ContainsKey(groupuuid) == false) { - return Failure("Unknown group"); + return Failure("Unknown group", "IsGroupMember", new string[] { group, avatar }); } if (bot.NeedReloadGroupData(groupuuid) == true) { @@ -49,14 +49,14 @@ namespace BetterSecondBot.HttpService KeyValuePair reply = waitForReady(true, true, groupuuid); if (reply.Key == false) { - return Failure(reply.Value); + return Failure(reply.Value, "IsGroupMember", new string[] { 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)); + return BasicReply(JsonConvert.SerializeObject(replyobject), "IsGroupMember", new string[] { group, avatar }); } [About("Gets membership of a group")] @@ -71,15 +71,15 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "groups", "GetGroupMembers", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "GetGroupMembers", new string[] { group }); } if (UUID.TryParse(group, out UUID groupuuid) == false) { - return Failure("Invaild group UUID"); + return Failure("Invaild group UUID", "GetGroupMembers", new string[] { group }); } if (bot.MyGroups.ContainsKey(groupuuid) == false) { - return Failure("Unknown group"); + return Failure("Unknown group", "GetGroupMembers", new string[] { group }); } if (bot.NeedReloadGroupData(groupuuid) == true) { @@ -88,8 +88,9 @@ namespace BetterSecondBot.HttpService KeyValuePair reply = waitForReady(false, true, groupuuid); if (reply.Key == false) { - return Failure(reply.Value); + return Failure(reply.Value, "GetGroupMembers", new string[] { group }); } + SuccessNoReturn("GetGroupMembers", new string[] { group }); return bot.GetGroupMembers(groupuuid); } @@ -105,26 +106,26 @@ namespace BetterSecondBot.HttpService [Route(HttpVerbs.Get, "/GroupBan/{group}/{avatar}/{state}/{token}")] public object GroupBan(string group, string avatar, string state, string token) { - if (tokens.Allow(token, "groups", "GetGroupMembers", handleGetClientIP()) == false) + if (tokens.Allow(token, "groups", "GroupBan", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "GroupBan", new string[] { group,avatar,state }); } if (UUID.TryParse(group, out UUID groupuuid) == false) { - return Failure("Invaild group UUID"); + return Failure("Invaild group UUID", "GroupBan", new string[] { group, avatar, state }); } if (bot.MyGroups.ContainsKey(groupuuid) == false) { - return Failure("Unknown group"); + return Failure("Unknown group", "GroupBan", new string[] { group, avatar, state }); } if (bool.TryParse(state, out bool banstate) == false) { - return Failure("Invaild ban state"); + return Failure("Invaild ban state", "GroupBan", new string[] { group, avatar, state }); } ProcessAvatar(avatar); if(avataruuid == UUID.Zero) { - return Failure("avatar lookup"); + return Failure("avatar lookup", "GroupBan", new string[] { group, avatar, state }); } GroupBanAction action = GroupBanAction.Unban; string statename = "Unban"; @@ -134,7 +135,7 @@ namespace BetterSecondBot.HttpService statename = "Ban"; } bot.GetClient.Groups.RequestBanAction(groupuuid, action, new UUID[] { avataruuid }); - return BasicReply(statename+" request accepted"); + return BasicReply(statename+" request accepted", "GroupBan", new string[] { group, avatar, state }); } @@ -153,23 +154,23 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "groups", "GroupEject", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "GroupEject", new string[] { group, avatar }); } if (UUID.TryParse(group, out UUID groupuuid) == false) { - return Failure("Invaild group UUID"); + return Failure("Invaild group UUID", "GroupEject", new string[] { group, avatar }); } if (bot.MyGroups.ContainsKey(groupuuid) == false) { - return Failure("Unknown group"); + return Failure("Unknown group", "GroupEject", new string[] { group, avatar }); } ProcessAvatar(avatar); if (avataruuid == UUID.Zero) { - return Failure("avatar lookup"); + return Failure("avatar lookup", "GroupEject", new string[] { group, avatar }); } bot.GetClient.Groups.EjectUser(groupuuid, avataruuid); - return BasicReply("Requested"); + return BasicReply("Requested", "GroupEject", new string[] { group, avatar }); } [About("Adds the avatar to the Group with the role \n if they are not in the group then it invites them aswell")] @@ -188,19 +189,19 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "groups", "GroupAddRole", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "GroupAddRole", new string[] { group, avatar }); } if (UUID.TryParse(group, out UUID groupuuid) == false) { - return Failure("Invaild group UUID"); + return Failure("Invaild group UUID", "GroupAddRole", new string[] { group, avatar }); } if (UUID.TryParse(role, out UUID roleuuid) == false) { - return Failure("Invaild role UUID"); + return Failure("Invaild role UUID", "GroupAddRole", new string[] { group, avatar }); } if (bot.MyGroups.ContainsKey(groupuuid) == false) { - return Failure("Unknown group"); + return Failure("Unknown group", "GroupAddRole", new string[] { group, avatar }); } if (bot.NeedReloadGroupData(groupuuid) == true) { @@ -210,16 +211,16 @@ namespace BetterSecondBot.HttpService KeyValuePair reply = waitForReady(true, true, groupuuid); if (reply.Key == false) { - return Failure(reply.Value); + return Failure(reply.Value, "GroupAddRole", new string[] { group, avatar }); } bool status = bot.FastCheckInGroup(groupuuid, avataruuid); if (status == false) { bot.GetClient.Groups.Invite(groupuuid, new List() { roleuuid }, avataruuid); - return BasicReply("Invite sent"); + return BasicReply("Invite sent", "GroupAddRole", new string[] { group, avatar }); } bot.GetClient.Groups.AddToRole(groupuuid, roleuuid, avataruuid); - return BasicReply("Roles updated"); + return BasicReply("Roles updated", "GroupAddRole", new string[] { group, avatar }); } [About("Eject selected avatar from group")] @@ -237,15 +238,15 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "groups", "GroupInvite", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "GroupInvite", new string[] { group, avatar, role }); } if (UUID.TryParse(group, out UUID groupuuid) == false) { - return Failure("Invaild group UUID"); + return Failure("Invaild group UUID", "GroupInvite", new string[] { group, avatar, role }); } if (bot.MyGroups.ContainsKey(groupuuid) == false) { - return Failure("Unknown group"); + return Failure("Unknown group", "GroupInvite", new string[] { group, avatar, role }); } if (bot.NeedReloadGroupData(groupuuid) == true) { @@ -254,12 +255,12 @@ namespace BetterSecondBot.HttpService ProcessAvatar(avatar); if (avataruuid == UUID.Zero) { - return Failure("avatar lookup"); + return Failure("avatar lookup", "GroupInvite", new string[] { group, avatar, role }); } bool status = bot.FastCheckInGroup(groupuuid, avataruuid); if (status == true) { - return Failure("Already in group"); + return Failure("Already in group", "GroupInvite", new string[] { group, avatar, role }); } if(role == "everyone") { @@ -267,10 +268,10 @@ namespace BetterSecondBot.HttpService } if(UUID.TryParse(role,out UUID roleuuid) == false) { - return Failure("Unable to process role UUID"); + return Failure("Unable to process role UUID", "GroupInvite", new string[] { group, avatar, role }); } bot.GetClient.Groups.Invite(groupuuid, new List() { roleuuid }, avataruuid); - return BasicReply("Invite sent"); + return BasicReply("Invite sent", "GroupInvite", new string[] { group, avatar, role }); } [About("Sends a group notice (No attachments please use GroupnoticeWithAttachment to attach items!)")] @@ -287,30 +288,30 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "groups", "Groupnotice", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "Groupnotice", new string[] { group, title, message }); } if (UUID.TryParse(group, out UUID groupuuid) == false) { - return Failure("Invaild group UUID"); + return Failure("Invaild group UUID", "Groupnotice", new string[] { group, title, message }); } if (bot.MyGroups.ContainsKey(groupuuid) == false) { - return Failure("Unknown group"); + return Failure("Unknown group", "Groupnotice", new string[] { group, title, message }); } if (helpers.notempty(title) == false) { - return Failure("Title empty"); + return Failure("Title empty", "Groupnotice", new string[] { group, title, message }); } if (helpers.notempty(message) == false) { - return Failure("Message empty"); + return Failure("Message empty", "Groupnotice", new string[] { group, title, message }); } GroupNotice NewNotice = new GroupNotice(); NewNotice.Subject = title; NewNotice.Message = message; NewNotice.OwnerID = bot.GetClient.Self.AgentID; bot.GetClient.Groups.SendGroupNotice(groupuuid, NewNotice); - return BasicReply("Sending notice"); + return BasicReply("Sending notice", "Groupnotice", new string[] { group, title, message }); } [About("Activates the selected title")] @@ -325,22 +326,22 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "groups", "GroupActiveTitle", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "GroupActiveTitle", new string[] { group, role }); } if (UUID.TryParse(group, out UUID groupuuid) == false) { - return Failure("Invaild group UUID"); + return Failure("Invaild group UUID", "GroupActiveTitle", new string[] { group, role }); } if (UUID.TryParse(role, out UUID roleuuid) == false) { - return Failure("Invaild role UUID"); + return Failure("Invaild role UUID", "GroupActiveTitle", new string[] { group, role }); } if (bot.MyGroups.ContainsKey(groupuuid) == false) { - return Failure("Unknown group"); + return Failure("Unknown group", "GroupActiveTitle", new string[] { group, role }); } bot.GetClient.Groups.ActivateTitle(groupuuid, roleuuid); - return BasicReply("Switching title"); + return BasicReply("Switching title", "GroupActiveTitle", new string[] { group, role }); } [About("Sets the selected group to the active group")] @@ -351,20 +352,20 @@ namespace BetterSecondBot.HttpService [Route(HttpVerbs.Get, "/GroupActiveGroup/{group}/{token}")] public object GroupActiveGroup(string group, string role, string token) { - if (tokens.Allow(token, "groups", "GroupActiveTitle", handleGetClientIP()) == false) + if (tokens.Allow(token, "groups", "GroupActiveGroup", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "GroupActiveGroup", new string[] { group, role }); } if (UUID.TryParse(group, out UUID groupuuid) == false) { - return Failure("Invaild group UUID"); + return Failure("Invaild group UUID", "GroupActiveGroup", new string[] { group, role }); } if (bot.MyGroups.ContainsKey(groupuuid) == false) { - return Failure("Unknown group"); + return Failure("Unknown group", "GroupActiveGroup", new string[] { group, role }); } bot.GetClient.Groups.ActivateGroup(groupuuid); - return BasicReply("Switching active group"); + return BasicReply("Switching active group", "GroupActiveGroup", new string[] { group, role }); } [About("Sends a group notice with an attachment")] @@ -383,27 +384,27 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "groups", "GroupnoticeWithAttachment", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "GroupnoticeWithAttachment", new string[] { group, title, message, attachment }); } if (UUID.TryParse(group, out UUID groupuuid) == false) { - return Failure("Invaild group UUID"); + return Failure("Invaild group UUID", "GroupnoticeWithAttachment", new string[] { group, title, message, attachment }); } if (UUID.TryParse(attachment, out UUID inventoryuuid) == false) { - return Failure("Invaild inventory UUID"); + return Failure("Invaild inventory UUID", "GroupnoticeWithAttachment", new string[] { group, title, message, attachment }); } if (bot.MyGroups.ContainsKey(groupuuid) == false) { - return Failure("Unknown group"); + return Failure("Unknown group", "GroupnoticeWithAttachment", new string[] { group, title, message, attachment }); } if (helpers.notempty(title) == false) { - return Failure("Title empty"); + return Failure("Title empty", "GroupnoticeWithAttachment", new string[] { group, title, message, attachment }); } if (helpers.notempty(message) == false) { - return Failure("Message empty"); + return Failure("Message empty", "GroupnoticeWithAttachment", new string[] { group, title, message, attachment }); } GroupNotice NewNotice = new GroupNotice(); NewNotice.Subject = title; @@ -411,7 +412,7 @@ namespace BetterSecondBot.HttpService NewNotice.OwnerID = bot.GetClient.Self.AgentID; NewNotice.AttachmentID = inventoryuuid; bot.GetClient.Groups.SendGroupNotice(groupuuid, NewNotice); - return BasicReply("Sending notice with attachment"); + return BasicReply("Sending notice with attachment", "GroupnoticeWithAttachment", new string[] { group, title, message, attachment }); } @@ -422,14 +423,14 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "groups", "GetGroupList", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "GetGroupList", new string[] {}); } Dictionary grouppackage = new Dictionary(); foreach (KeyValuePair entry in bot.MyGroups) { grouppackage.Add(entry.Value.ID.ToString(), entry.Value.Name); } - return BasicReply(JsonConvert.SerializeObject(grouppackage)); + return BasicReply(JsonConvert.SerializeObject(grouppackage), "GetGroupList", new string[] { }); } [About("Requests the roles for the selected group
Replys with GroupRoleDetails object formated as follows
  • UpdateUnderway (Bool)
  • RoleDataAge (Int) [default -1]
  • Roles (KeyPair array of UUID=Name)

")] @@ -443,15 +444,15 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "groups", "GetGroupRoles", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "GetGroupRoles", new string[] { group }); } if (UUID.TryParse(group, out UUID groupuuid) == false) { - return Failure("Invaild group UUID"); + return Failure("Invaild group UUID", "GetGroupRoles", new string[] { group }); } if (bot.MyGroups.ContainsKey(groupuuid) == false) { - return Failure("Unknown group"); + return Failure("Unknown group", "GetGroupRoles", new string[] { group }); } GroupRoleDetails reply = new GroupRoleDetails(); reply.UpdateUnderway = false; @@ -479,10 +480,10 @@ namespace BetterSecondBot.HttpService bot.GetClient.Groups.RequestGroupRoles(groupuuid); if (reply.Roles.Count == 0) { - return Failure("Updating"); + return Failure("Updating", "GetGroupRoles", new string[] { group }); } } - return BasicReply(JsonConvert.SerializeObject(reply)); + return BasicReply(JsonConvert.SerializeObject(reply), "GetGroupRoles", new string[] { group }); } [About("fetchs a list of all groups with unread messages")] @@ -492,9 +493,9 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "groups", "GroupchatListAllUnreadGroups", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "GroupchatListAllUnreadGroups", new string[] { }); } - return BasicReply(JsonConvert.SerializeObject(bot.UnreadGroupchatGroups())); + return BasicReply(JsonConvert.SerializeObject(bot.UnreadGroupchatGroups()), "GroupchatListAllUnreadGroups", new string[] { }); } [About("fetchs a list of all groups with unread messages")] @@ -506,20 +507,20 @@ namespace BetterSecondBot.HttpService [Route(HttpVerbs.Get, "/GroupchatGroupHasUnread/{group}/{token}")] public object GroupchatGroupHasUnread(string group,string token) { - if (tokens.Allow(token, "groups", "GroupchatListAllUnreadGroups", handleGetClientIP()) == false) + if (tokens.Allow(token, "groups", "GroupchatGroupHasUnread", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "GroupchatGroupHasUnread", new string[] { group }); } UUID groupUUID = UUID.Zero; if(UUID.TryParse(group,out groupUUID) == false) { - return Failure("group value is invaild"); + return Failure("group value is invaild", "GroupchatGroupHasUnread", new string[] { group }); } if(bot.MyGroups.ContainsKey(groupUUID) == false) { - return Failure("Unknown group"); + return Failure("Unknown group", "GroupchatGroupHasUnread", new string[] { group }); } - return BasicReply(bot.GroupHasUnread(groupUUID).ToString()); + return BasicReply(bot.GroupHasUnread(groupUUID).ToString(), "GroupchatGroupHasUnread", new string[] { group }); } @@ -530,9 +531,9 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "groups", "GroupchatAnyUnread", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "GroupchatAnyUnread", new string[] { }); } - return BasicReply(bot.HasUnreadGroupchats().ToString()); + return BasicReply(bot.HasUnreadGroupchats().ToString(), "GroupchatAnyUnread", new string[] { }); } [About("Clears all group chat buffers at once")] @@ -542,10 +543,10 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "groups", "GroupchatClearAll", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "GroupchatClearAll", new string[] { }); } bot.ClearAllGroupchat(); - return BasicReply("ok"); + return BasicReply("ok", "GroupchatClearAll", new string[] { }); } [About("fetchs the groupchat history")] @@ -557,13 +558,13 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "groups", "GroupchatHistory", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "GroupchatHistory", new string[] { group }); } if (UUID.TryParse(group, out UUID groupUUID) == false) { - return Failure("Group UUID invaild"); + return Failure("Group UUID invaild", "GroupchatHistory", new string[] { group }); } - return BasicReply(JsonConvert.SerializeObject(bot.GetGroupchat(groupUUID))); + return BasicReply(JsonConvert.SerializeObject(bot.GetGroupchat(groupUUID)), "GroupchatHistory", new string[] { group }); } [About("sends a message to the groupchat")] @@ -578,24 +579,24 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "groups", "Groupchat", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "Groupchat", new string[] { group, message }); } UUID groupUUID = UUID.Zero; if (UUID.TryParse(group, out groupUUID) == false) { - return Failure("group value is invaild"); + return Failure("group value is invaild", "Groupchat", new string[] { group, message }); } if (bot.MyGroups.ContainsKey(groupUUID) == false) { - return Failure("Unknown group"); + return Failure("Unknown group", "Groupchat", new string[] { group, message }); } if (bot.GetActiveGroupchatSessions.Contains(groupUUID) == false) { bot.GetClient.Self.RequestJoinGroupChat(groupUUID); - return Failure("Opening groupchat"); + return Failure("Opening groupchat", "Groupchat", new string[] { group, message }); } bot.GetClient.Self.InstantMessageGroup(groupUUID, message); - return BasicReply("Sending"); + return BasicReply("Sending", "Groupchat", new string[] { group, message }); } protected KeyValuePair waitForReady(bool avatar, bool group, UUID groupuuid) diff --git a/Core/Commands/Home.cs b/Core/Commands/Home.cs index dc26b5e..45c0774 100644 --- a/Core/Commands/Home.cs +++ b/Core/Commands/Home.cs @@ -19,14 +19,14 @@ namespace BetterSecondBot.HttpService [About("Makes the bot teleport to its home region")] [ReturnHints("ok")] [Route(HttpVerbs.Get, "/GoHome/{token}")] - public object GoHome(string group, string token) + public object GoHome(string token) { - if (tokens.Allow(token, "groups", "GetGroupMembers", handleGetClientIP()) == false) + if (tokens.Allow(token, "home", "GoHome", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "GoHome", new string[] { }); } bot.GotoNextHomeRegion(); - return BasicReply("ok"); + return BasicReply("ok", "GoHome", new string[] { }); } } diff --git a/Core/Commands/Im.cs b/Core/Commands/Im.cs index 02d5aaf..942ab82 100644 --- a/Core/Commands/Im.cs +++ b/Core/Commands/Im.cs @@ -22,19 +22,19 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "im", "chatwindows", handleGetClientIP()) == false) { - return BasicReply("Token not accepted"); + return BasicReply("Token not accepted", "chatwindows", new string[] { }); } - return BasicReply(JsonConvert.SerializeObject(bot.GetIMChatWindowKeyNames())); + return BasicReply(JsonConvert.SerializeObject(bot.GetIMChatWindowKeyNames()), "chatwindows", new string[] { }); } [About("gets a list of chat windows with unread messages")] [ReturnHints("array of UUID")] [Route(HttpVerbs.Get, "/listwithunread/{token}")] - public object listwithunread(string group, string token) + public object listwithunread(string token) { if (tokens.Allow(token, "im", "listwithunread", handleGetClientIP()) == false) { - return BasicReply("Token not accepted"); + return BasicReply("Token not accepted", "listwithunread", new string[] { }); } List unreadimwindows = new List(); foreach (UUID window in bot.IMChatWindows()) @@ -44,7 +44,7 @@ namespace BetterSecondBot.HttpService unreadimwindows.Add(window); } } - return BasicReply(JsonConvert.SerializeObject(unreadimwindows)); + return BasicReply(JsonConvert.SerializeObject(unreadimwindows), "listwithunread", new string[] { }); } [About("gets if there are any unread im messages at all")] @@ -54,7 +54,7 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "im", "haveunreadims", handleGetClientIP()) == false) { - return BasicReply("Token not accepted"); + return BasicReply("Token not accepted", "haveunreadims", new string[] { }); } bool reply = false; foreach (UUID window in bot.IMChatWindows()) @@ -65,7 +65,7 @@ namespace BetterSecondBot.HttpService break; } } - return BasicReply(reply.ToString()); + return BasicReply(reply.ToString(), "haveunreadims", new string[] { }); } [About("gets the chat from the selected window")] @@ -77,13 +77,13 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "im", "getimchat", handleGetClientIP()) == false) { - return BasicReply("Token not accepted"); + return Failure("Token not accepted", "getimchat", new string[] { window }); } if (UUID.TryParse(window, out UUID windowUUID) == false) { - return BasicReply("Window UUID invaild"); + return Failure("Window UUID invaild", "getimchat", new string[] { window }); } - return BasicReply(JsonConvert.SerializeObject(bot.GetIMChatWindow(windowUUID))); + return BasicReply(JsonConvert.SerializeObject(bot.GetIMChatWindow(windowUUID)), "getimchat", new string[] { window }); } } } diff --git a/Core/Commands/Info.cs b/Core/Commands/Info.cs index 19a4c18..d603488 100644 --- a/Core/Commands/Info.cs +++ b/Core/Commands/Info.cs @@ -23,9 +23,9 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "info", "Version", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "Version", new string[] { }); } - return BasicReply(bot.MyVersion); + return BasicReply(bot.MyVersion, "Version", new string[] { }); } @@ -36,9 +36,9 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "info", "Name", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "Name", new string[] { }); } - return BasicReply(bot.GetClient.Self.FirstName + " " + bot.GetClient.Self.LastName); + return BasicReply(bot.GetClient.Self.FirstName + " " + bot.GetClient.Self.LastName, "Name", new string[] { }); } [About("Fetchs the current parcels name")] @@ -50,18 +50,18 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "info", "ParcelName", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "ParcelName", new string[] { }); } if (bot.GetClient.Network.CurrentSim == null) { - return Failure("Error not in a sim"); + return Failure("Error not in a sim", "ParcelName", new string[] { }); } int localid = bot.GetClient.Parcels.GetParcelLocalID(bot.GetClient.Network.CurrentSim, bot.GetClient.Self.SimPosition); if (bot.GetClient.Network.CurrentSim.Parcels.ContainsKey(localid) == false) { - return Failure("Error parcel not found"); + return Failure("Error parcel not found", "ParcelName", new string[] { }); } - return BasicReply(bot.GetClient.Network.CurrentSim.Parcels[localid].Name); + return BasicReply(bot.GetClient.Network.CurrentSim.Parcels[localid].Name, "ParcelName", new string[] { }); } [About("Requests the current unixtime at the bot")] @@ -71,9 +71,9 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "info", "UnixTimeNow", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "UnixTimeNow", new string[] { }); } - return BasicReply(helpers.UnixTimeNow().ToString()); + return BasicReply(helpers.UnixTimeNow().ToString(), "UnixTimeNow", new string[] { }); } [About("Fetchs the current region name")] @@ -84,13 +84,13 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "info", "SimName", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "SimName", new string[] { }); } if (bot.GetClient.Network.CurrentSim == null) { - return Failure("Error not in a sim"); + return Failure("Error not in a sim", "SimName", new string[] { }); } - return BasicReply(bot.GetClient.Network.CurrentSim.Name); + return BasicReply(bot.GetClient.Network.CurrentSim.Name, "SimName", new string[] { }); } [About("Fetchs the current location of the bot")] @@ -101,17 +101,17 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "info", "GetPosition", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "GetPosition", new string[] { }); } if (bot.GetClient.Network.CurrentSim == null) { - return Failure("Error not in a sim"); + return Failure("Error not in a sim", "GetPosition", new string[] { }); } Dictionary pos = new Dictionary(); pos.Add("x", (int)Math.Round(bot.GetClient.Self.SimPosition.X)); pos.Add("y", (int)Math.Round(bot.GetClient.Self.SimPosition.Y)); pos.Add("z", (int)Math.Round(bot.GetClient.Self.SimPosition.Z)); - return BasicReply(JsonConvert.SerializeObject(pos)); + return BasicReply(JsonConvert.SerializeObject(pos), "GetPosition", new string[] { }); } } } diff --git a/Core/Commands/Inventory.cs b/Core/Commands/Inventory.cs index e8db20a..e7f5c2d 100644 --- a/Core/Commands/Inventory.cs +++ b/Core/Commands/Inventory.cs @@ -26,19 +26,19 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "inventory", "RezObject", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "RezObject", new string[] { item }); } if (UUID.TryParse(item, out UUID targetitem) == true) { - return Failure("Invaild item UUID"); + return Failure("Invaild item UUID", "RezObject", new string[] { item }); } InventoryItem itm = bot.GetClient.Inventory.FetchItem(targetitem, bot.GetClient.Self.AgentID, (5 * 1000)); if (itm == null) { - return Failure("Unable to find item"); + return Failure("Unable to find item", "RezObject", new string[] { item }); } UUID rezedobject = bot.GetClient.Inventory.RequestRezFromInventory(bot.GetClient.Network.CurrentSim, bot.GetClient.Self.SimRotation, bot.GetClient.Self.RelativePosition, itm); - return BasicReply(rezedobject.ToString()); + return BasicReply(rezedobject.ToString(), "RezObject", new string[] { item }); } @@ -50,28 +50,28 @@ namespace BetterSecondBot.HttpService [ArgHints("item", "URLARG", "UUID of item/folder to name")] [ArgHints("newname", "Text", "What we are changing it to")] [Route(HttpVerbs.Post, "/RenameInventory/{item}/{token}")] - public object RenameInventory(string item, string token, [FormField] string newname) + public object RenameInventory(string item, [FormField] string newname, string token) { if (tokens.Allow(token, "inventory", "RenameInventory", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "RenameInventory", new string[] { item, newname }); } if (UUID.TryParse(item, out UUID target) == false) { - return Failure("invaild item uuid"); + return Failure("invaild item uuid", "RenameInventory", new string[] { item, newname }); } if (newname.Length < 3) { - return Failure("Item name is to short"); + return Failure("Item name is to short", "RenameInventory", new string[] { item, newname }); } InventoryItem realitem = HelperInventory.getItemByInventoryUUID(bot, target); if (realitem == null) { - return Failure("Unable to find inventory item"); + return Failure("Unable to find inventory item", "RenameInventory", new string[] { item, newname }); } realitem.Name = newname; bot.GetClient.Inventory.RequestUpdateItem(realitem); - return BasicReply("Ok"); + return BasicReply("Ok", "RenameInventory", new string[] { item, newname }); } [About("Attempts to Remove the given inventory item")] @@ -83,14 +83,14 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "inventory", "DeleteInventoryItem", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "DeleteInventoryItem", new string[] { item }); } if (UUID.TryParse(item, out UUID target) == false) { - return Failure("invaild item uuid"); + return Failure("invaild item uuid", "DeleteInventoryItem", new string[] { item }); } bot.GetClient.Inventory.Remove(new List() { target }, new List()); - return BasicReply("Ok"); + return BasicReply("Ok", "DeleteInventoryItem", new string[] { item }); } [About("Attempts to Remove the given inventory folder")] @@ -102,14 +102,14 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "inventory", "DeleteInventoryFolder", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "DeleteInventoryFolder", new string[] { folder }); } if (UUID.TryParse(folder, out UUID target) == false) { - return Failure("invaild folder uuid"); + return Failure("invaild folder uuid", "DeleteInventoryFolder", new string[] { folder }); } bot.GetClient.Inventory.Remove(new List(), new List() { target }); - return BasicReply("Ok"); + return BasicReply("Ok", "DeleteInventoryFolder", new string[] { folder }); } [About("Attempts to attach the given inventory item")] @@ -121,15 +121,15 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "inventory", "Attach", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "Attach", new string[] { item }); } if(UUID.TryParse(item,out UUID itemuuid) == false) { - return Failure("invaild item uuid"); + return Failure("invaild item uuid", "Attach", new string[] { item }); } InventoryItem realitem = HelperInventory.getItemByInventoryUUID(bot, itemuuid); bot.GetClient.Appearance.AddAttachments(new List() { realitem }, false, false); - return BasicReply("Ok"); + return BasicReply("Ok", "Attach", new string[] { item }); } [About("Attempts to Remove the given inventory folder")] @@ -141,15 +141,15 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "inventory", "Detach", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "Detach", new string[] { item }); } if (UUID.TryParse(item, out UUID itemuuid) == false) { - return Failure("invaild item uuid"); + return Failure("invaild item uuid", "Detach", new string[] { item }); } InventoryItem realitem = HelperInventory.getItemByInventoryUUID(bot, itemuuid); bot.GetClient.Appearance.RemoveFromOutfit(realitem); - return BasicReply("Ok"); + return BasicReply("Ok", "Detach", new string[] { item }); } [About("Replaces the current avatar outfit with the Clothing/[NAME] folder
Please note: This does not use the outfits folder!
Please do not use links in the folder!")] @@ -164,11 +164,11 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "inventory", "Outfit", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "Outfit", new string[] { name }); } if (helpers.notempty(name) == false) { - return Failure("Named folder value is empty"); + return Failure("Named folder value is empty", "Outfit", new string[] { name }); } // uses the Clothing folder // must be a full outfit (shapes/eyes ect) @@ -185,7 +185,7 @@ namespace BetterSecondBot.HttpService } if (AA == null) { - return Failure("Cant find Clothing folder"); + return Failure("Cant find Clothing folder", "Outfit", new string[] { name }); } T = bot.GetClient.Inventory.Store.GetContents(AA); AA = null; @@ -199,13 +199,13 @@ namespace BetterSecondBot.HttpService } if (AA == null) { - return Failure("Cant find target folder"); + return Failure("Cant find target folder", "Outfit", new string[] { name }); } List contents = bot.GetClient.Inventory.FolderContents(AA.UUID, bot.GetClient.Self.AgentID, true, true, InventorySortOrder.ByName, 5 * 1000); List wareables = new List(); if (contents == null) { - return Failure("target folder is empty or so full I cant get it in 5 secs..."); + return Failure("target folder is empty or so full I cant get it in 5 secs...", "Outfit", new string[] { name }); } foreach (InventoryBase item in contents) { @@ -215,7 +215,7 @@ namespace BetterSecondBot.HttpService } } bot.GetClient.Appearance.ReplaceOutfit(wareables, false); - return BasicReply("ok"); + return BasicReply("ok", "Outfit", new string[] { name }); } @@ -228,7 +228,7 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "inventory", "InventoryPurgeNotecards", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "InventoryPurgeNotecards", new string[] { }); } List T = bot.GetClient.Inventory.Store.GetContents(bot.GetClient.Inventory.Store.RootFolder); InventoryBase NotecardFolder = null; @@ -242,7 +242,7 @@ namespace BetterSecondBot.HttpService } if (NotecardFolder != null) { - return Failure("Unable to find notecard folder"); + return Failure("Unable to find notecard folder", "InventoryPurgeNotecards", new string[] { }); } List purge_notecards = new List(); List contents = bot.GetClient.Inventory.FolderContents(NotecardFolder.UUID, bot.GetClient.Self.AgentID, true, true, InventorySortOrder.ByDate, 40 * 1000); @@ -262,7 +262,7 @@ namespace BetterSecondBot.HttpService { bot.GetClient.Inventory.Remove(purge_notecards, new List()); } - return BasicReply("Ok"); + return BasicReply("Ok", "InventoryPurgeNotecards", new string[] { }); } [About("converts a inventory uuid to a realworld uuid
Needed for texture preview")] @@ -274,14 +274,14 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "inventory", "getRealUUID", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "getRealUUID", new string[] { item }); } if (UUID.TryParse(item, out UUID itemUUID) == false) { - return Failure("Invaild item uuid"); + return Failure("Invaild item uuid", "getRealUUID", new string[] { item }); } UUID reply = HelperInventory.GetAssetUUID(bot, itemUUID); - return BasicReply(reply.ToString()); + return BasicReply(reply.ToString(), "getRealUUID", new string[] { item }); } [About("sends a item to an avatar")] @@ -297,24 +297,24 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "inventory", "SendItem", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "SendItem", new string[] { item, avatar }); } ProcessAvatar(avatar); if(avataruuid == UUID.Zero) { - return Failure("Invaild avatar uuid"); + return Failure("Invaild avatar uuid", "SendItem", new string[] { item, avatar }); } if (UUID.TryParse(item, out UUID targetitem) == true) { - return Failure("Invaild item uuid"); + return Failure("Invaild item uuid", "SendItem", new string[] { item, avatar }); } InventoryItem itm = bot.GetClient.Inventory.FetchItem(targetitem, bot.GetClient.Self.AgentID, (3 * 1000)); if (itm == null) { - return Failure("Unable to find item"); + return Failure("Unable to find item", "SendItem", new string[] { item, avatar }); } bot.GetClient.Inventory.GiveItem(itm.UUID, itm.Name, itm.AssetType, avataruuid, false); - return BasicReply("ok"); + return BasicReply("ok", "SendItem", new string[] { item, avatar }); } [About("Sends a folder to an avatar")] @@ -330,24 +330,24 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "inventory", "SendFolder", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "SendFolder", new string[] { folder, avatar }); } ProcessAvatar(avatar); if (avataruuid == UUID.Zero) { - return Failure("Invaild avatar uuid"); + return Failure("Invaild avatar uuid", "SendFolder", new string[] { folder, avatar }); } if (UUID.TryParse(folder, out UUID targetfolder) == true) { - return Failure("Invaild folder uuid"); + return Failure("Invaild folder uuid", "SendFolder", new string[] { folder, avatar }); } InventoryBase FindFolderHelper = HelperInventory.FindFolder(bot, bot.GetClient.Inventory.Store.RootFolder, targetfolder); if (FindFolderHelper == null) { - return Failure("Unable to find folder"); + return Failure("Unable to find folder", "SendFolder", new string[] { folder, avatar }); } bot.GetClient.Inventory.GiveFolder(FindFolderHelper.UUID, FindFolderHelper.Name, avataruuid, false); - return BasicReply("ok"); + return BasicReply("ok", "SendFolder", new string[] { folder, avatar }); } @@ -369,25 +369,25 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "inventory", "TransferInventoryToObject", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "TransferInventoryToObject", new string[] { item, objectuuid, running }); } if (UUID.TryParse(item, out UUID itemuuid) == false) { - return Failure("Invaild item uuid"); + return Failure("Invaild item uuid", "TransferInventoryToObject", new string[] { item, objectuuid, running }); } if (UUID.TryParse(objectuuid, out UUID objectUUID) == false) { - return Failure("Invaild object uuid"); + return Failure("Invaild object uuid", "TransferInventoryToObject", new string[] { item, objectuuid, running }); } if (bool.TryParse(running, out bool runscript) == false) { - return Failure("Invaild running"); + return Failure("Invaild running", "TransferInventoryToObject", new string[] { item, objectuuid, running }); } InventoryItem itm = bot.GetClient.Inventory.FetchItem(itemuuid, bot.GetClient.Self.AgentID, (3 * 1000)); if (itm == null) { - return Failure("Unable to find inventory"); + return Failure("Unable to find inventory", "TransferInventoryToObject", new string[] { item, objectuuid, running }); } Dictionary objects_copy = bot.GetClient.Network.CurrentSim.ObjectsPrimitives.Copy(); KeyValuePair RealObject = new KeyValuePair(0,null); @@ -401,7 +401,7 @@ namespace BetterSecondBot.HttpService } if (RealObject.Value == null) { - return Failure("Unable to find object"); + return Failure("Unable to find object", "TransferInventoryToObject", new string[] { item, objectuuid, running }); } bool scriptState = runscript; if (itm.AssetType != AssetType.LSLText) @@ -411,10 +411,10 @@ namespace BetterSecondBot.HttpService if (itm.AssetType == AssetType.LSLText) { bot.GetClient.Inventory.CopyScriptToTask(RealObject.Key, itm, scriptState); - return BasicReply("Transfering script [state: "+scriptState.ToString()+"]"); + return BasicReply("Transfering script [state: "+scriptState.ToString()+"]", "TransferInventoryToObject", new string[] { item, objectuuid, running }); } bot.GetClient.Inventory.UpdateTaskInventory(RealObject.Key, itm); - return BasicReply("Transfering inventory"); + return BasicReply("Transfering inventory", "TransferInventoryToObject", new string[] { item, objectuuid, running }); } [About("Requests the inventory folder layout as a json object InventoryMapFolder
Formated as follows
InventoryMapItem
  • id: UUID
  • name: String
  • subfolders: InventoryMapFolder[]
")] @@ -425,11 +425,11 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "inventory", "InventoryFolders", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "InventoryFolders", new string[] { }); } string reply = HelperInventory.MapFolderJson(bot); - if (reply != null) return BasicReply(reply); - return Failure("Error"); + if (reply != null) return BasicReply(reply, "InventoryFolders", new string[] { }); + return Failure("Error", "InventoryFolders", new string[] { }); } [About("Requests the contents of a folder as an array of InventoryMapItem
Formated as follows
InventoryMapItem
  • id: UUID
  • name: String
  • typename: String
")] @@ -441,13 +441,13 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "inventory", "InventoryContents", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "InventoryContents", new string[] { folderUUID }); } if (UUID.TryParse(folderUUID, out UUID folder) == false) { - return Failure("Invaild folder UUID"); + return Failure("Invaild folder UUID", "InventoryContents", new string[] { folderUUID }); } - return BasicReply(HelperInventory.MapFolderInventoryJson(bot, folder)); + return BasicReply(HelperInventory.MapFolderInventoryJson(bot, folder), "InventoryContents", new string[] { folderUUID }); } } } diff --git a/Core/Commands/Movement.cs b/Core/Commands/Movement.cs index 9b655b5..15fb054 100644 --- a/Core/Commands/Movement.cs +++ b/Core/Commands/Movement.cs @@ -31,23 +31,23 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "movement", "AutoPilot", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "AutoPilot", new string[] { x, y, z }); } if (Vector3.TryParse("<" + x + "," + y + "," + z + ">", out Vector3 pos) == false) { - return Failure("Convert to vector has failed"); + return Failure("Convert to vector has failed", "AutoPilot", new string[] { x, y, z }); } if (helpers.inrange(pos.X, 0, 255) == false) { - return Failure("x value out of range 0-255"); + return Failure("x value out of range 0-255", "AutoPilot", new string[] { x, y, z }); } if (helpers.inrange(pos.Y, 0, 255) == false) { - return Failure("y value out of range 0-255"); + return Failure("y value out of range 0-255", "AutoPilot", new string[] { x, y, z }); } if (helpers.inrange(pos.Z, 0, 5000) == false) { - return Failure("z value out of range 0-5000"); + return Failure("z value out of range 0-5000", "AutoPilot", new string[] { x, y, z }); } bot.GetClient.Self.AutoPilotCancel(); bot.GetClient.Self.Movement.TurnToward(pos, true); @@ -55,7 +55,7 @@ namespace BetterSecondBot.HttpService uint Globalx, Globaly; Utils.LongToUInts(bot.GetClient.Network.CurrentSim.Handle, out Globalx, out Globaly); bot.GetClient.Self.AutoPilot((ulong)(Globalx + pos.X), (ulong)(Globaly + pos.Y), pos.Z); - return BasicReply("ok"); + return BasicReply("ok", "AutoPilot", new string[] { x, y, z }); } [About("Attempt to teleport to a new region")] @@ -65,10 +65,10 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "movement", "AutoPilotStop", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "AutoPilotStop", new string[] { }); } bot.GetClient.Self.AutoPilotCancel(); - return BasicReply("ok"); + return BasicReply("ok", "AutoPilotStop", new string[] { }); } [About("Make the bot request the target avatar teleport to the bot")] @@ -80,15 +80,15 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "movement", "SendTeleportLure", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "SendTeleportLure", new string[] { avatar }); } ProcessAvatar(avatar); if(avataruuid == UUID.Zero) { - return Failure("Invaild avatar UUID"); + return Failure("Invaild avatar UUID", "SendTeleportLure", new string[] { avatar }); } bot.GetClient.Self.SendTeleportLure(avataruuid); - return BasicReply("ok"); + return BasicReply("ok", "SendTeleportLure", new string[] { avatar }); } [About("Sends a teleport request (Move the bot to the avatar)")] @@ -100,16 +100,16 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "movement", "RequestTeleport", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "RequestTeleport", new string[] { avatar }); } ProcessAvatar(avatar); if (avataruuid == UUID.Zero) { - return Failure("Invaild avatar UUID"); + return Failure("Invaild avatar UUID", "RequestTeleport", new string[] { avatar }); } bot.Add_action_from("teleport", avataruuid); bot.GetClient.Self.SendTeleportLureRequest(avataruuid, "I would like to teleport to you"); - return BasicReply("ok"); + return BasicReply("ok", "RequestTeleport", new string[] { avatar }); } [About("Makes the bot fly (or not)")] @@ -121,15 +121,15 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "movement", "Fly", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "Fly", new string[] { mode }); } if (bool.TryParse(mode, out bool flymode) == false) { - return Failure("Invaild mode"); + return Failure("Invaild mode", "Fly", new string[] { mode }); } bot.GetClient.Self.Movement.Fly = flymode; bot.GetClient.Self.Movement.SendUpdate(); - return BasicReply("ok"); + return BasicReply("ok", "Fly", new string[] { mode }); } @@ -144,25 +144,25 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "movement", "RotateToFaceVector", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "RotateToFaceVector", new string[] { vector }); } if (Vector3.TryParse(vector, out Vector3 pos) == false) { - return Failure("Invaild vector"); + return Failure("Invaild vector", "RotateToFaceVector", new string[] { vector }); } if (helpers.inrange(pos.X, 0, 255) == false) { - return Failure("Vector x value is out of range 0-255"); + return Failure("Vector x value is out of range 0-255", "RotateToFaceVector", new string[] { vector }); } if (helpers.inrange(pos.Y, 0, 255) == false) { - return Failure("Vector y value is out of range 0-255"); + return Failure("Vector y value is out of range 0-255", "RotateToFaceVector", new string[] { vector }); } if (helpers.inrange(pos.Z, 0, 5000) == false) { - return Failure("Vector z value is out of range 0-5000"); + return Failure("Vector z value is out of range 0-5000", "RotateToFaceVector", new string[] { vector }); } - return BasicReply(bot.GetClient.Self.Movement.TurnToward(pos, true).ToString()); + return BasicReply(bot.GetClient.Self.Movement.TurnToward(pos, true).ToString(), "RotateToFaceVector", new string[] { vector }); } [About("Rotates the bot to face a avatar")] @@ -175,18 +175,18 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "movement", "RotateToFace", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "RotateToFace", new string[] { avatar }); } ProcessAvatar(avatar); if(avataruuid == UUID.Zero) { - return Failure("Invaild avatar UUID"); + return Failure("Invaild avatar UUID", "RotateToFace", new string[] { avatar }); } if (bot.GetClient.Network.CurrentSim.AvatarPositions.ContainsKey(avataruuid) == false) { - return Failure("Unable to see avatar"); + return Failure("Unable to see avatar", "RotateToFace", new string[] { avatar }); } - return BasicReply(bot.GetClient.Self.Movement.TurnToward(bot.GetClient.Network.CurrentSim.AvatarPositions[avataruuid], true).ToString()); + return BasicReply(bot.GetClient.Self.Movement.TurnToward(bot.GetClient.Network.CurrentSim.AvatarPositions[avataruuid], true).ToString(), "RotateToFace", new string[] { avatar }); } @@ -199,11 +199,11 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "movement", "RotateTo", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "RotateTo", new string[] { deg }); } if (float.TryParse(deg, out float target_yaw) == true) { - return Failure("Unable to process rotation"); + return Failure("Unable to process rotation", "RotateTo", new string[] { deg }); } float yaw = target_yaw; bot.GetClient.Self.Movement.BodyRotation.GetEulerAngles(out float roll, out float pitch, out _); @@ -226,7 +226,7 @@ namespace BetterSecondBot.HttpService result.Z = cosYawOver2 * cosPitchOver2 * sinRollOver2 - sinYawOver2 * sinPitchOver2 * cosRollOver2; bot.GetClient.Self.Movement.BodyRotation = result; bot.GetClient.Self.Movement.SendUpdate(); - return BasicReply("ok"); + return BasicReply("ok", "RotateTo", new string[] { deg }); } @@ -243,14 +243,15 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "movement", "Teleport", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "Teleport", new string[] { region,x,y,z }); } bool status = TeleportRequest(new string[] { region, x, y, z }); if (status == false) { - return Failure("Error Unable to Teleport to location"); + return Failure("Error Unable to Teleport to location", "Teleport", new string[] { region, x, y, z }); } - return BasicReply("Accepted"); + bot.SetTeleported(); + return BasicReply("Accepted", "Teleport", new string[] { region, x, y, z }); } @@ -263,13 +264,14 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "movement", "TeleportSLURL", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "TeleportSLURL", new string[] { slurl }); } if(helpers.notempty(slurl) == false) { - return Failure("slurl is empty"); + return Failure("slurl is empty", "TeleportSLURL", new string[] { slurl }); } - return BasicReply(TeleportRequest(new string[] { slurl }).ToString()); + bot.SetTeleported(); + return BasicReply(TeleportRequest(new string[] { slurl }).ToString(), "TeleportSLURL", new string[] { slurl }); } protected bool TeleportRequest(string[] args) diff --git a/Core/Commands/Notecard.cs b/Core/Commands/Notecard.cs index e644683..3a4015f 100644 --- a/Core/Commands/Notecard.cs +++ b/Core/Commands/Notecard.cs @@ -26,18 +26,18 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "notecard", "NotecardAdd", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "NotecardAdd", new string[] { collection, content }); } if (helpers.notempty(collection) == false) { - return Failure("Collection value is empty"); + return Failure("Collection value is empty", "NotecardAdd", new string[] { collection, content }); } if (helpers.notempty(content) == false) { - return Failure("Content value is empty"); + return Failure("Content value is empty", "NotecardAdd", new string[] { collection, content }); } bot.NotecardAddContent(collection, content); - return BasicReply("ok"); + return BasicReply("ok", "NotecardAdd", new string[] { collection, content }); } [About("Adds content to the Collection
Also creates the Collection if it does not exist")] @@ -48,14 +48,14 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "notecard", "NotecardClear", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "NotecardClear", new string[] { collection }); } if (helpers.notempty(collection) == false) { - return Failure("Collection value is empty"); + return Failure("Collection value is empty", "NotecardClear", new string[] { collection }); } bot.ClearNotecardStorage(collection); - return BasicReply("ok"); + return BasicReply("ok", "NotecardClear", new string[] { collection }); } [About("Adds content to the Collection
Also creates the Collection if it does not exist")] @@ -70,28 +70,28 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "notecard", "NotecardSend", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "NotecardSend", new string[] { avatar, collection, notecardname }); } if (helpers.notempty(collection) == false) { - return Failure("Collection value is empty"); + return Failure("Collection value is empty", "NotecardSend", new string[] { avatar, collection, notecardname }); } if (helpers.notempty(notecardname) == false) { - return Failure("Notecardname value is empty"); + return Failure("Notecardname value is empty", "NotecardSend", new string[] { avatar, collection, notecardname }); } ProcessAvatar(avatar); if(avataruuid == UUID.Zero) { - return Failure("Invaild avatar uuid"); + return Failure("Invaild avatar uuid", "NotecardSend", new string[] { avatar, collection, notecardname }); } string content = bot.GetNotecardContent(collection); if (content == null) { - return Failure("No content in notecard storage " + collection); + return Failure("No content in notecard storage " + collection, "NotecardSend", new string[] { avatar, collection, notecardname }); } bot.ClearNotecardStorage(collection); - return BasicReply(bot.SendNotecard(notecardname, content, avataruuid).ToString()); + return BasicReply(bot.SendNotecard(notecardname, content, avataruuid).ToString(), "NotecardSend", new string[] { avatar, collection, notecardname }); } } } diff --git a/Core/Commands/Parcel.cs b/Core/Commands/Parcel.cs index 2bda003..210bc53 100644 --- a/Core/Commands/Parcel.cs +++ b/Core/Commands/Parcel.cs @@ -32,15 +32,15 @@ namespace BetterSecondBot.HttpService KeyValuePair tests = SetupCurrentParcel(token, "parcel", "SetParcelSale"); if(tests.Key == false) { - return Failure(tests.Value); + return Failure(tests.Value, "SetParcelSale", new string[] { amount, avatar }); } if (int.TryParse(amount,out int amountvalue) == false) { - return Failure("Invaild amount"); + return Failure("Invaild amount", "SetParcelSale", new string[] { amount, avatar }); } if((amountvalue < 1) || (amountvalue > 9999999)) { - return Failure("Invaild amount"); + return Failure("Invaild amount", "SetParcelSale", new string[] { amount, avatar }); } ProcessAvatar(avatar); targetparcel.SalePrice = amountvalue; @@ -48,7 +48,7 @@ namespace BetterSecondBot.HttpService parcel_static.ParcelSetFlag(ParcelFlags.ForSale, targetparcel, true); parcel_static.ParcelSetFlag(ParcelFlags.ForSaleObjects, targetparcel, false); targetparcel.Update(bot.GetClient.Network.CurrentSim, false); - return Failure("ok"); + return Failure("ok", "SetParcelSale", new string[] { amount, avatar }); } [About("Changes the parcel landing mode to point and sets the landing point")] @@ -65,24 +65,24 @@ namespace BetterSecondBot.HttpService KeyValuePair tests = SetupCurrentParcel(token, "parcel", "SetParcelLandingZone"); if (tests.Key == false) { - return Failure(tests.Value); + return Failure(tests.Value, "SetParcelLandingZone", new string[] { x, y, z }); } if(int.TryParse(x,out int X) == false) { - return Failure("Unable to process landing point x value"); + return Failure("Unable to process landing point x value", "SetParcelLandingZone", new string[] { x, y, z }); } if (int.TryParse(y, out int Y) == false) { - return Failure("Unable to process landing point y value"); + return Failure("Unable to process landing point y value", "SetParcelLandingZone", new string[] { x, y, z }); } if (int.TryParse(z, out int Z) == false) { - return Failure("Unable to process landing point z value"); + return Failure("Unable to process landing point z value", "SetParcelLandingZone", new string[] { x, y, z }); } targetparcel.Landing = LandingType.LandingPoint; targetparcel.UserLocation = new Vector3(X, Y, Z); targetparcel.Update(bot.GetClient.Network.CurrentSim, false); - return BasicReply("ok"); + return BasicReply("ok", "SetParcelLandingZone", new string[] { x, y, z }); } @@ -98,15 +98,15 @@ namespace BetterSecondBot.HttpService KeyValuePair tests = SetupCurrentParcel(token, "parcel", "SetParcelName"); if (tests.Key == false) { - return Failure(tests.Value); + return Failure(tests.Value, "SetParcelName", new string[] { name }); } if (helpers.notempty(name) == false) { - return Failure("Parcel name is empty"); + return Failure("Parcel name is empty", "SetParcelName", new string[] { name }); } targetparcel.Name = name; targetparcel.Update(bot.GetClient.Network.CurrentSim, false); - return BasicReply("ok"); + return BasicReply("ok", "SetParcelName", new string[] { name }); } [About("Updates the current parcels description")] @@ -120,11 +120,11 @@ namespace BetterSecondBot.HttpService KeyValuePair tests = SetupCurrentParcel(token, "parcel", "SetParcelDesc"); if (tests.Key == false) { - return Failure(tests.Value); + return Failure(tests.Value, "SetParcelDesc", new string[] { desc }); } targetparcel.Desc = desc; targetparcel.Update(bot.GetClient.Network.CurrentSim, false); - return BasicReply("ok"); + return BasicReply("ok", "SetParcelDesc", new string[] { desc }); } [About("Fetchs the current parcels desc")] @@ -137,9 +137,9 @@ namespace BetterSecondBot.HttpService KeyValuePair tests = SetupCurrentParcel(token, "parcel", "GetParcelDesc"); if (tests.Key == false) { - return Failure(tests.Value); + return Failure(tests.Value, "GetParcelDesc", new string[] { }); } - return BasicReply(targetparcel.Desc); + return BasicReply(targetparcel.Desc, "GetParcelDesc", new string[] { }); } [About("gets the flags for the parcel")] @@ -152,7 +152,7 @@ namespace BetterSecondBot.HttpService KeyValuePair tests = SetupCurrentParcel(token, "parcel", "GetParcelFlags"); if (tests.Key == false) { - return Failure(tests.Value); + return Failure(tests.Value, "GetParcelFlags", new string[] { }); } Dictionary flags = parcel_static.get_flags_list(); Dictionary collection = new Dictionary(); @@ -160,6 +160,7 @@ namespace BetterSecondBot.HttpService { collection.Add(cfg.ToString(), targetparcel.Flags.HasFlag(cfg).ToString()); } + SuccessNoReturn("GetParcelFlags", new string[] { }); return collection; } @@ -172,15 +173,15 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "parcel", "ParcelEject", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "ParcelEject", new string[] { avatar }); } ProcessAvatar(avatar); if(avataruuid == UUID.Zero) { - return Failure("Invaild avatar"); + return Failure("Invaild avatar", "ParcelEject", new string[] { avatar }); } bot.GetClient.Parcels.EjectUser(avataruuid, false); - return BasicReply("ok"); + return BasicReply("ok", "ParcelEject", new string[] { avatar }); } [About("Abandons the parcel the bot is currently on, returning it to Linden's or Estate owner")] @@ -191,10 +192,10 @@ namespace BetterSecondBot.HttpService KeyValuePair tests = SetupCurrentParcel(token, "parcel", "AbandonLand"); if (tests.Key == false) { - return Failure(tests.Value); + return Failure(tests.Value, "AbandonLand", new string[] { }); } bot.GetClient.Parcels.ReleaseParcel(bot.GetClient.Network.CurrentSim, targetparcel.LocalID); - return BasicReply("ok"); + return BasicReply("ok", "AbandonLand", new string[] { }); } @@ -211,12 +212,12 @@ namespace BetterSecondBot.HttpService KeyValuePair tests = SetupCurrentParcel(token, "parcel", "ParcelBan"); if (tests.Key == false) { - return Failure(tests.Value); + return Failure(tests.Value, "ParcelBan", new string[] { avatar }); } ProcessAvatar(avatar); if (avataruuid == UUID.Zero) { - return Failure("Invaild avatar"); + return Failure("Invaild avatar", "ParcelBan", new string[] { avatar }); } bool alreadyBanned = false; foreach (ParcelAccessEntry E in targetparcel.AccessBlackList) @@ -229,7 +230,7 @@ namespace BetterSecondBot.HttpService } if (alreadyBanned == true) { - return BasicReply("Avatar is in the blacklist"); + return BasicReply("Avatar is in the blacklist", "ParcelBan", new string[] { avatar }); } ParcelAccessEntry entry = new ParcelAccessEntry(); entry.AgentID = avataruuid; @@ -237,7 +238,7 @@ namespace BetterSecondBot.HttpService entry.Time = new System.DateTime(3030, 03, 03); targetparcel.AccessBlackList.Add(entry); targetparcel.Update(bot.GetClient.Network.CurrentSim, false); - return BasicReply("ok"); + return BasicReply("ok", "ParcelBan", new string[] { avatar }); } [About("Unbans an avatar from a parcel")] @@ -253,12 +254,12 @@ namespace BetterSecondBot.HttpService KeyValuePair tests = SetupCurrentParcel(token, "parcel", "ParcelUnBan"); if (tests.Key == false) { - return Failure(tests.Value); + return Failure(tests.Value, "ParcelUnBan", new string[] { avatar }); } ProcessAvatar(avatar); if (avataruuid == UUID.Zero) { - return Failure("Invaild avatar"); + return Failure("Invaild avatar", "ParcelUnBan", new string[] { avatar }); } bool alreadyBanned = false; ParcelAccessEntry removeentry = new ParcelAccessEntry(); @@ -273,11 +274,11 @@ namespace BetterSecondBot.HttpService } if (alreadyBanned == false) { - return BasicReply("Avatar is already unbanned"); + return BasicReply("Avatar is already unbanned", "ParcelUnBan", new string[] { avatar }); } targetparcel.AccessBlackList.Remove(removeentry); targetparcel.Update(bot.GetClient.Network.CurrentSim, false); - return BasicReply("ok"); + return BasicReply("ok", "ParcelUnBan", new string[] { avatar }); } @@ -292,10 +293,10 @@ namespace BetterSecondBot.HttpService KeyValuePair tests = SetupCurrentParcel(token, "parcel", "SetParcelMusic"); if (tests.Key == false) { - return Failure(tests.Value); + return Failure(tests.Value, "SetParcelMusic", new string[] { musicurl }); } bool status = parcel_static.set_parcel_music(bot, targetparcel, musicurl); - return BasicReply(status.ToString()); + return BasicReply(status.ToString(), "SetParcelMusic", new string[] { musicurl }); } [About("Updates the current parcels name")] @@ -314,7 +315,7 @@ namespace BetterSecondBot.HttpService KeyValuePair tests = SetupCurrentParcel(token, "parcel", "SetParcelFlag"); if (tests.Key == false) { - return Failure(tests.Value); + return Failure(tests.Value, "SetParcelFlag", new string[] { escapedflagdata }); } List acceptablewords = new List(); Dictionary flags = parcel_static.get_flags_list(); @@ -343,11 +344,11 @@ namespace BetterSecondBot.HttpService } if (setflags.Count == 0) { - return Failure("No accepted flags"); + return Failure("No accepted flags", "SetParcelFlag", new string[] { escapedflagdata }); } if (parcel_static.has_parcel_perm(targetparcel, bot) == false) { - return Failure("Incorrect perms to control parcel"); + return Failure("Incorrect perms to control parcel", "SetParcelFlag", new string[] { escapedflagdata }); } foreach (KeyValuePair cfg in setflags) { @@ -357,7 +358,7 @@ namespace BetterSecondBot.HttpService } } targetparcel.Update(bot.GetClient.Network.CurrentSim, false); - return BasicReply("Applying perms"); + return BasicReply("Applying perms", "SetParcelFlag", new string[] { escapedflagdata }); } [About("Returns all objects from the current parcel for the selected avatar")] @@ -372,15 +373,15 @@ namespace BetterSecondBot.HttpService KeyValuePair tests = SetupCurrentParcel(token, "parcel", "ParcelReturnTargeted"); if (tests.Key == false) { - return Failure(tests.Value); + return Failure(tests.Value, "ParcelReturnTargeted", new string[] { avatar }); } ProcessAvatar(avatar); if (avataruuid == UUID.Zero) { - return Failure("Invaild avatar UUID"); + return Failure("Invaild avatar UUID", "ParcelReturnTargeted", new string[] { avatar }); } bot.GetClient.Parcels.ReturnObjects(bot.GetClient.Network.CurrentSim, targetparcel.LocalID, ObjectReturnType.None, new List() { avataruuid }); - return BasicReply("ok"); + return BasicReply("ok", "ParcelReturnTargeted", new string[] { avatar }); } @@ -393,24 +394,24 @@ namespace BetterSecondBot.HttpService [Route(HttpVerbs.Get, "/ParcelDeedToGroup/{group}/{token}")] public object ParcelDeedToGroup(string group, string token) { - KeyValuePair tests = SetupCurrentParcel(token, "parcel", "ParcelReturnTargeted"); + KeyValuePair tests = SetupCurrentParcel(token, "parcel", "ParcelDeedToGroup"); if (tests.Key == false) { - return Failure(tests.Value); + return Failure(tests.Value, "ParcelDeedToGroup", new string[] { group }); } if (UUID.TryParse(group, out UUID groupuuid) == false) { - return Failure("Invaild group uuid"); + return Failure("Invaild group uuid", "ParcelDeedToGroup", new string[] { group }); } if (bot.MyGroups.ContainsKey(groupuuid) == false) { - return Failure("Not in group"); + return Failure("Not in group", "ParcelDeedToGroup", new string[] { group }); } targetparcel.GroupID = groupuuid; targetparcel.Update(bot.GetClient.Network.CurrentSim, false); Thread.Sleep(500); bot.GetClient.Parcels.DeedToGroup(bot.GetClient.Network.CurrentSim, targetparcel.LocalID, groupuuid); - return BasicReply("ok"); + return BasicReply("ok", "ParcelDeedToGroup", new string[] { group }); } [About("Attempts to buy the parcel the bot is standing on, the amount must match the sale price for the land!")] @@ -429,30 +430,30 @@ namespace BetterSecondBot.HttpService KeyValuePair tests = SetupCurrentParcel(token, "parcel", "ParcelBuy"); if (tests.Key == false) { - return Failure(tests.Value); + return Failure(tests.Value, "ParcelBuy", new string[] { amount }); } if (int.TryParse(amount, out int amountvalue) == false) { - return Failure("Invaild amount"); + return Failure("Invaild amount", "ParcelBuy", new string[] { amount }); } if (amountvalue < 1) { - return Failure("Invaild amount"); + return Failure("Invaild amount", "ParcelBuy", new string[] { amount }); }; if (targetparcel.Flags.HasFlag(ParcelFlags.ForSale) == false) { - return Failure("Parcel not for sale"); + return Failure("Parcel not for sale", "ParcelBuy", new string[] { amount }); } if ((targetparcel.AuthBuyerID != UUID.Zero) && (targetparcel.AuthBuyerID != bot.GetClient.Self.AgentID)) { - return Failure("Parcel sale locked to other avatars"); + return Failure("Parcel sale locked to other avatars", "ParcelBuy", new string[] { amount }); } if (targetparcel.SalePrice != amountvalue) { - return Failure("Parcel sale price and amount do not match"); + return Failure("Parcel sale price and amount do not match", "ParcelBuy", new string[] { amount }); } bot.GetClient.Parcels.Buy(bot.GetClient.Network.CurrentSim, targetparcel.LocalID, false, UUID.Zero, false, targetparcel.Area, amountvalue); - return BasicReply("ok"); + return BasicReply("ok", "ParcelBuy", new string[] { amount }); } [About("Freezes an avatar")] @@ -466,19 +467,19 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "parcel", "ParcelFreeze", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "ParcelFreeze", new string[] { avatar, state }); } if(bool.TryParse(state, out bool freezestate) == false) { - return Failure("Invaild state"); + return Failure("Invaild state", "ParcelFreeze", new string[] { avatar, state }); } ProcessAvatar(avatar); if (avataruuid == UUID.Zero) { - return Failure("Invaild avatar UUID"); + return Failure("Invaild avatar UUID", "ParcelFreeze", new string[] { avatar, state }); } bot.GetClient.Parcels.FreezeUser(avataruuid, freezestate); - return BasicReply("ok"); + return BasicReply("ok", "ParcelFreeze", new string[] { avatar, state }); } @@ -492,7 +493,7 @@ namespace BetterSecondBot.HttpService KeyValuePair tests = SetupCurrentParcel(token, "parcel", "GetParcelBanlist"); if (tests.Key == false) { - return Failure(tests.Value); + return Failure(tests.Value, "GetParcelBanlist", new string[] { }); } GetParcelBanlistObject reply = new GetParcelBanlistObject(); int delays = 0; @@ -525,7 +526,7 @@ namespace BetterSecondBot.HttpService reply.delay = delays * 1000; reply.parcelName = targetparcel.Name; reply.regionName = bot.GetClient.Network.CurrentSim.Name; - return BasicReply(JsonConvert.SerializeObject(reply)); + return BasicReply(JsonConvert.SerializeObject(reply), "GetParcelBanlist", new string[] { }); } [About("Returns a rezzed object")] @@ -538,11 +539,11 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "parcel", "UnRezObject", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "UnRezObject", new string[] { objectuuid }); } if (UUID.TryParse(objectuuid, out UUID targetobject) == false) { - return Failure("Invaild object uuid"); + return Failure("Invaild object uuid", "UnRezObject", new string[] { objectuuid }); } bool found = false; Dictionary objects_copy = bot.GetClient.Network.CurrentSim.ObjectsPrimitives.Copy(); @@ -557,9 +558,9 @@ namespace BetterSecondBot.HttpService } if(found == false) { - return Failure("Unable to find object"); + return Failure("Unable to find object", "UnRezObject", new string[] { objectuuid }); } - return BasicReply("ok"); + return BasicReply("ok", "UnRezObject", new string[] { objectuuid }); } [About("Updates the current parcels media settings \n" + @@ -582,7 +583,7 @@ namespace BetterSecondBot.HttpService KeyValuePair tests = SetupCurrentParcel(token, "parcel", "ParcelSetMedia"); if (tests.Key == false) { - return Failure(tests.Value); + return Failure(tests.Value, "ParcelSetMedia", new string[] { escapedflagdata }); } string[] args = escapedflagdata.Split(":::"); foreach (string A in args) @@ -643,7 +644,7 @@ namespace BetterSecondBot.HttpService } } targetparcel.Update(bot.GetClient.Network.CurrentSim, false); - return BasicReply("ok"); + return BasicReply("ok", "ParcelSetMedia", new string[] { escapedflagdata }); } protected bool UpdateParcel_MediaType(Parcel targetparcel, string value) diff --git a/Core/Commands/Self.cs b/Core/Commands/Self.cs index 6aa4ba3..7809591 100644 --- a/Core/Commands/Self.cs +++ b/Core/Commands/Self.cs @@ -25,12 +25,12 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "self", "PointAt", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "PointAt", new string[] { avatar }); } ProcessAvatar(avatar); if (bot.GetClient.Network.CurrentSim.AvatarPositions.ContainsKey(avataruuid) == false) { - return Failure("Cant find UUID in sim"); + return Failure("Cant find UUID in sim", "PointAt", new string[] { avatar }); } bot.ResetAnimations(); bot.GetClient.Self.Stand(); @@ -39,7 +39,7 @@ namespace BetterSecondBot.HttpService bot.GetClient.Self.AnimationStart(Animations.POINT_YOU, true); bot.GetClient.Self.PointAtEffect(bot.GetClient.Self.AgentID, avataruuid, new Vector3d(0, 0, 0), PointAtType.Select, UUID.Random()); bot.GetClient.Self.BeamEffect(bot.GetClient.Self.AgentID, avataruuid, new Vector3d(0, 0, 2), new Color4(255, 255, 255, 1), (float)3.0, UUID.Random()); - return BasicReply("ok"); + return BasicReply("ok", "PointAt", new string[] { avatar }); } [About("Makes the bot sit on the ground or on a object if it can see it")] @@ -51,33 +51,33 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "self", "Sit", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "Sit", new string[] { target }); } if(target == "ground") { bot.GetClient.Self.SitOnGround(); - return BasicReply("ok"); + return BasicReply("ok", "Sit", new string[] { target }); } if(UUID.TryParse(target,out UUID objectuuid) == false) { - return Failure("Invaild object UUID"); + return Failure("Invaild object UUID", "Sit", new string[] { target }); } bot.GetClient.Self.RequestSit(objectuuid, Vector3.Zero); - return BasicReply("ok"); + return BasicReply("ok", "Sit", new string[] { target }); } [About("Makes the bot stand up if sitting (also resets animations)")] [ReturnHints("ok")] [Route(HttpVerbs.Get, "/Stand/{token}")] - public object Stand(string target, string token) + public object Stand(string token) { if (tokens.Allow(token, "self", "Stand", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "Stand", new string[] { }); } bot.GetClient.Self.Stand(); bot.ResetAnimations(); - return BasicReply("ok"); + return BasicReply("ok", "Stand", new string[] { }); } [About("Makes the bot sit on the ground or on a object if it can see it")] @@ -90,11 +90,11 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "self", "ClickObject", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "ClickObject", new string[] { target }); } if (UUID.TryParse(target, out UUID objectuuid) == false) { - return Failure("Invaild object UUID"); + return Failure("Invaild object UUID", "ClickObject", new string[] { target }); } Dictionary objectsentrys = bot.GetClient.Network.CurrentSim.ObjectsPrimitives.Copy(); bool found_object = false; @@ -107,7 +107,7 @@ namespace BetterSecondBot.HttpService break; } } - return BasicReply(found_object.ToString()); + return BasicReply(found_object.ToString(), "ClickObject", new string[] { target }); } [About("Makes the bot kill itself you monster")] @@ -117,14 +117,14 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "self", "Logoff", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "Logoff", new string[] { }); } if (bot.KillMe == false) { bot.GetClient.Self.Chat("Laters im out", 0, ChatType.Normal); bot.KillMePlease(); } - return BasicReply("ok"); + return BasicReply("ok", "Logoff", new string[] { }); } [About("Makes the bot kill itself you monster")] @@ -134,14 +134,14 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "self", "Logout", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "Logout", new string[] { }); } if (bot.KillMe == false) { bot.GetClient.Self.Chat("Laters im out", 0, ChatType.Normal); bot.KillMePlease(); } - return BasicReply("ok"); + return BasicReply("ok", "Logout", new string[] { }); } [About("Makes the bot kill itself you monster - without making a sound")] @@ -151,13 +151,13 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "self", "Bye", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "Bye", new string[] { }); } if (bot.KillMe == false) { bot.KillMePlease(); } - return BasicReply("ok"); + return BasicReply("ok", "Bye", new string[] { }); } [About("Gets the last 5 commands issued to the bot")] @@ -167,8 +167,9 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "self", "GetLastCommands", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "GetLastCommands", new string[] { }); } + SuccessNoReturn("GetLastCommands", new string[] { }); return bot.GetLastCommands(5); } @@ -186,35 +187,35 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "self", "SetPermFlag", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "SetPermFlag", new string[] { avatar, flag, state, sticky }); } ProcessAvatar(avatar); if (avataruuid == UUID.Zero) { - return Failure("avatar lookup"); + return Failure("avatar lookup", "SetPermFlag", new string[] { avatar, flag, state, sticky }); } bool stateflag = false; bool stickyflag = false; if(bool.TryParse(state,out stateflag) == false) { - return Failure("Invaild state"); + return Failure("Invaild state", "SetPermFlag", new string[] { avatar, flag, state, sticky }); } if (bool.TryParse(sticky, out stickyflag) == false) { - return Failure("Invaild sticky"); + return Failure("Invaild sticky", "SetPermFlag", new string[] { avatar, flag, state, sticky }); } string[] AcceptedFlags = new string[] { "friend", "group", "animation", "teleport", "command" }; if (AcceptedFlags.Contains(flag) == true) { - return Failure("Invaild flag"); + return Failure("Invaild flag", "SetPermFlag", new string[] { avatar, flag, state, sticky }); } if (stateflag == true) { bot.Add_action_from(flag, avataruuid, stickyflag); - return BasicReply("Added perm: " + flag + " Sticky: " + stickyflag.ToString()); + return BasicReply("Added perm: " + flag + " Sticky: " + stickyflag.ToString(), "SetPermFlag", new string[] { avatar, flag, state, sticky }); } bot.Remove_action_from(flag, avataruuid, stickyflag); - return BasicReply("Removed perm: " + flag + " Sticky: " + stickyflag.ToString()); + return BasicReply("Removed perm: " + flag + " Sticky: " + stickyflag.ToString(), "SetPermFlag", new string[] { avatar, flag, state, sticky }); } diff --git a/Core/Commands/StreamAdmin.cs b/Core/Commands/StreamAdmin.cs index 4eab0a1..2a0f75c 100644 --- a/Core/Commands/StreamAdmin.cs +++ b/Core/Commands/StreamAdmin.cs @@ -33,15 +33,15 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "streamadmin", "FetchNextNotecard", handleGetClientIP()) == false) { - return Failure("Token not accepted"); + return Failure("Token not accepted", "FetchNextNotecard", new string[] { endpoint, endpointcode }); } if(helpers.notempty(endpoint) == false) { - return Failure("Endpoint is empty"); + return Failure("Endpoint is empty", "FetchNextNotecard", new string[] { endpoint, endpointcode }); } if (helpers.notempty(endpointcode) == false) { - return Failure("Endpointcode is empty"); + return Failure("Endpointcode is empty", "FetchNextNotecard", new string[] { endpoint, endpointcode }); } string attempt_endpoint = endpoint + "endpoint.php"; @@ -53,24 +53,24 @@ namespace BetterSecondBot.HttpService IRestResponse endpoint_checks = client.Post(request); if (endpoint_checks.StatusCode != System.Net.HttpStatusCode.OK) { - return Failure("HTTP status code: " + endpoint_checks.StatusCode.ToString()); + return Failure("HTTP status code: " + endpoint_checks.StatusCode.ToString(), "FetchNextNotecard", new string[] { endpoint, endpointcode }); } try { notecardendpoint server_reply = JsonConvert.DeserializeObject(endpoint_checks.Content); if (server_reply.status == false) { - return Failure("Bad reply: " + server_reply.message); + return Failure("Bad reply: " + server_reply.message, "FetchNextNotecard", new string[] { endpoint, endpointcode }); } if (server_reply.NotecardTitle.Length < 3) { - return Failure("Notecard title is to short"); + return Failure("Notecard title is to short", "FetchNextNotecard", new string[] { endpoint, endpointcode }); } - return BasicReply(bot.SendNotecard(server_reply.NotecardTitle, server_reply.NotecardContent, (UUID)server_reply.AvatarUUID).ToString()); + return BasicReply(bot.SendNotecard(server_reply.NotecardTitle, server_reply.NotecardContent, (UUID)server_reply.AvatarUUID).ToString(), "FetchNextNotecard", new string[] { endpoint, endpointcode }); } catch (Exception e) { - return Failure("Error: " + e.Message + ""); + return Failure("Error: " + e.Message + "", "FetchNextNotecard", new string[] { endpoint, endpointcode }); } } diff --git a/Core/HttpService/HttpAsService.cs b/Core/HttpService/HttpAsService.cs index 0af155a..7002fb9 100644 --- a/Core/HttpService/HttpAsService.cs +++ b/Core/HttpService/HttpAsService.cs @@ -460,13 +460,20 @@ namespace BetterSecondBot.HttpService UUID.TryParse(avatar, out avataruuid); } - protected Object BasicReply(string input) + protected void SuccessNoReturn(string command, string[] args) { + bot.CommandHistoryAdd(command, String.Join("~#~", args), true, ""); + } + + protected Object BasicReply(string input,string command, string[] args) + { + bot.CommandHistoryAdd(command, String.Join("~#~", args), true, ""); return new { reply = input, status=true }; } - protected Object Failure(string input) + protected Object Failure(string input, string command, string[] args) { + bot.CommandHistoryAdd(command, String.Join("~#~",args), false, ""); return new { reply = input, status = false }; } diff --git a/Shared/BotTypes/BasicBot.cs b/Shared/BotTypes/BasicBot.cs index 7e9912a..d9b1309 100644 --- a/Shared/BotTypes/BasicBot.cs +++ b/Shared/BotTypes/BasicBot.cs @@ -67,6 +67,11 @@ namespace BetterSecondBotShared.bottypes teleported = true; } + public bool TeleportStatus() + { + return teleported; + } + protected Dictionary custom_commands = new Dictionary(); public Dictionary getCustomCommands { get { return custom_commands; } }