readds commands log and master teleport lockout
This commit is contained in:
parent
407062baa5
commit
30cd3a4116
22 changed files with 487 additions and 465 deletions
|
|
@ -323,6 +323,11 @@ namespace BetterSecondbot.BetterAtHome
|
||||||
SetBetterAtHomeAction("No home regions");
|
SetBetterAtHomeAction("No home regions");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if(controler.Bot.TeleportStatus() == true)
|
||||||
|
{
|
||||||
|
SetBetterAtHomeAction("Teleported");
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (IsAtHome() == true)
|
if (IsAtHome() == true)
|
||||||
{
|
{
|
||||||
SetBetterAtHomeAction("AtHome");
|
SetBetterAtHomeAction("AtHome");
|
||||||
|
|
|
||||||
|
|
@ -26,20 +26,20 @@ namespace BetterSecondBot.HttpService
|
||||||
{
|
{
|
||||||
if (tokens.Allow(token, "animation", "addtoallowanimations", handleGetClientIP()) == false)
|
if (tokens.Allow(token, "animation", "addtoallowanimations", handleGetClientIP()) == false)
|
||||||
{
|
{
|
||||||
return BasicReply("Token not accepted");
|
return BasicReply("Token not accepted", "addtoallowanimations", new string[] { avatar });
|
||||||
}
|
}
|
||||||
ProcessAvatar(avatar);
|
ProcessAvatar(avatar);
|
||||||
if (avataruuid == UUID.Zero)
|
if (avataruuid == UUID.Zero)
|
||||||
{
|
{
|
||||||
return BasicReply("avatar lookup");
|
return BasicReply("avatar lookup", "addtoallowanimations", new string[] { avatar });
|
||||||
}
|
}
|
||||||
if (bot.Accept_action_from("animation", avataruuid) == false)
|
if (bot.Accept_action_from("animation", avataruuid) == false)
|
||||||
{
|
{
|
||||||
bot.Add_action_from("animation", avataruuid);
|
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);
|
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")]
|
[About("Attempts to play a gesture")]
|
||||||
|
|
@ -51,15 +51,15 @@ namespace BetterSecondBot.HttpService
|
||||||
{
|
{
|
||||||
if (tokens.Allow(token, "animation", "gesture", handleGetClientIP()) == false)
|
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)
|
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));
|
InventoryItem itm = bot.GetClient.Inventory.FetchItem(gestureUUID, bot.GetClient.Self.AgentID, (3 * 1000));
|
||||||
bot.GetClient.Self.PlayGesture(itm.AssetUUID);
|
bot.GetClient.Self.PlayGesture(itm.AssetUUID);
|
||||||
return BasicReply("Accepted");
|
return BasicReply("Accepted", "gesture", new string[] { gesture });
|
||||||
}
|
}
|
||||||
|
|
||||||
[About("Resets the animation stack for the bot")]
|
[About("Resets the animation stack for the bot")]
|
||||||
|
|
@ -69,10 +69,10 @@ namespace BetterSecondBot.HttpService
|
||||||
{
|
{
|
||||||
if (tokens.Allow(token, "animation", "resetanimations", handleGetClientIP()) == false)
|
if (tokens.Allow(token, "animation", "resetanimations", handleGetClientIP()) == false)
|
||||||
{
|
{
|
||||||
return BasicReply("Token not accepted");
|
return BasicReply("Token not accepted", "resetanimations", new string[] { });
|
||||||
}
|
}
|
||||||
bot.ResetAnimations();
|
bot.ResetAnimations();
|
||||||
return BasicReply("Accepted");
|
return BasicReply("Accepted", "resetanimations", new string[] { });
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,11 +24,11 @@ namespace BetterSecondBot.HttpService
|
||||||
{
|
{
|
||||||
if (tokens.Allow(token, "avatars", "nearmewithdetails", handleGetClientIP()) == false)
|
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)
|
if (bot.GetClient.Network.CurrentSim == null)
|
||||||
{
|
{
|
||||||
return BasicReply("Error not in a sim");
|
return BasicReply("Error not in a sim", "nearmewithdetails", new string[] { });
|
||||||
}
|
}
|
||||||
List<NearMeDetails> BetterNearMe = new List<NearMeDetails>();
|
List<NearMeDetails> BetterNearMe = new List<NearMeDetails>();
|
||||||
Dictionary<uint, Avatar> avcopy = bot.GetClient.Network.CurrentSim.ObjectsAvatars.Copy();
|
Dictionary<uint, Avatar> avcopy = bot.GetClient.Network.CurrentSim.ObjectsAvatars.Copy();
|
||||||
|
|
@ -46,7 +46,7 @@ namespace BetterSecondBot.HttpService
|
||||||
BetterNearMe.Add(details);
|
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")]
|
[About("returns a list of all known avatars nearby")]
|
||||||
|
|
@ -57,11 +57,11 @@ namespace BetterSecondBot.HttpService
|
||||||
{
|
{
|
||||||
if (tokens.Allow(token, "avatars", "nearme", handleGetClientIP()) == false)
|
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)
|
if (bot.GetClient.Network.CurrentSim == null)
|
||||||
{
|
{
|
||||||
return BasicReply("Error not in a sim");
|
return BasicReply("Error not in a sim", "nearme", new string[] { });
|
||||||
}
|
}
|
||||||
Dictionary<UUID, string> NearMe = new Dictionary<UUID, string>();
|
Dictionary<UUID, string> NearMe = new Dictionary<UUID, string>();
|
||||||
Dictionary<uint, Avatar> avcopy = bot.GetClient.Network.CurrentSim.ObjectsAvatars.Copy();
|
Dictionary<uint, Avatar> avcopy = bot.GetClient.Network.CurrentSim.ObjectsAvatars.Copy();
|
||||||
|
|
@ -72,10 +72,7 @@ namespace BetterSecondBot.HttpService
|
||||||
NearMe.Add(av.ID, av.Name);
|
NearMe.Add(av.ID, av.Name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return BasicReply(JsonConvert.SerializeObject(NearMe));
|
return BasicReply(JsonConvert.SerializeObject(NearMe), "nearme", new string[] { });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,9 +23,9 @@ namespace BetterSecondBot.HttpService
|
||||||
{
|
{
|
||||||
if (tokens.Allow(token, "chat", "LocalChatHistory", handleGetClientIP()) == false)
|
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")]
|
[About("sends a message to localchat")]
|
||||||
|
|
@ -39,22 +39,22 @@ namespace BetterSecondBot.HttpService
|
||||||
{
|
{
|
||||||
if (tokens.Allow(token, "chat", "Say", handleGetClientIP()) == false)
|
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)
|
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)
|
if(int.TryParse(channel,out int channelnum) == false)
|
||||||
{
|
{
|
||||||
return Failure("Invaild channel");
|
return Failure("Invaild channel", "Say", new string[] { channel, message });
|
||||||
}
|
}
|
||||||
if(channelnum < 0)
|
if(channelnum < 0)
|
||||||
{
|
{
|
||||||
return Failure("Invaild channel");
|
return Failure("Invaild channel", "Say", new string[] { channel, message });
|
||||||
}
|
}
|
||||||
bot.GetClient.Self.Chat(message, channelnum, ChatType.Normal);
|
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)
|
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);
|
ProcessAvatar(avatar);
|
||||||
if(avataruuid == UUID.Zero)
|
if(avataruuid == UUID.Zero)
|
||||||
{
|
{
|
||||||
return Failure("avatar lookup");
|
return Failure("avatar lookup", "IM", new string[] { avatar, message });
|
||||||
}
|
}
|
||||||
if (helpers.isempty(message) == true)
|
if (helpers.isempty(message) == true)
|
||||||
{
|
{
|
||||||
return Failure("Message empty");
|
return Failure("Message empty", "IM", new string[] { avatar, message });
|
||||||
}
|
}
|
||||||
bot.SendIM(avataruuid, message);
|
bot.SendIM(avataruuid, message);
|
||||||
return BasicReply("ok");
|
return BasicReply("ok", "IM", new string[] { avatar, message });
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,10 +39,10 @@ namespace BetterSecondBot.HttpService
|
||||||
if (hash == authcode)
|
if (hash == authcode)
|
||||||
{
|
{
|
||||||
string newtoken = tokens.CreateToken(handleGetClientIP());
|
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")]
|
[About("Used to check HTTP connections")]
|
||||||
|
|
@ -51,7 +51,7 @@ namespace BetterSecondBot.HttpService
|
||||||
[Route(HttpVerbs.Get, "/Hello")]
|
[Route(HttpVerbs.Get, "/Hello")]
|
||||||
public object Hello()
|
public object Hello()
|
||||||
{
|
{
|
||||||
return BasicReply("world");
|
return BasicReply("world", "Hello", new string[] { });
|
||||||
}
|
}
|
||||||
|
|
||||||
[About("Delays a thead by X ms<br/>Mostly pointless but good if your doing custom commands")]
|
[About("Delays a thead by X ms<br/>Mostly pointless but good if your doing custom commands")]
|
||||||
|
|
@ -62,14 +62,14 @@ namespace BetterSecondBot.HttpService
|
||||||
{
|
{
|
||||||
if (tokens.Allow(token, "core", "Delay", handleGetClientIP()) == false)
|
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)
|
if(int.TryParse(amount,out int amountvalue) == false)
|
||||||
{
|
{
|
||||||
return Failure("Invaild amount");
|
return Failure("Invaild amount", "Delay", new string[] { amount });
|
||||||
}
|
}
|
||||||
Thread.Sleep(amountvalue);
|
Thread.Sleep(amountvalue);
|
||||||
return BasicReply("Ok");
|
return BasicReply("Ok", "Delay", new string[] { amount });
|
||||||
}
|
}
|
||||||
|
|
||||||
[About("Removes the given token from the accepted token pool")]
|
[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)
|
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);
|
return tokens.Expire(token);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,32 +28,32 @@ namespace BetterSecondBot.HttpService
|
||||||
{
|
{
|
||||||
if (tokens.Allow(token, "dialogs", "DialogRelay", handleGetClientIP()) == false)
|
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")
|
if (target == "clear")
|
||||||
{
|
{
|
||||||
bot.SetRelayDialogsAvatar(UUID.Zero);
|
bot.SetRelayDialogsAvatar(UUID.Zero);
|
||||||
bot.SetRelayDialogsChannel(0);
|
bot.SetRelayDialogsChannel(0);
|
||||||
bot.SetRelayDialogsHTTP("");
|
bot.SetRelayDialogsHTTP("");
|
||||||
return BasicReply("cleared");
|
return BasicReply("cleared", "DialogRelay", new string[] { target });
|
||||||
}
|
}
|
||||||
ProcessAvatar(target);
|
ProcessAvatar(target);
|
||||||
if (avataruuid != UUID.Zero)
|
if (avataruuid != UUID.Zero)
|
||||||
{
|
{
|
||||||
bot.SetRelayDialogsAvatar(avataruuid);
|
bot.SetRelayDialogsAvatar(avataruuid);
|
||||||
return BasicReply("set/avatar");
|
return BasicReply("set/avatar", "DialogRelay", new string[] { target });
|
||||||
}
|
}
|
||||||
if (target.StartsWith("http") == true)
|
if (target.StartsWith("http") == true)
|
||||||
{
|
{
|
||||||
bot.SetRelayDialogsHTTP(target);
|
bot.SetRelayDialogsHTTP(target);
|
||||||
return BasicReply("set/http");
|
return BasicReply("set/http", "DialogRelay", new string[] { target });
|
||||||
}
|
}
|
||||||
if (int.TryParse(target, out int channel) == true)
|
if (int.TryParse(target, out int channel) == true)
|
||||||
{
|
{
|
||||||
bot.SetRelayDialogsChannel(channel);
|
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)
|
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)
|
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?")]
|
[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)
|
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)
|
if (bool.TryParse(status, out bool statuscode) == false)
|
||||||
{
|
{
|
||||||
return BasicReply("bad status");
|
return Failure("bad status", "DialogTrack", new string[] { status });
|
||||||
}
|
}
|
||||||
bot.SetTrackDialogs(statuscode);
|
bot.SetTrackDialogs(statuscode);
|
||||||
return BasicReply("updated");
|
return BasicReply("updated", "DialogTrack", new string[] { status });
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,13 +32,13 @@ namespace BetterSecondBot.HttpService
|
||||||
{
|
{
|
||||||
if (tokens.Allow(token, "discord", "Discord_AddRole", handleGetClientIP()) == false)
|
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)
|
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")]
|
[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)
|
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)
|
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)
|
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")]
|
[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)
|
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)
|
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;
|
return ClearMessages(serverid, memberid).Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -96,13 +97,13 @@ namespace BetterSecondBot.HttpService
|
||||||
{
|
{
|
||||||
if (tokens.Allow(token, "discord", "Discord_Dm_Member", handleGetClientIP()) == false)
|
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)
|
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" +
|
[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)
|
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)
|
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;
|
return ListMembers(serverid).Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -137,17 +139,17 @@ namespace BetterSecondBot.HttpService
|
||||||
{
|
{
|
||||||
if (tokens.Allow(token, "discord", "Discord_MessageChannel", handleGetClientIP()) == false)
|
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)
|
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)
|
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")]
|
[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)
|
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)
|
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")]
|
[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)
|
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)
|
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);
|
return RoleSettings(serverid,roleid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -202,13 +205,13 @@ namespace BetterSecondBot.HttpService
|
||||||
{
|
{
|
||||||
if (tokens.Allow(token, "discord", "Discord_Role_UpdatePerms", handleGetClientIP()) == false)
|
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)
|
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" +
|
[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)
|
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)
|
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;
|
return CreateRole(serverid,role).Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -240,13 +244,13 @@ namespace BetterSecondBot.HttpService
|
||||||
{
|
{
|
||||||
if (tokens.Allow(token, "discord", "Discord_RoleList", handleGetClientIP()) == false)
|
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)
|
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")]
|
[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)
|
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)
|
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")]
|
[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)
|
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)
|
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);
|
return ListTextChannels(serverid);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,10 +16,7 @@ namespace BetterSecondBot.HttpService
|
||||||
|
|
||||||
public class HTTP_Estate : WebApiControllerWithTokens
|
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")]
|
[About("Sends the message to the current sim")]
|
||||||
[ReturnHints("Not an estate manager here")]
|
[ReturnHints("Not an estate manager here")]
|
||||||
|
|
@ -31,19 +28,19 @@ namespace BetterSecondBot.HttpService
|
||||||
[Route(HttpVerbs.Get, "/SimRestart/{delay}/{mode}/{token}")]
|
[Route(HttpVerbs.Get, "/SimRestart/{delay}/{mode}/{token}")]
|
||||||
public object SimRestart(string delay, string mode, string 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)
|
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);
|
bool.TryParse(mode, out bool modeflag);
|
||||||
if (modeflag == false)
|
if (modeflag == false)
|
||||||
{
|
{
|
||||||
bot.GetClient.Estate.CancelRestart();
|
bot.GetClient.Estate.CancelRestart();
|
||||||
return BasicReply("canceled");
|
return BasicReply("canceled", "SimRestart", new string[] { delay, mode });
|
||||||
}
|
}
|
||||||
int delay_restart = 60;
|
int delay_restart = 60;
|
||||||
int.TryParse(delay, out delay_restart);
|
int.TryParse(delay, out delay_restart);
|
||||||
|
|
@ -52,7 +49,7 @@ namespace BetterSecondBot.HttpService
|
||||||
delay_restart = 240;
|
delay_restart = 240;
|
||||||
}
|
}
|
||||||
bot.GetClient.Estate.RestartRegion(delay_restart);
|
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")]
|
[About("Sends the message to the current sim")]
|
||||||
|
|
@ -65,18 +62,18 @@ namespace BetterSecondBot.HttpService
|
||||||
{
|
{
|
||||||
if (tokens.Allow(token, "estate", "SimMessage", handleGetClientIP()) == false)
|
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)
|
if (helpers.notempty(message) == false)
|
||||||
{
|
{
|
||||||
return Failure("Message empty");
|
return Failure("Message empty", "SimMessage", new string[] { message });
|
||||||
}
|
}
|
||||||
if (bot.GetClient.Network.CurrentSim.IsEstateManager == false)
|
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);
|
bot.GetClient.Estate.SimulatorMessage(message);
|
||||||
return BasicReply("ok");
|
return BasicReply("ok", "SimMessage", new string[] { message });
|
||||||
}
|
}
|
||||||
|
|
||||||
[About("Fetchs the regions map tile")]
|
[About("Fetchs the regions map tile")]
|
||||||
|
|
@ -88,13 +85,13 @@ namespace BetterSecondBot.HttpService
|
||||||
{
|
{
|
||||||
if (tokens.Allow(token, "estate", "GetSimTexture", handleGetClientIP()) == false)
|
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)
|
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")]
|
[About("Reclaims ownership of the current parcel")]
|
||||||
|
|
@ -105,15 +102,15 @@ namespace BetterSecondBot.HttpService
|
||||||
{
|
{
|
||||||
if (tokens.Allow(token, "estate", "EstateParcelReclaim", handleGetClientIP()) == false)
|
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)
|
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);
|
int localid = bot.GetClient.Parcels.GetParcelLocalID(bot.GetClient.Network.CurrentSim, bot.GetClient.Self.SimPosition);
|
||||||
bot.GetClient.Parcels.Reclaim(bot.GetClient.Network.CurrentSim, localid);
|
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")]
|
[About("Reclaims ownership of the current parcel")]
|
||||||
|
|
@ -124,16 +121,17 @@ namespace BetterSecondBot.HttpService
|
||||||
{
|
{
|
||||||
if (tokens.Allow(token, "estate", "GetSimGlobalPos", handleGetClientIP()) == false)
|
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)
|
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<string, string> reply = new Dictionary<string, string>();
|
Dictionary<string, string> reply = new Dictionary<string, string>();
|
||||||
reply.Add("region", regionname);
|
reply.Add("region", regionname);
|
||||||
reply.Add("X", region.X.ToString());
|
reply.Add("X", region.X.ToString());
|
||||||
reply.Add("Y", region.Y.ToString());
|
reply.Add("Y", region.Y.ToString());
|
||||||
|
SuccessNoReturn("GetSimGlobalPos", new string[] { regionname });
|
||||||
return reply;
|
return reply;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -144,9 +142,9 @@ namespace BetterSecondBot.HttpService
|
||||||
{
|
{
|
||||||
if (tokens.Allow(token, "estate", "banlist", handleGetClientIP()) == false)
|
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")]
|
[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)
|
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)
|
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;
|
UUID avataruuid = UUID.Zero;
|
||||||
if (UUID.TryParse(avatar, out avataruuid) == false)
|
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;
|
bool globalban = false;
|
||||||
if (bool.TryParse(global, out 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")
|
if (mode != "add")
|
||||||
{
|
{
|
||||||
bot.GetClient.Estate.UnbanUser(avataruuid, globalban);
|
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);
|
bot.GetClient.Estate.BanUser(avataruuid, globalban);
|
||||||
return BasicReply("Ban request accepted");
|
return BasicReply("Ban request accepted", "UpdateEstateBanlist", new string[] { avatar, mode, global });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,9 +23,9 @@ namespace BetterSecondBot.HttpService
|
||||||
{
|
{
|
||||||
if (tokens.Allow(token, "friends", "Friendslist", handleGetClientIP()) == false)
|
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")]
|
[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)
|
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);
|
ProcessAvatar(avatar);
|
||||||
if (avataruuid == UUID.Zero)
|
if (avataruuid == UUID.Zero)
|
||||||
{
|
{
|
||||||
return Failure("avatar lookup");
|
return Failure("avatar lookup", "FriendFullPerms", new string[] { avatar, state });
|
||||||
}
|
}
|
||||||
bool status = false;
|
bool status = false;
|
||||||
if (bool.TryParse(state, out 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)
|
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)
|
if (status == true)
|
||||||
{
|
{
|
||||||
bot.GetClient.Friends.GrantRights(avataruuid, FriendRights.CanSeeOnline | FriendRights.CanSeeOnMap | FriendRights.CanModifyObjects);
|
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);
|
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")]
|
[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)
|
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);
|
ProcessAvatar(avatar);
|
||||||
if (avataruuid == UUID.Zero)
|
if (avataruuid == UUID.Zero)
|
||||||
{
|
{
|
||||||
return Failure("avatar lookup");
|
return Failure("avatar lookup", "FriendRequest", new string[] { avatar, state });
|
||||||
}
|
}
|
||||||
bool status = false;
|
bool status = false;
|
||||||
if (bool.TryParse(state, out 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 (bot.GetClient.Friends.FriendList.ContainsKey(avataruuid) == true)
|
||||||
{
|
{
|
||||||
if (status == false)
|
if (status == false)
|
||||||
{
|
{
|
||||||
bot.GetClient.Friends.TerminateFriendship(avataruuid);
|
bot.GetClient.Friends.TerminateFriendship(avataruuid);
|
||||||
return BasicReply("Removed");
|
return BasicReply("Removed", "FriendRequest", new string[] { avatar, state });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (status == false)
|
if (status == false)
|
||||||
{
|
{
|
||||||
return Failure("Not in friendslist");
|
return Failure("Not in friendslist", "FriendRequest", new string[] { avatar, state });
|
||||||
}
|
}
|
||||||
bot.GetClient.Friends.OfferFriendship(avataruuid);
|
bot.GetClient.Friends.OfferFriendship(avataruuid);
|
||||||
return BasicReply("Request sent");
|
return BasicReply("Request sent", "FriendRequest", new string[] { avatar, state });
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,14 +24,14 @@ namespace BetterSecondBot.HttpService
|
||||||
{
|
{
|
||||||
if (tokens.Allow(token, "funds", "Balance", handleGetClientIP()) == false)
|
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)
|
if (bot.GetAllowFunds == false)
|
||||||
{
|
{
|
||||||
return Failure("Funds commands are disabled");
|
return Failure("Funds commands are disabled", "Balance", new string[] { });
|
||||||
}
|
}
|
||||||
bot.GetClient.Self.RequestBalance();
|
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")]
|
[About("Makes the bot pay a avatar")]
|
||||||
|
|
@ -47,27 +47,27 @@ namespace BetterSecondBot.HttpService
|
||||||
{
|
{
|
||||||
if (tokens.Allow(token, "funds", "PayAvatar", handleGetClientIP()) == false)
|
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)
|
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);
|
ProcessAvatar(avatar);
|
||||||
if (avataruuid == UUID.Zero)
|
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)
|
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))
|
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);
|
bot.GetClient.Self.GiveAvatarMoney(avataruuid, amountvalue);
|
||||||
return BasicReply("Accepted");
|
return BasicReply("Accepted", "PayAvatar", new string[] { avatar, amount });
|
||||||
}
|
}
|
||||||
|
|
||||||
[About("Makes the bot pay a object")]
|
[About("Makes the bot pay a object")]
|
||||||
|
|
@ -86,30 +86,30 @@ namespace BetterSecondBot.HttpService
|
||||||
{
|
{
|
||||||
if (tokens.Allow(token, "funds", "PayObject", handleGetClientIP()) == false)
|
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)
|
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)
|
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)
|
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))
|
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)
|
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);
|
bot.GetClient.Self.GiveObjectMoney(objectUUID, amountvalue, primname);
|
||||||
return BasicReply("ok");
|
return BasicReply("ok", "PayObject", new string[] { objectuuid, primname, amount });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,15 +31,15 @@ namespace BetterSecondBot.HttpService
|
||||||
{
|
{
|
||||||
if (tokens.Allow(token, "groups", "IsGroupMember", handleGetClientIP()) == false)
|
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)
|
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)
|
if (bot.MyGroups.ContainsKey(groupuuid) == false)
|
||||||
{
|
{
|
||||||
return Failure("Unknown group");
|
return Failure("Unknown group", "IsGroupMember", new string[] { group, avatar });
|
||||||
}
|
}
|
||||||
if (bot.NeedReloadGroupData(groupuuid) == true)
|
if (bot.NeedReloadGroupData(groupuuid) == true)
|
||||||
{
|
{
|
||||||
|
|
@ -49,14 +49,14 @@ namespace BetterSecondBot.HttpService
|
||||||
KeyValuePair<bool, string> reply = waitForReady(true, true, groupuuid);
|
KeyValuePair<bool, string> reply = waitForReady(true, true, groupuuid);
|
||||||
if (reply.Key == false)
|
if (reply.Key == false)
|
||||||
{
|
{
|
||||||
return Failure(reply.Value);
|
return Failure(reply.Value, "IsGroupMember", new string[] { group, avatar });
|
||||||
}
|
}
|
||||||
IsGroupMemberReply replyobject = new IsGroupMemberReply();
|
IsGroupMemberReply replyobject = new IsGroupMemberReply();
|
||||||
replyobject.membershipStatus = bot.FastCheckInGroup(groupuuid, avataruuid);
|
replyobject.membershipStatus = bot.FastCheckInGroup(groupuuid, avataruuid);
|
||||||
replyobject.AvatarUUID = avataruuid.ToString();
|
replyobject.AvatarUUID = avataruuid.ToString();
|
||||||
replyobject.AvatarnameIfKnown = bot.FindAvatarKey2Name(avataruuid);
|
replyobject.AvatarnameIfKnown = bot.FindAvatarKey2Name(avataruuid);
|
||||||
replyobject.GroupUUID = groupuuid.ToString();
|
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")]
|
[About("Gets membership of a group")]
|
||||||
|
|
@ -71,15 +71,15 @@ namespace BetterSecondBot.HttpService
|
||||||
{
|
{
|
||||||
if (tokens.Allow(token, "groups", "GetGroupMembers", handleGetClientIP()) == false)
|
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)
|
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)
|
if (bot.MyGroups.ContainsKey(groupuuid) == false)
|
||||||
{
|
{
|
||||||
return Failure("Unknown group");
|
return Failure("Unknown group", "GetGroupMembers", new string[] { group });
|
||||||
}
|
}
|
||||||
if (bot.NeedReloadGroupData(groupuuid) == true)
|
if (bot.NeedReloadGroupData(groupuuid) == true)
|
||||||
{
|
{
|
||||||
|
|
@ -88,8 +88,9 @@ namespace BetterSecondBot.HttpService
|
||||||
KeyValuePair<bool, string> reply = waitForReady(false, true, groupuuid);
|
KeyValuePair<bool, string> reply = waitForReady(false, true, groupuuid);
|
||||||
if (reply.Key == false)
|
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);
|
return bot.GetGroupMembers(groupuuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -105,26 +106,26 @@ namespace BetterSecondBot.HttpService
|
||||||
[Route(HttpVerbs.Get, "/GroupBan/{group}/{avatar}/{state}/{token}")]
|
[Route(HttpVerbs.Get, "/GroupBan/{group}/{avatar}/{state}/{token}")]
|
||||||
public object GroupBan(string group, string avatar, string state, string 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)
|
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)
|
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)
|
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);
|
ProcessAvatar(avatar);
|
||||||
if(avataruuid == UUID.Zero)
|
if(avataruuid == UUID.Zero)
|
||||||
{
|
{
|
||||||
return Failure("avatar lookup");
|
return Failure("avatar lookup", "GroupBan", new string[] { group, avatar, state });
|
||||||
}
|
}
|
||||||
GroupBanAction action = GroupBanAction.Unban;
|
GroupBanAction action = GroupBanAction.Unban;
|
||||||
string statename = "Unban";
|
string statename = "Unban";
|
||||||
|
|
@ -134,7 +135,7 @@ namespace BetterSecondBot.HttpService
|
||||||
statename = "Ban";
|
statename = "Ban";
|
||||||
}
|
}
|
||||||
bot.GetClient.Groups.RequestBanAction(groupuuid, action, new UUID[] { avataruuid });
|
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)
|
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)
|
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)
|
if (bot.MyGroups.ContainsKey(groupuuid) == false)
|
||||||
{
|
{
|
||||||
return Failure("Unknown group");
|
return Failure("Unknown group", "GroupEject", new string[] { group, avatar });
|
||||||
}
|
}
|
||||||
ProcessAvatar(avatar);
|
ProcessAvatar(avatar);
|
||||||
if (avataruuid == UUID.Zero)
|
if (avataruuid == UUID.Zero)
|
||||||
{
|
{
|
||||||
return Failure("avatar lookup");
|
return Failure("avatar lookup", "GroupEject", new string[] { group, avatar });
|
||||||
}
|
}
|
||||||
bot.GetClient.Groups.EjectUser(groupuuid, avataruuid);
|
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")]
|
[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)
|
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)
|
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)
|
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)
|
if (bot.MyGroups.ContainsKey(groupuuid) == false)
|
||||||
{
|
{
|
||||||
return Failure("Unknown group");
|
return Failure("Unknown group", "GroupAddRole", new string[] { group, avatar });
|
||||||
}
|
}
|
||||||
if (bot.NeedReloadGroupData(groupuuid) == true)
|
if (bot.NeedReloadGroupData(groupuuid) == true)
|
||||||
{
|
{
|
||||||
|
|
@ -210,16 +211,16 @@ namespace BetterSecondBot.HttpService
|
||||||
KeyValuePair<bool, string> reply = waitForReady(true, true, groupuuid);
|
KeyValuePair<bool, string> reply = waitForReady(true, true, groupuuid);
|
||||||
if (reply.Key == false)
|
if (reply.Key == false)
|
||||||
{
|
{
|
||||||
return Failure(reply.Value);
|
return Failure(reply.Value, "GroupAddRole", new string[] { group, avatar });
|
||||||
}
|
}
|
||||||
bool status = bot.FastCheckInGroup(groupuuid, avataruuid);
|
bool status = bot.FastCheckInGroup(groupuuid, avataruuid);
|
||||||
if (status == false)
|
if (status == false)
|
||||||
{
|
{
|
||||||
bot.GetClient.Groups.Invite(groupuuid, new List<UUID>() { roleuuid }, avataruuid);
|
bot.GetClient.Groups.Invite(groupuuid, new List<UUID>() { roleuuid }, avataruuid);
|
||||||
return BasicReply("Invite sent");
|
return BasicReply("Invite sent", "GroupAddRole", new string[] { group, avatar });
|
||||||
}
|
}
|
||||||
bot.GetClient.Groups.AddToRole(groupuuid, roleuuid, avataruuid);
|
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")]
|
[About("Eject selected avatar from group")]
|
||||||
|
|
@ -237,15 +238,15 @@ namespace BetterSecondBot.HttpService
|
||||||
{
|
{
|
||||||
if (tokens.Allow(token, "groups", "GroupInvite", handleGetClientIP()) == false)
|
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)
|
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)
|
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)
|
if (bot.NeedReloadGroupData(groupuuid) == true)
|
||||||
{
|
{
|
||||||
|
|
@ -254,12 +255,12 @@ namespace BetterSecondBot.HttpService
|
||||||
ProcessAvatar(avatar);
|
ProcessAvatar(avatar);
|
||||||
if (avataruuid == UUID.Zero)
|
if (avataruuid == UUID.Zero)
|
||||||
{
|
{
|
||||||
return Failure("avatar lookup");
|
return Failure("avatar lookup", "GroupInvite", new string[] { group, avatar, role });
|
||||||
}
|
}
|
||||||
bool status = bot.FastCheckInGroup(groupuuid, avataruuid);
|
bool status = bot.FastCheckInGroup(groupuuid, avataruuid);
|
||||||
if (status == true)
|
if (status == true)
|
||||||
{
|
{
|
||||||
return Failure("Already in group");
|
return Failure("Already in group", "GroupInvite", new string[] { group, avatar, role });
|
||||||
}
|
}
|
||||||
if(role == "everyone")
|
if(role == "everyone")
|
||||||
{
|
{
|
||||||
|
|
@ -267,10 +268,10 @@ namespace BetterSecondBot.HttpService
|
||||||
}
|
}
|
||||||
if(UUID.TryParse(role,out UUID roleuuid) == false)
|
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<UUID>() { roleuuid }, avataruuid);
|
bot.GetClient.Groups.Invite(groupuuid, new List<UUID>() { 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!)")]
|
[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)
|
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)
|
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)
|
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)
|
if (helpers.notempty(title) == false)
|
||||||
{
|
{
|
||||||
return Failure("Title empty");
|
return Failure("Title empty", "Groupnotice", new string[] { group, title, message });
|
||||||
}
|
}
|
||||||
if (helpers.notempty(message) == false)
|
if (helpers.notempty(message) == false)
|
||||||
{
|
{
|
||||||
return Failure("Message empty");
|
return Failure("Message empty", "Groupnotice", new string[] { group, title, message });
|
||||||
}
|
}
|
||||||
GroupNotice NewNotice = new GroupNotice();
|
GroupNotice NewNotice = new GroupNotice();
|
||||||
NewNotice.Subject = title;
|
NewNotice.Subject = title;
|
||||||
NewNotice.Message = message;
|
NewNotice.Message = message;
|
||||||
NewNotice.OwnerID = bot.GetClient.Self.AgentID;
|
NewNotice.OwnerID = bot.GetClient.Self.AgentID;
|
||||||
bot.GetClient.Groups.SendGroupNotice(groupuuid, NewNotice);
|
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")]
|
[About("Activates the selected title")]
|
||||||
|
|
@ -325,22 +326,22 @@ namespace BetterSecondBot.HttpService
|
||||||
{
|
{
|
||||||
if (tokens.Allow(token, "groups", "GroupActiveTitle", handleGetClientIP()) == false)
|
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)
|
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)
|
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)
|
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);
|
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")]
|
[About("Sets the selected group to the active group")]
|
||||||
|
|
@ -351,20 +352,20 @@ namespace BetterSecondBot.HttpService
|
||||||
[Route(HttpVerbs.Get, "/GroupActiveGroup/{group}/{token}")]
|
[Route(HttpVerbs.Get, "/GroupActiveGroup/{group}/{token}")]
|
||||||
public object GroupActiveGroup(string group, string role, string 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)
|
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)
|
if (bot.MyGroups.ContainsKey(groupuuid) == false)
|
||||||
{
|
{
|
||||||
return Failure("Unknown group");
|
return Failure("Unknown group", "GroupActiveGroup", new string[] { group, role });
|
||||||
}
|
}
|
||||||
bot.GetClient.Groups.ActivateGroup(groupuuid);
|
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")]
|
[About("Sends a group notice with an attachment")]
|
||||||
|
|
@ -383,27 +384,27 @@ namespace BetterSecondBot.HttpService
|
||||||
{
|
{
|
||||||
if (tokens.Allow(token, "groups", "GroupnoticeWithAttachment", handleGetClientIP()) == false)
|
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)
|
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)
|
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)
|
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)
|
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)
|
if (helpers.notempty(message) == false)
|
||||||
{
|
{
|
||||||
return Failure("Message empty");
|
return Failure("Message empty", "GroupnoticeWithAttachment", new string[] { group, title, message, attachment });
|
||||||
}
|
}
|
||||||
GroupNotice NewNotice = new GroupNotice();
|
GroupNotice NewNotice = new GroupNotice();
|
||||||
NewNotice.Subject = title;
|
NewNotice.Subject = title;
|
||||||
|
|
@ -411,7 +412,7 @@ namespace BetterSecondBot.HttpService
|
||||||
NewNotice.OwnerID = bot.GetClient.Self.AgentID;
|
NewNotice.OwnerID = bot.GetClient.Self.AgentID;
|
||||||
NewNotice.AttachmentID = inventoryuuid;
|
NewNotice.AttachmentID = inventoryuuid;
|
||||||
bot.GetClient.Groups.SendGroupNotice(groupuuid, NewNotice);
|
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)
|
if (tokens.Allow(token, "groups", "GetGroupList", handleGetClientIP()) == false)
|
||||||
{
|
{
|
||||||
return Failure("Token not accepted");
|
return Failure("Token not accepted", "GetGroupList", new string[] {});
|
||||||
}
|
}
|
||||||
Dictionary<string, string> grouppackage = new Dictionary<string, string>();
|
Dictionary<string, string> grouppackage = new Dictionary<string, string>();
|
||||||
foreach (KeyValuePair<UUID, Group> entry in bot.MyGroups)
|
foreach (KeyValuePair<UUID, Group> entry in bot.MyGroups)
|
||||||
{
|
{
|
||||||
grouppackage.Add(entry.Value.ID.ToString(), entry.Value.Name);
|
grouppackage.Add(entry.Value.ID.ToString(), entry.Value.Name);
|
||||||
}
|
}
|
||||||
return BasicReply(JsonConvert.SerializeObject(grouppackage));
|
return BasicReply(JsonConvert.SerializeObject(grouppackage), "GetGroupList", new string[] { });
|
||||||
}
|
}
|
||||||
|
|
||||||
[About("Requests the roles for the selected group<br/>Replys with GroupRoleDetails object formated as follows <ul><li>UpdateUnderway (Bool)</li><li>RoleDataAge (Int) [default -1]</li><li>Roles (KeyPair array of UUID=Name)</li></ul><br/>")]
|
[About("Requests the roles for the selected group<br/>Replys with GroupRoleDetails object formated as follows <ul><li>UpdateUnderway (Bool)</li><li>RoleDataAge (Int) [default -1]</li><li>Roles (KeyPair array of UUID=Name)</li></ul><br/>")]
|
||||||
|
|
@ -443,15 +444,15 @@ namespace BetterSecondBot.HttpService
|
||||||
{
|
{
|
||||||
if (tokens.Allow(token, "groups", "GetGroupRoles", handleGetClientIP()) == false)
|
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)
|
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)
|
if (bot.MyGroups.ContainsKey(groupuuid) == false)
|
||||||
{
|
{
|
||||||
return Failure("Unknown group");
|
return Failure("Unknown group", "GetGroupRoles", new string[] { group });
|
||||||
}
|
}
|
||||||
GroupRoleDetails reply = new GroupRoleDetails();
|
GroupRoleDetails reply = new GroupRoleDetails();
|
||||||
reply.UpdateUnderway = false;
|
reply.UpdateUnderway = false;
|
||||||
|
|
@ -479,10 +480,10 @@ namespace BetterSecondBot.HttpService
|
||||||
bot.GetClient.Groups.RequestGroupRoles(groupuuid);
|
bot.GetClient.Groups.RequestGroupRoles(groupuuid);
|
||||||
if (reply.Roles.Count == 0)
|
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")]
|
[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)
|
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")]
|
[About("fetchs a list of all groups with unread messages")]
|
||||||
|
|
@ -506,20 +507,20 @@ namespace BetterSecondBot.HttpService
|
||||||
[Route(HttpVerbs.Get, "/GroupchatGroupHasUnread/{group}/{token}")]
|
[Route(HttpVerbs.Get, "/GroupchatGroupHasUnread/{group}/{token}")]
|
||||||
public object GroupchatGroupHasUnread(string group,string 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;
|
UUID groupUUID = UUID.Zero;
|
||||||
if(UUID.TryParse(group,out groupUUID) == false)
|
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)
|
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)
|
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")]
|
[About("Clears all group chat buffers at once")]
|
||||||
|
|
@ -542,10 +543,10 @@ namespace BetterSecondBot.HttpService
|
||||||
{
|
{
|
||||||
if (tokens.Allow(token, "groups", "GroupchatClearAll", handleGetClientIP()) == false)
|
if (tokens.Allow(token, "groups", "GroupchatClearAll", handleGetClientIP()) == false)
|
||||||
{
|
{
|
||||||
return Failure("Token not accepted");
|
return Failure("Token not accepted", "GroupchatClearAll", new string[] { });
|
||||||
}
|
}
|
||||||
bot.ClearAllGroupchat();
|
bot.ClearAllGroupchat();
|
||||||
return BasicReply("ok");
|
return BasicReply("ok", "GroupchatClearAll", new string[] { });
|
||||||
}
|
}
|
||||||
|
|
||||||
[About("fetchs the groupchat history")]
|
[About("fetchs the groupchat history")]
|
||||||
|
|
@ -557,13 +558,13 @@ namespace BetterSecondBot.HttpService
|
||||||
{
|
{
|
||||||
if (tokens.Allow(token, "groups", "GroupchatHistory", handleGetClientIP()) == false)
|
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)
|
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")]
|
[About("sends a message to the groupchat")]
|
||||||
|
|
@ -578,24 +579,24 @@ namespace BetterSecondBot.HttpService
|
||||||
{
|
{
|
||||||
if (tokens.Allow(token, "groups", "Groupchat", handleGetClientIP()) == false)
|
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;
|
UUID groupUUID = UUID.Zero;
|
||||||
if (UUID.TryParse(group, out groupUUID) == false)
|
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)
|
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)
|
if (bot.GetActiveGroupchatSessions.Contains(groupUUID) == false)
|
||||||
{
|
{
|
||||||
bot.GetClient.Self.RequestJoinGroupChat(groupUUID);
|
bot.GetClient.Self.RequestJoinGroupChat(groupUUID);
|
||||||
return Failure("Opening groupchat");
|
return Failure("Opening groupchat", "Groupchat", new string[] { group, message });
|
||||||
}
|
}
|
||||||
bot.GetClient.Self.InstantMessageGroup(groupUUID, message);
|
bot.GetClient.Self.InstantMessageGroup(groupUUID, message);
|
||||||
return BasicReply("Sending");
|
return BasicReply("Sending", "Groupchat", new string[] { group, message });
|
||||||
}
|
}
|
||||||
|
|
||||||
protected KeyValuePair<bool, string> waitForReady(bool avatar, bool group, UUID groupuuid)
|
protected KeyValuePair<bool, string> waitForReady(bool avatar, bool group, UUID groupuuid)
|
||||||
|
|
|
||||||
|
|
@ -19,14 +19,14 @@ namespace BetterSecondBot.HttpService
|
||||||
[About("Makes the bot teleport to its home region")]
|
[About("Makes the bot teleport to its home region")]
|
||||||
[ReturnHints("ok")]
|
[ReturnHints("ok")]
|
||||||
[Route(HttpVerbs.Get, "/GoHome/{token}")]
|
[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();
|
bot.GotoNextHomeRegion();
|
||||||
return BasicReply("ok");
|
return BasicReply("ok", "GoHome", new string[] { });
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,19 +22,19 @@ namespace BetterSecondBot.HttpService
|
||||||
{
|
{
|
||||||
if (tokens.Allow(token, "im", "chatwindows", handleGetClientIP()) == false)
|
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")]
|
[About("gets a list of chat windows with unread messages")]
|
||||||
[ReturnHints("array of UUID")]
|
[ReturnHints("array of UUID")]
|
||||||
[Route(HttpVerbs.Get, "/listwithunread/{token}")]
|
[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)
|
if (tokens.Allow(token, "im", "listwithunread", handleGetClientIP()) == false)
|
||||||
{
|
{
|
||||||
return BasicReply("Token not accepted");
|
return BasicReply("Token not accepted", "listwithunread", new string[] { });
|
||||||
}
|
}
|
||||||
List<UUID> unreadimwindows = new List<UUID>();
|
List<UUID> unreadimwindows = new List<UUID>();
|
||||||
foreach (UUID window in bot.IMChatWindows())
|
foreach (UUID window in bot.IMChatWindows())
|
||||||
|
|
@ -44,7 +44,7 @@ namespace BetterSecondBot.HttpService
|
||||||
unreadimwindows.Add(window);
|
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")]
|
[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)
|
if (tokens.Allow(token, "im", "haveunreadims", handleGetClientIP()) == false)
|
||||||
{
|
{
|
||||||
return BasicReply("Token not accepted");
|
return BasicReply("Token not accepted", "haveunreadims", new string[] { });
|
||||||
}
|
}
|
||||||
bool reply = false;
|
bool reply = false;
|
||||||
foreach (UUID window in bot.IMChatWindows())
|
foreach (UUID window in bot.IMChatWindows())
|
||||||
|
|
@ -65,7 +65,7 @@ namespace BetterSecondBot.HttpService
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return BasicReply(reply.ToString());
|
return BasicReply(reply.ToString(), "haveunreadims", new string[] { });
|
||||||
}
|
}
|
||||||
|
|
||||||
[About("gets the chat from the selected window")]
|
[About("gets the chat from the selected window")]
|
||||||
|
|
@ -77,13 +77,13 @@ namespace BetterSecondBot.HttpService
|
||||||
{
|
{
|
||||||
if (tokens.Allow(token, "im", "getimchat", handleGetClientIP()) == false)
|
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)
|
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 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,9 +23,9 @@ namespace BetterSecondBot.HttpService
|
||||||
{
|
{
|
||||||
if (tokens.Allow(token, "info", "Version", handleGetClientIP()) == false)
|
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)
|
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")]
|
[About("Fetchs the current parcels name")]
|
||||||
|
|
@ -50,18 +50,18 @@ namespace BetterSecondBot.HttpService
|
||||||
{
|
{
|
||||||
if (tokens.Allow(token, "info", "ParcelName", handleGetClientIP()) == false)
|
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)
|
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);
|
int localid = bot.GetClient.Parcels.GetParcelLocalID(bot.GetClient.Network.CurrentSim, bot.GetClient.Self.SimPosition);
|
||||||
if (bot.GetClient.Network.CurrentSim.Parcels.ContainsKey(localid) == false)
|
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")]
|
[About("Requests the current unixtime at the bot")]
|
||||||
|
|
@ -71,9 +71,9 @@ namespace BetterSecondBot.HttpService
|
||||||
{
|
{
|
||||||
if (tokens.Allow(token, "info", "UnixTimeNow", handleGetClientIP()) == false)
|
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")]
|
[About("Fetchs the current region name")]
|
||||||
|
|
@ -84,13 +84,13 @@ namespace BetterSecondBot.HttpService
|
||||||
{
|
{
|
||||||
if (tokens.Allow(token, "info", "SimName", handleGetClientIP()) == false)
|
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)
|
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")]
|
[About("Fetchs the current location of the bot")]
|
||||||
|
|
@ -101,17 +101,17 @@ namespace BetterSecondBot.HttpService
|
||||||
{
|
{
|
||||||
if (tokens.Allow(token, "info", "GetPosition", handleGetClientIP()) == false)
|
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)
|
if (bot.GetClient.Network.CurrentSim == null)
|
||||||
{
|
{
|
||||||
return Failure("Error not in a sim");
|
return Failure("Error not in a sim", "GetPosition", new string[] { });
|
||||||
}
|
}
|
||||||
Dictionary<string, int> pos = new Dictionary<string, int>();
|
Dictionary<string, int> pos = new Dictionary<string, int>();
|
||||||
pos.Add("x", (int)Math.Round(bot.GetClient.Self.SimPosition.X));
|
pos.Add("x", (int)Math.Round(bot.GetClient.Self.SimPosition.X));
|
||||||
pos.Add("y", (int)Math.Round(bot.GetClient.Self.SimPosition.Y));
|
pos.Add("y", (int)Math.Round(bot.GetClient.Self.SimPosition.Y));
|
||||||
pos.Add("z", (int)Math.Round(bot.GetClient.Self.SimPosition.Z));
|
pos.Add("z", (int)Math.Round(bot.GetClient.Self.SimPosition.Z));
|
||||||
return BasicReply(JsonConvert.SerializeObject(pos));
|
return BasicReply(JsonConvert.SerializeObject(pos), "GetPosition", new string[] { });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,19 +26,19 @@ namespace BetterSecondBot.HttpService
|
||||||
{
|
{
|
||||||
if (tokens.Allow(token, "inventory", "RezObject", handleGetClientIP()) == false)
|
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)
|
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));
|
InventoryItem itm = bot.GetClient.Inventory.FetchItem(targetitem, bot.GetClient.Self.AgentID, (5 * 1000));
|
||||||
if (itm == null)
|
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);
|
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("item", "URLARG", "UUID of item/folder to name")]
|
||||||
[ArgHints("newname", "Text", "What we are changing it to")]
|
[ArgHints("newname", "Text", "What we are changing it to")]
|
||||||
[Route(HttpVerbs.Post, "/RenameInventory/{item}/{token}")]
|
[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)
|
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)
|
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)
|
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);
|
InventoryItem realitem = HelperInventory.getItemByInventoryUUID(bot, target);
|
||||||
if (realitem == null)
|
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;
|
realitem.Name = newname;
|
||||||
bot.GetClient.Inventory.RequestUpdateItem(realitem);
|
bot.GetClient.Inventory.RequestUpdateItem(realitem);
|
||||||
return BasicReply("Ok");
|
return BasicReply("Ok", "RenameInventory", new string[] { item, newname });
|
||||||
}
|
}
|
||||||
|
|
||||||
[About("Attempts to Remove the given inventory item")]
|
[About("Attempts to Remove the given inventory item")]
|
||||||
|
|
@ -83,14 +83,14 @@ namespace BetterSecondBot.HttpService
|
||||||
{
|
{
|
||||||
if (tokens.Allow(token, "inventory", "DeleteInventoryItem", handleGetClientIP()) == false)
|
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)
|
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<UUID>() { target }, new List<UUID>());
|
bot.GetClient.Inventory.Remove(new List<UUID>() { target }, new List<UUID>());
|
||||||
return BasicReply("Ok");
|
return BasicReply("Ok", "DeleteInventoryItem", new string[] { item });
|
||||||
}
|
}
|
||||||
|
|
||||||
[About("Attempts to Remove the given inventory folder")]
|
[About("Attempts to Remove the given inventory folder")]
|
||||||
|
|
@ -102,14 +102,14 @@ namespace BetterSecondBot.HttpService
|
||||||
{
|
{
|
||||||
if (tokens.Allow(token, "inventory", "DeleteInventoryFolder", handleGetClientIP()) == false)
|
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)
|
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<UUID>(), new List<UUID>() { target });
|
bot.GetClient.Inventory.Remove(new List<UUID>(), new List<UUID>() { target });
|
||||||
return BasicReply("Ok");
|
return BasicReply("Ok", "DeleteInventoryFolder", new string[] { folder });
|
||||||
}
|
}
|
||||||
|
|
||||||
[About("Attempts to attach the given inventory item")]
|
[About("Attempts to attach the given inventory item")]
|
||||||
|
|
@ -121,15 +121,15 @@ namespace BetterSecondBot.HttpService
|
||||||
{
|
{
|
||||||
if (tokens.Allow(token, "inventory", "Attach", handleGetClientIP()) == false)
|
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)
|
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);
|
InventoryItem realitem = HelperInventory.getItemByInventoryUUID(bot, itemuuid);
|
||||||
bot.GetClient.Appearance.AddAttachments(new List<InventoryItem>() { realitem }, false, false);
|
bot.GetClient.Appearance.AddAttachments(new List<InventoryItem>() { realitem }, false, false);
|
||||||
return BasicReply("Ok");
|
return BasicReply("Ok", "Attach", new string[] { item });
|
||||||
}
|
}
|
||||||
|
|
||||||
[About("Attempts to Remove the given inventory folder")]
|
[About("Attempts to Remove the given inventory folder")]
|
||||||
|
|
@ -141,15 +141,15 @@ namespace BetterSecondBot.HttpService
|
||||||
{
|
{
|
||||||
if (tokens.Allow(token, "inventory", "Detach", handleGetClientIP()) == false)
|
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)
|
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);
|
InventoryItem realitem = HelperInventory.getItemByInventoryUUID(bot, itemuuid);
|
||||||
bot.GetClient.Appearance.RemoveFromOutfit(realitem);
|
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<br/>Please note: This does not use the outfits folder!<br/>Please do not use links in the folder!")]
|
[About("Replaces the current avatar outfit with the Clothing/[NAME] folder<br/>Please note: This does not use the outfits folder!<br/>Please do not use links in the folder!")]
|
||||||
|
|
@ -164,11 +164,11 @@ namespace BetterSecondBot.HttpService
|
||||||
{
|
{
|
||||||
if (tokens.Allow(token, "inventory", "Outfit", handleGetClientIP()) == false)
|
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)
|
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
|
// uses the Clothing folder
|
||||||
// must be a full outfit (shapes/eyes ect)
|
// must be a full outfit (shapes/eyes ect)
|
||||||
|
|
@ -185,7 +185,7 @@ namespace BetterSecondBot.HttpService
|
||||||
}
|
}
|
||||||
if (AA == null)
|
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);
|
T = bot.GetClient.Inventory.Store.GetContents(AA);
|
||||||
AA = null;
|
AA = null;
|
||||||
|
|
@ -199,13 +199,13 @@ namespace BetterSecondBot.HttpService
|
||||||
}
|
}
|
||||||
if (AA == null)
|
if (AA == null)
|
||||||
{
|
{
|
||||||
return Failure("Cant find target folder");
|
return Failure("Cant find target folder", "Outfit", new string[] { name });
|
||||||
}
|
}
|
||||||
List<InventoryBase> contents = bot.GetClient.Inventory.FolderContents(AA.UUID, bot.GetClient.Self.AgentID, true, true, InventorySortOrder.ByName, 5 * 1000);
|
List<InventoryBase> contents = bot.GetClient.Inventory.FolderContents(AA.UUID, bot.GetClient.Self.AgentID, true, true, InventorySortOrder.ByName, 5 * 1000);
|
||||||
List<InventoryItem> wareables = new List<InventoryItem>();
|
List<InventoryItem> wareables = new List<InventoryItem>();
|
||||||
if (contents == null)
|
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)
|
foreach (InventoryBase item in contents)
|
||||||
{
|
{
|
||||||
|
|
@ -215,7 +215,7 @@ namespace BetterSecondBot.HttpService
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bot.GetClient.Appearance.ReplaceOutfit(wareables, false);
|
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)
|
if (tokens.Allow(token, "inventory", "InventoryPurgeNotecards", handleGetClientIP()) == false)
|
||||||
{
|
{
|
||||||
return Failure("Token not accepted");
|
return Failure("Token not accepted", "InventoryPurgeNotecards", new string[] { });
|
||||||
}
|
}
|
||||||
List<InventoryBase> T = bot.GetClient.Inventory.Store.GetContents(bot.GetClient.Inventory.Store.RootFolder);
|
List<InventoryBase> T = bot.GetClient.Inventory.Store.GetContents(bot.GetClient.Inventory.Store.RootFolder);
|
||||||
InventoryBase NotecardFolder = null;
|
InventoryBase NotecardFolder = null;
|
||||||
|
|
@ -242,7 +242,7 @@ namespace BetterSecondBot.HttpService
|
||||||
}
|
}
|
||||||
if (NotecardFolder != null)
|
if (NotecardFolder != null)
|
||||||
{
|
{
|
||||||
return Failure("Unable to find notecard folder");
|
return Failure("Unable to find notecard folder", "InventoryPurgeNotecards", new string[] { });
|
||||||
}
|
}
|
||||||
List<UUID> purge_notecards = new List<UUID>();
|
List<UUID> purge_notecards = new List<UUID>();
|
||||||
List<InventoryBase> contents = bot.GetClient.Inventory.FolderContents(NotecardFolder.UUID, bot.GetClient.Self.AgentID, true, true, InventorySortOrder.ByDate, 40 * 1000);
|
List<InventoryBase> 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<UUID>());
|
bot.GetClient.Inventory.Remove(purge_notecards, new List<UUID>());
|
||||||
}
|
}
|
||||||
return BasicReply("Ok");
|
return BasicReply("Ok", "InventoryPurgeNotecards", new string[] { });
|
||||||
}
|
}
|
||||||
|
|
||||||
[About("converts a inventory uuid to a realworld uuid<br/>Needed for texture preview")]
|
[About("converts a inventory uuid to a realworld uuid<br/>Needed for texture preview")]
|
||||||
|
|
@ -274,14 +274,14 @@ namespace BetterSecondBot.HttpService
|
||||||
{
|
{
|
||||||
if (tokens.Allow(token, "inventory", "getRealUUID", handleGetClientIP()) == false)
|
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)
|
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);
|
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")]
|
[About("sends a item to an avatar")]
|
||||||
|
|
@ -297,24 +297,24 @@ namespace BetterSecondBot.HttpService
|
||||||
{
|
{
|
||||||
if (tokens.Allow(token, "inventory", "SendItem", handleGetClientIP()) == false)
|
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);
|
ProcessAvatar(avatar);
|
||||||
if(avataruuid == UUID.Zero)
|
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)
|
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));
|
InventoryItem itm = bot.GetClient.Inventory.FetchItem(targetitem, bot.GetClient.Self.AgentID, (3 * 1000));
|
||||||
if (itm == null)
|
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);
|
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")]
|
[About("Sends a folder to an avatar")]
|
||||||
|
|
@ -330,24 +330,24 @@ namespace BetterSecondBot.HttpService
|
||||||
{
|
{
|
||||||
if (tokens.Allow(token, "inventory", "SendFolder", handleGetClientIP()) == false)
|
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);
|
ProcessAvatar(avatar);
|
||||||
if (avataruuid == UUID.Zero)
|
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)
|
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);
|
InventoryBase FindFolderHelper = HelperInventory.FindFolder(bot, bot.GetClient.Inventory.Store.RootFolder, targetfolder);
|
||||||
if (FindFolderHelper == null)
|
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);
|
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)
|
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)
|
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)
|
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)
|
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));
|
InventoryItem itm = bot.GetClient.Inventory.FetchItem(itemuuid, bot.GetClient.Self.AgentID, (3 * 1000));
|
||||||
if (itm == null)
|
if (itm == null)
|
||||||
{
|
{
|
||||||
return Failure("Unable to find inventory");
|
return Failure("Unable to find inventory", "TransferInventoryToObject", new string[] { item, objectuuid, running });
|
||||||
}
|
}
|
||||||
Dictionary<uint, Primitive> objects_copy = bot.GetClient.Network.CurrentSim.ObjectsPrimitives.Copy();
|
Dictionary<uint, Primitive> objects_copy = bot.GetClient.Network.CurrentSim.ObjectsPrimitives.Copy();
|
||||||
KeyValuePair<uint, Primitive> RealObject = new KeyValuePair<uint, Primitive>(0,null);
|
KeyValuePair<uint, Primitive> RealObject = new KeyValuePair<uint, Primitive>(0,null);
|
||||||
|
|
@ -401,7 +401,7 @@ namespace BetterSecondBot.HttpService
|
||||||
}
|
}
|
||||||
if (RealObject.Value == null)
|
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;
|
bool scriptState = runscript;
|
||||||
if (itm.AssetType != AssetType.LSLText)
|
if (itm.AssetType != AssetType.LSLText)
|
||||||
|
|
@ -411,10 +411,10 @@ namespace BetterSecondBot.HttpService
|
||||||
if (itm.AssetType == AssetType.LSLText)
|
if (itm.AssetType == AssetType.LSLText)
|
||||||
{
|
{
|
||||||
bot.GetClient.Inventory.CopyScriptToTask(RealObject.Key, itm, scriptState);
|
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);
|
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<br/>Formated as follows<br/>InventoryMapItem<br/><ul><li>id: UUID</li><li>name: String</li><li>subfolders: InventoryMapFolder[]</li></ul>")]
|
[About("Requests the inventory folder layout as a json object InventoryMapFolder<br/>Formated as follows<br/>InventoryMapItem<br/><ul><li>id: UUID</li><li>name: String</li><li>subfolders: InventoryMapFolder[]</li></ul>")]
|
||||||
|
|
@ -425,11 +425,11 @@ namespace BetterSecondBot.HttpService
|
||||||
{
|
{
|
||||||
if (tokens.Allow(token, "inventory", "InventoryFolders", handleGetClientIP()) == false)
|
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);
|
string reply = HelperInventory.MapFolderJson(bot);
|
||||||
if (reply != null) return BasicReply(reply);
|
if (reply != null) return BasicReply(reply, "InventoryFolders", new string[] { });
|
||||||
return Failure("Error");
|
return Failure("Error", "InventoryFolders", new string[] { });
|
||||||
}
|
}
|
||||||
|
|
||||||
[About("Requests the contents of a folder as an array of InventoryMapItem<br/>Formated as follows<br/>InventoryMapItem<br/><ul><li>id: UUID</li><li>name: String</li><li>typename: String</li></ul>")]
|
[About("Requests the contents of a folder as an array of InventoryMapItem<br/>Formated as follows<br/>InventoryMapItem<br/><ul><li>id: UUID</li><li>name: String</li><li>typename: String</li></ul>")]
|
||||||
|
|
@ -441,13 +441,13 @@ namespace BetterSecondBot.HttpService
|
||||||
{
|
{
|
||||||
if (tokens.Allow(token, "inventory", "InventoryContents", handleGetClientIP()) == false)
|
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)
|
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 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,23 +31,23 @@ namespace BetterSecondBot.HttpService
|
||||||
{
|
{
|
||||||
if (tokens.Allow(token, "movement", "AutoPilot", handleGetClientIP()) == false)
|
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)
|
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)
|
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)
|
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)
|
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.AutoPilotCancel();
|
||||||
bot.GetClient.Self.Movement.TurnToward(pos, true);
|
bot.GetClient.Self.Movement.TurnToward(pos, true);
|
||||||
|
|
@ -55,7 +55,7 @@ namespace BetterSecondBot.HttpService
|
||||||
uint Globalx, Globaly;
|
uint Globalx, Globaly;
|
||||||
Utils.LongToUInts(bot.GetClient.Network.CurrentSim.Handle, out Globalx, out 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);
|
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")]
|
[About("Attempt to teleport to a new region")]
|
||||||
|
|
@ -65,10 +65,10 @@ namespace BetterSecondBot.HttpService
|
||||||
{
|
{
|
||||||
if (tokens.Allow(token, "movement", "AutoPilotStop", handleGetClientIP()) == false)
|
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();
|
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")]
|
[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)
|
if (tokens.Allow(token, "movement", "SendTeleportLure", handleGetClientIP()) == false)
|
||||||
{
|
{
|
||||||
return Failure("Token not accepted");
|
return Failure("Token not accepted", "SendTeleportLure", new string[] { avatar });
|
||||||
}
|
}
|
||||||
ProcessAvatar(avatar);
|
ProcessAvatar(avatar);
|
||||||
if(avataruuid == UUID.Zero)
|
if(avataruuid == UUID.Zero)
|
||||||
{
|
{
|
||||||
return Failure("Invaild avatar UUID");
|
return Failure("Invaild avatar UUID", "SendTeleportLure", new string[] { avatar });
|
||||||
}
|
}
|
||||||
bot.GetClient.Self.SendTeleportLure(avataruuid);
|
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)")]
|
[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)
|
if (tokens.Allow(token, "movement", "RequestTeleport", handleGetClientIP()) == false)
|
||||||
{
|
{
|
||||||
return Failure("Token not accepted");
|
return Failure("Token not accepted", "RequestTeleport", new string[] { avatar });
|
||||||
}
|
}
|
||||||
ProcessAvatar(avatar);
|
ProcessAvatar(avatar);
|
||||||
if (avataruuid == UUID.Zero)
|
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.Add_action_from("teleport", avataruuid);
|
||||||
bot.GetClient.Self.SendTeleportLureRequest(avataruuid, "I would like to teleport to you");
|
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)")]
|
[About("Makes the bot fly (or not)")]
|
||||||
|
|
@ -121,15 +121,15 @@ namespace BetterSecondBot.HttpService
|
||||||
{
|
{
|
||||||
if (tokens.Allow(token, "movement", "Fly", handleGetClientIP()) == false)
|
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)
|
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.Fly = flymode;
|
||||||
bot.GetClient.Self.Movement.SendUpdate();
|
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)
|
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)
|
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)
|
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)
|
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)
|
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")]
|
[About("Rotates the bot to face a avatar")]
|
||||||
|
|
@ -175,18 +175,18 @@ namespace BetterSecondBot.HttpService
|
||||||
{
|
{
|
||||||
if (tokens.Allow(token, "movement", "RotateToFace", handleGetClientIP()) == false)
|
if (tokens.Allow(token, "movement", "RotateToFace", handleGetClientIP()) == false)
|
||||||
{
|
{
|
||||||
return Failure("Token not accepted");
|
return Failure("Token not accepted", "RotateToFace", new string[] { avatar });
|
||||||
}
|
}
|
||||||
ProcessAvatar(avatar);
|
ProcessAvatar(avatar);
|
||||||
if(avataruuid == UUID.Zero)
|
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)
|
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)
|
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)
|
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;
|
float yaw = target_yaw;
|
||||||
bot.GetClient.Self.Movement.BodyRotation.GetEulerAngles(out float roll, out float pitch, out _);
|
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;
|
result.Z = cosYawOver2 * cosPitchOver2 * sinRollOver2 - sinYawOver2 * sinPitchOver2 * cosRollOver2;
|
||||||
bot.GetClient.Self.Movement.BodyRotation = result;
|
bot.GetClient.Self.Movement.BodyRotation = result;
|
||||||
bot.GetClient.Self.Movement.SendUpdate();
|
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)
|
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 });
|
bool status = TeleportRequest(new string[] { region, x, y, z });
|
||||||
if (status == false)
|
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)
|
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)
|
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)
|
protected bool TeleportRequest(string[] args)
|
||||||
|
|
|
||||||
|
|
@ -26,18 +26,18 @@ namespace BetterSecondBot.HttpService
|
||||||
{
|
{
|
||||||
if (tokens.Allow(token, "notecard", "NotecardAdd", handleGetClientIP()) == false)
|
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)
|
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)
|
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);
|
bot.NotecardAddContent(collection, content);
|
||||||
return BasicReply("ok");
|
return BasicReply("ok", "NotecardAdd", new string[] { collection, content });
|
||||||
}
|
}
|
||||||
|
|
||||||
[About("Adds content to the Collection<br/> Also creates the Collection if it does not exist")]
|
[About("Adds content to the Collection<br/> Also creates the Collection if it does not exist")]
|
||||||
|
|
@ -48,14 +48,14 @@ namespace BetterSecondBot.HttpService
|
||||||
{
|
{
|
||||||
if (tokens.Allow(token, "notecard", "NotecardClear", handleGetClientIP()) == false)
|
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)
|
if (helpers.notempty(collection) == false)
|
||||||
{
|
{
|
||||||
return Failure("Collection value is empty");
|
return Failure("Collection value is empty", "NotecardClear", new string[] { collection });
|
||||||
}
|
}
|
||||||
bot.ClearNotecardStorage(collection);
|
bot.ClearNotecardStorage(collection);
|
||||||
return BasicReply("ok");
|
return BasicReply("ok", "NotecardClear", new string[] { collection });
|
||||||
}
|
}
|
||||||
|
|
||||||
[About("Adds content to the Collection<br/> Also creates the Collection if it does not exist")]
|
[About("Adds content to the Collection<br/> Also creates the Collection if it does not exist")]
|
||||||
|
|
@ -70,28 +70,28 @@ namespace BetterSecondBot.HttpService
|
||||||
{
|
{
|
||||||
if (tokens.Allow(token, "notecard", "NotecardSend", handleGetClientIP()) == false)
|
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)
|
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)
|
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);
|
ProcessAvatar(avatar);
|
||||||
if(avataruuid == UUID.Zero)
|
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);
|
string content = bot.GetNotecardContent(collection);
|
||||||
if (content == null)
|
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);
|
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 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,15 +32,15 @@ namespace BetterSecondBot.HttpService
|
||||||
KeyValuePair<bool, string> tests = SetupCurrentParcel(token, "parcel", "SetParcelSale");
|
KeyValuePair<bool, string> tests = SetupCurrentParcel(token, "parcel", "SetParcelSale");
|
||||||
if(tests.Key == false)
|
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)
|
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))
|
if((amountvalue < 1) || (amountvalue > 9999999))
|
||||||
{
|
{
|
||||||
return Failure("Invaild amount");
|
return Failure("Invaild amount", "SetParcelSale", new string[] { amount, avatar });
|
||||||
}
|
}
|
||||||
ProcessAvatar(avatar);
|
ProcessAvatar(avatar);
|
||||||
targetparcel.SalePrice = amountvalue;
|
targetparcel.SalePrice = amountvalue;
|
||||||
|
|
@ -48,7 +48,7 @@ namespace BetterSecondBot.HttpService
|
||||||
parcel_static.ParcelSetFlag(ParcelFlags.ForSale, targetparcel, true);
|
parcel_static.ParcelSetFlag(ParcelFlags.ForSale, targetparcel, true);
|
||||||
parcel_static.ParcelSetFlag(ParcelFlags.ForSaleObjects, targetparcel, false);
|
parcel_static.ParcelSetFlag(ParcelFlags.ForSaleObjects, targetparcel, false);
|
||||||
targetparcel.Update(bot.GetClient.Network.CurrentSim, 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")]
|
[About("Changes the parcel landing mode to point and sets the landing point")]
|
||||||
|
|
@ -65,24 +65,24 @@ namespace BetterSecondBot.HttpService
|
||||||
KeyValuePair<bool, string> tests = SetupCurrentParcel(token, "parcel", "SetParcelLandingZone");
|
KeyValuePair<bool, string> tests = SetupCurrentParcel(token, "parcel", "SetParcelLandingZone");
|
||||||
if (tests.Key == false)
|
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)
|
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)
|
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)
|
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.Landing = LandingType.LandingPoint;
|
||||||
targetparcel.UserLocation = new Vector3(X, Y, Z);
|
targetparcel.UserLocation = new Vector3(X, Y, Z);
|
||||||
targetparcel.Update(bot.GetClient.Network.CurrentSim, false);
|
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<bool, string> tests = SetupCurrentParcel(token, "parcel", "SetParcelName");
|
KeyValuePair<bool, string> tests = SetupCurrentParcel(token, "parcel", "SetParcelName");
|
||||||
if (tests.Key == false)
|
if (tests.Key == false)
|
||||||
{
|
{
|
||||||
return Failure(tests.Value);
|
return Failure(tests.Value, "SetParcelName", new string[] { name });
|
||||||
}
|
}
|
||||||
if (helpers.notempty(name) == false)
|
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.Name = name;
|
||||||
targetparcel.Update(bot.GetClient.Network.CurrentSim, false);
|
targetparcel.Update(bot.GetClient.Network.CurrentSim, false);
|
||||||
return BasicReply("ok");
|
return BasicReply("ok", "SetParcelName", new string[] { name });
|
||||||
}
|
}
|
||||||
|
|
||||||
[About("Updates the current parcels description")]
|
[About("Updates the current parcels description")]
|
||||||
|
|
@ -120,11 +120,11 @@ namespace BetterSecondBot.HttpService
|
||||||
KeyValuePair<bool, string> tests = SetupCurrentParcel(token, "parcel", "SetParcelDesc");
|
KeyValuePair<bool, string> tests = SetupCurrentParcel(token, "parcel", "SetParcelDesc");
|
||||||
if (tests.Key == false)
|
if (tests.Key == false)
|
||||||
{
|
{
|
||||||
return Failure(tests.Value);
|
return Failure(tests.Value, "SetParcelDesc", new string[] { desc });
|
||||||
}
|
}
|
||||||
targetparcel.Desc = desc;
|
targetparcel.Desc = desc;
|
||||||
targetparcel.Update(bot.GetClient.Network.CurrentSim, false);
|
targetparcel.Update(bot.GetClient.Network.CurrentSim, false);
|
||||||
return BasicReply("ok");
|
return BasicReply("ok", "SetParcelDesc", new string[] { desc });
|
||||||
}
|
}
|
||||||
|
|
||||||
[About("Fetchs the current parcels desc")]
|
[About("Fetchs the current parcels desc")]
|
||||||
|
|
@ -137,9 +137,9 @@ namespace BetterSecondBot.HttpService
|
||||||
KeyValuePair<bool, string> tests = SetupCurrentParcel(token, "parcel", "GetParcelDesc");
|
KeyValuePair<bool, string> tests = SetupCurrentParcel(token, "parcel", "GetParcelDesc");
|
||||||
if (tests.Key == false)
|
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")]
|
[About("gets the flags for the parcel")]
|
||||||
|
|
@ -152,7 +152,7 @@ namespace BetterSecondBot.HttpService
|
||||||
KeyValuePair<bool, string> tests = SetupCurrentParcel(token, "parcel", "GetParcelFlags");
|
KeyValuePair<bool, string> tests = SetupCurrentParcel(token, "parcel", "GetParcelFlags");
|
||||||
if (tests.Key == false)
|
if (tests.Key == false)
|
||||||
{
|
{
|
||||||
return Failure(tests.Value);
|
return Failure(tests.Value, "GetParcelFlags", new string[] { });
|
||||||
}
|
}
|
||||||
Dictionary<string, ParcelFlags> flags = parcel_static.get_flags_list();
|
Dictionary<string, ParcelFlags> flags = parcel_static.get_flags_list();
|
||||||
Dictionary<string, string> collection = new Dictionary<string, string>();
|
Dictionary<string, string> collection = new Dictionary<string, string>();
|
||||||
|
|
@ -160,6 +160,7 @@ namespace BetterSecondBot.HttpService
|
||||||
{
|
{
|
||||||
collection.Add(cfg.ToString(), targetparcel.Flags.HasFlag(cfg).ToString());
|
collection.Add(cfg.ToString(), targetparcel.Flags.HasFlag(cfg).ToString());
|
||||||
}
|
}
|
||||||
|
SuccessNoReturn("GetParcelFlags", new string[] { });
|
||||||
return collection;
|
return collection;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -172,15 +173,15 @@ namespace BetterSecondBot.HttpService
|
||||||
{
|
{
|
||||||
if (tokens.Allow(token, "parcel", "ParcelEject", handleGetClientIP()) == false)
|
if (tokens.Allow(token, "parcel", "ParcelEject", handleGetClientIP()) == false)
|
||||||
{
|
{
|
||||||
return Failure("Token not accepted");
|
return Failure("Token not accepted", "ParcelEject", new string[] { avatar });
|
||||||
}
|
}
|
||||||
ProcessAvatar(avatar);
|
ProcessAvatar(avatar);
|
||||||
if(avataruuid == UUID.Zero)
|
if(avataruuid == UUID.Zero)
|
||||||
{
|
{
|
||||||
return Failure("Invaild avatar");
|
return Failure("Invaild avatar", "ParcelEject", new string[] { avatar });
|
||||||
}
|
}
|
||||||
bot.GetClient.Parcels.EjectUser(avataruuid, false);
|
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")]
|
[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<bool, string> tests = SetupCurrentParcel(token, "parcel", "AbandonLand");
|
KeyValuePair<bool, string> tests = SetupCurrentParcel(token, "parcel", "AbandonLand");
|
||||||
if (tests.Key == false)
|
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);
|
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<bool, string> tests = SetupCurrentParcel(token, "parcel", "ParcelBan");
|
KeyValuePair<bool, string> tests = SetupCurrentParcel(token, "parcel", "ParcelBan");
|
||||||
if (tests.Key == false)
|
if (tests.Key == false)
|
||||||
{
|
{
|
||||||
return Failure(tests.Value);
|
return Failure(tests.Value, "ParcelBan", new string[] { avatar });
|
||||||
}
|
}
|
||||||
ProcessAvatar(avatar);
|
ProcessAvatar(avatar);
|
||||||
if (avataruuid == UUID.Zero)
|
if (avataruuid == UUID.Zero)
|
||||||
{
|
{
|
||||||
return Failure("Invaild avatar");
|
return Failure("Invaild avatar", "ParcelBan", new string[] { avatar });
|
||||||
}
|
}
|
||||||
bool alreadyBanned = false;
|
bool alreadyBanned = false;
|
||||||
foreach (ParcelAccessEntry E in targetparcel.AccessBlackList)
|
foreach (ParcelAccessEntry E in targetparcel.AccessBlackList)
|
||||||
|
|
@ -229,7 +230,7 @@ namespace BetterSecondBot.HttpService
|
||||||
}
|
}
|
||||||
if (alreadyBanned == true)
|
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();
|
ParcelAccessEntry entry = new ParcelAccessEntry();
|
||||||
entry.AgentID = avataruuid;
|
entry.AgentID = avataruuid;
|
||||||
|
|
@ -237,7 +238,7 @@ namespace BetterSecondBot.HttpService
|
||||||
entry.Time = new System.DateTime(3030, 03, 03);
|
entry.Time = new System.DateTime(3030, 03, 03);
|
||||||
targetparcel.AccessBlackList.Add(entry);
|
targetparcel.AccessBlackList.Add(entry);
|
||||||
targetparcel.Update(bot.GetClient.Network.CurrentSim, false);
|
targetparcel.Update(bot.GetClient.Network.CurrentSim, false);
|
||||||
return BasicReply("ok");
|
return BasicReply("ok", "ParcelBan", new string[] { avatar });
|
||||||
}
|
}
|
||||||
|
|
||||||
[About("Unbans an avatar from a parcel")]
|
[About("Unbans an avatar from a parcel")]
|
||||||
|
|
@ -253,12 +254,12 @@ namespace BetterSecondBot.HttpService
|
||||||
KeyValuePair<bool, string> tests = SetupCurrentParcel(token, "parcel", "ParcelUnBan");
|
KeyValuePair<bool, string> tests = SetupCurrentParcel(token, "parcel", "ParcelUnBan");
|
||||||
if (tests.Key == false)
|
if (tests.Key == false)
|
||||||
{
|
{
|
||||||
return Failure(tests.Value);
|
return Failure(tests.Value, "ParcelUnBan", new string[] { avatar });
|
||||||
}
|
}
|
||||||
ProcessAvatar(avatar);
|
ProcessAvatar(avatar);
|
||||||
if (avataruuid == UUID.Zero)
|
if (avataruuid == UUID.Zero)
|
||||||
{
|
{
|
||||||
return Failure("Invaild avatar");
|
return Failure("Invaild avatar", "ParcelUnBan", new string[] { avatar });
|
||||||
}
|
}
|
||||||
bool alreadyBanned = false;
|
bool alreadyBanned = false;
|
||||||
ParcelAccessEntry removeentry = new ParcelAccessEntry();
|
ParcelAccessEntry removeentry = new ParcelAccessEntry();
|
||||||
|
|
@ -273,11 +274,11 @@ namespace BetterSecondBot.HttpService
|
||||||
}
|
}
|
||||||
if (alreadyBanned == false)
|
if (alreadyBanned == false)
|
||||||
{
|
{
|
||||||
return BasicReply("Avatar is already unbanned");
|
return BasicReply("Avatar is already unbanned", "ParcelUnBan", new string[] { avatar });
|
||||||
}
|
}
|
||||||
targetparcel.AccessBlackList.Remove(removeentry);
|
targetparcel.AccessBlackList.Remove(removeentry);
|
||||||
targetparcel.Update(bot.GetClient.Network.CurrentSim, false);
|
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<bool, string> tests = SetupCurrentParcel(token, "parcel", "SetParcelMusic");
|
KeyValuePair<bool, string> tests = SetupCurrentParcel(token, "parcel", "SetParcelMusic");
|
||||||
if (tests.Key == false)
|
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);
|
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")]
|
[About("Updates the current parcels name")]
|
||||||
|
|
@ -314,7 +315,7 @@ namespace BetterSecondBot.HttpService
|
||||||
KeyValuePair<bool, string> tests = SetupCurrentParcel(token, "parcel", "SetParcelFlag");
|
KeyValuePair<bool, string> tests = SetupCurrentParcel(token, "parcel", "SetParcelFlag");
|
||||||
if (tests.Key == false)
|
if (tests.Key == false)
|
||||||
{
|
{
|
||||||
return Failure(tests.Value);
|
return Failure(tests.Value, "SetParcelFlag", new string[] { escapedflagdata });
|
||||||
}
|
}
|
||||||
List<string> acceptablewords = new List<string>();
|
List<string> acceptablewords = new List<string>();
|
||||||
Dictionary<string, ParcelFlags> flags = parcel_static.get_flags_list();
|
Dictionary<string, ParcelFlags> flags = parcel_static.get_flags_list();
|
||||||
|
|
@ -343,11 +344,11 @@ namespace BetterSecondBot.HttpService
|
||||||
}
|
}
|
||||||
if (setflags.Count == 0)
|
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)
|
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<string, bool> cfg in setflags)
|
foreach (KeyValuePair<string, bool> cfg in setflags)
|
||||||
{
|
{
|
||||||
|
|
@ -357,7 +358,7 @@ namespace BetterSecondBot.HttpService
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
targetparcel.Update(bot.GetClient.Network.CurrentSim, false);
|
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")]
|
[About("Returns all objects from the current parcel for the selected avatar")]
|
||||||
|
|
@ -372,15 +373,15 @@ namespace BetterSecondBot.HttpService
|
||||||
KeyValuePair<bool, string> tests = SetupCurrentParcel(token, "parcel", "ParcelReturnTargeted");
|
KeyValuePair<bool, string> tests = SetupCurrentParcel(token, "parcel", "ParcelReturnTargeted");
|
||||||
if (tests.Key == false)
|
if (tests.Key == false)
|
||||||
{
|
{
|
||||||
return Failure(tests.Value);
|
return Failure(tests.Value, "ParcelReturnTargeted", new string[] { avatar });
|
||||||
}
|
}
|
||||||
ProcessAvatar(avatar);
|
ProcessAvatar(avatar);
|
||||||
if (avataruuid == UUID.Zero)
|
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<UUID>() { avataruuid });
|
bot.GetClient.Parcels.ReturnObjects(bot.GetClient.Network.CurrentSim, targetparcel.LocalID, ObjectReturnType.None, new List<UUID>() { avataruuid });
|
||||||
return BasicReply("ok");
|
return BasicReply("ok", "ParcelReturnTargeted", new string[] { avatar });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -393,24 +394,24 @@ namespace BetterSecondBot.HttpService
|
||||||
[Route(HttpVerbs.Get, "/ParcelDeedToGroup/{group}/{token}")]
|
[Route(HttpVerbs.Get, "/ParcelDeedToGroup/{group}/{token}")]
|
||||||
public object ParcelDeedToGroup(string group, string token)
|
public object ParcelDeedToGroup(string group, string token)
|
||||||
{
|
{
|
||||||
KeyValuePair<bool, string> tests = SetupCurrentParcel(token, "parcel", "ParcelReturnTargeted");
|
KeyValuePair<bool, string> tests = SetupCurrentParcel(token, "parcel", "ParcelDeedToGroup");
|
||||||
if (tests.Key == false)
|
if (tests.Key == false)
|
||||||
{
|
{
|
||||||
return Failure(tests.Value);
|
return Failure(tests.Value, "ParcelDeedToGroup", new string[] { group });
|
||||||
}
|
}
|
||||||
if (UUID.TryParse(group, out UUID groupuuid) == false)
|
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)
|
if (bot.MyGroups.ContainsKey(groupuuid) == false)
|
||||||
{
|
{
|
||||||
return Failure("Not in group");
|
return Failure("Not in group", "ParcelDeedToGroup", new string[] { group });
|
||||||
}
|
}
|
||||||
targetparcel.GroupID = groupuuid;
|
targetparcel.GroupID = groupuuid;
|
||||||
targetparcel.Update(bot.GetClient.Network.CurrentSim, false);
|
targetparcel.Update(bot.GetClient.Network.CurrentSim, false);
|
||||||
Thread.Sleep(500);
|
Thread.Sleep(500);
|
||||||
bot.GetClient.Parcels.DeedToGroup(bot.GetClient.Network.CurrentSim, targetparcel.LocalID, groupuuid);
|
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!")]
|
[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<bool, string> tests = SetupCurrentParcel(token, "parcel", "ParcelBuy");
|
KeyValuePair<bool, string> tests = SetupCurrentParcel(token, "parcel", "ParcelBuy");
|
||||||
if (tests.Key == false)
|
if (tests.Key == false)
|
||||||
{
|
{
|
||||||
return Failure(tests.Value);
|
return Failure(tests.Value, "ParcelBuy", new string[] { amount });
|
||||||
}
|
}
|
||||||
if (int.TryParse(amount, out int amountvalue) == false)
|
if (int.TryParse(amount, out int amountvalue) == false)
|
||||||
{
|
{
|
||||||
return Failure("Invaild amount");
|
return Failure("Invaild amount", "ParcelBuy", new string[] { amount });
|
||||||
}
|
}
|
||||||
if (amountvalue < 1)
|
if (amountvalue < 1)
|
||||||
{
|
{
|
||||||
return Failure("Invaild amount");
|
return Failure("Invaild amount", "ParcelBuy", new string[] { amount });
|
||||||
};
|
};
|
||||||
if (targetparcel.Flags.HasFlag(ParcelFlags.ForSale) == false)
|
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))
|
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)
|
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);
|
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")]
|
[About("Freezes an avatar")]
|
||||||
|
|
@ -466,19 +467,19 @@ namespace BetterSecondBot.HttpService
|
||||||
{
|
{
|
||||||
if (tokens.Allow(token, "parcel", "ParcelFreeze", handleGetClientIP()) == false)
|
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)
|
if(bool.TryParse(state, out bool freezestate) == false)
|
||||||
{
|
{
|
||||||
return Failure("Invaild state");
|
return Failure("Invaild state", "ParcelFreeze", new string[] { avatar, state });
|
||||||
}
|
}
|
||||||
ProcessAvatar(avatar);
|
ProcessAvatar(avatar);
|
||||||
if (avataruuid == UUID.Zero)
|
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);
|
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<bool, string> tests = SetupCurrentParcel(token, "parcel", "GetParcelBanlist");
|
KeyValuePair<bool, string> tests = SetupCurrentParcel(token, "parcel", "GetParcelBanlist");
|
||||||
if (tests.Key == false)
|
if (tests.Key == false)
|
||||||
{
|
{
|
||||||
return Failure(tests.Value);
|
return Failure(tests.Value, "GetParcelBanlist", new string[] { });
|
||||||
}
|
}
|
||||||
GetParcelBanlistObject reply = new GetParcelBanlistObject();
|
GetParcelBanlistObject reply = new GetParcelBanlistObject();
|
||||||
int delays = 0;
|
int delays = 0;
|
||||||
|
|
@ -525,7 +526,7 @@ namespace BetterSecondBot.HttpService
|
||||||
reply.delay = delays * 1000;
|
reply.delay = delays * 1000;
|
||||||
reply.parcelName = targetparcel.Name;
|
reply.parcelName = targetparcel.Name;
|
||||||
reply.regionName = bot.GetClient.Network.CurrentSim.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")]
|
[About("Returns a rezzed object")]
|
||||||
|
|
@ -538,11 +539,11 @@ namespace BetterSecondBot.HttpService
|
||||||
{
|
{
|
||||||
if (tokens.Allow(token, "parcel", "UnRezObject", handleGetClientIP()) == false)
|
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)
|
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;
|
bool found = false;
|
||||||
Dictionary<uint, Primitive> objects_copy = bot.GetClient.Network.CurrentSim.ObjectsPrimitives.Copy();
|
Dictionary<uint, Primitive> objects_copy = bot.GetClient.Network.CurrentSim.ObjectsPrimitives.Copy();
|
||||||
|
|
@ -557,9 +558,9 @@ namespace BetterSecondBot.HttpService
|
||||||
}
|
}
|
||||||
if(found == false)
|
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" +
|
[About("Updates the current parcels media settings \n" +
|
||||||
|
|
@ -582,7 +583,7 @@ namespace BetterSecondBot.HttpService
|
||||||
KeyValuePair<bool, string> tests = SetupCurrentParcel(token, "parcel", "ParcelSetMedia");
|
KeyValuePair<bool, string> tests = SetupCurrentParcel(token, "parcel", "ParcelSetMedia");
|
||||||
if (tests.Key == false)
|
if (tests.Key == false)
|
||||||
{
|
{
|
||||||
return Failure(tests.Value);
|
return Failure(tests.Value, "ParcelSetMedia", new string[] { escapedflagdata });
|
||||||
}
|
}
|
||||||
string[] args = escapedflagdata.Split(":::");
|
string[] args = escapedflagdata.Split(":::");
|
||||||
foreach (string A in args)
|
foreach (string A in args)
|
||||||
|
|
@ -643,7 +644,7 @@ namespace BetterSecondBot.HttpService
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
targetparcel.Update(bot.GetClient.Network.CurrentSim, false);
|
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)
|
protected bool UpdateParcel_MediaType(Parcel targetparcel, string value)
|
||||||
|
|
|
||||||
|
|
@ -25,12 +25,12 @@ namespace BetterSecondBot.HttpService
|
||||||
{
|
{
|
||||||
if (tokens.Allow(token, "self", "PointAt", handleGetClientIP()) == false)
|
if (tokens.Allow(token, "self", "PointAt", handleGetClientIP()) == false)
|
||||||
{
|
{
|
||||||
return Failure("Token not accepted");
|
return Failure("Token not accepted", "PointAt", new string[] { avatar });
|
||||||
}
|
}
|
||||||
ProcessAvatar(avatar);
|
ProcessAvatar(avatar);
|
||||||
if (bot.GetClient.Network.CurrentSim.AvatarPositions.ContainsKey(avataruuid) == false)
|
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.ResetAnimations();
|
||||||
bot.GetClient.Self.Stand();
|
bot.GetClient.Self.Stand();
|
||||||
|
|
@ -39,7 +39,7 @@ namespace BetterSecondBot.HttpService
|
||||||
bot.GetClient.Self.AnimationStart(Animations.POINT_YOU, true);
|
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.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());
|
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")]
|
[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)
|
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")
|
if(target == "ground")
|
||||||
{
|
{
|
||||||
bot.GetClient.Self.SitOnGround();
|
bot.GetClient.Self.SitOnGround();
|
||||||
return BasicReply("ok");
|
return BasicReply("ok", "Sit", new string[] { target });
|
||||||
}
|
}
|
||||||
if(UUID.TryParse(target,out UUID objectuuid) == false)
|
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);
|
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)")]
|
[About("Makes the bot stand up if sitting (also resets animations)")]
|
||||||
[ReturnHints("ok")]
|
[ReturnHints("ok")]
|
||||||
[Route(HttpVerbs.Get, "/Stand/{token}")]
|
[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)
|
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.GetClient.Self.Stand();
|
||||||
bot.ResetAnimations();
|
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")]
|
[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)
|
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)
|
if (UUID.TryParse(target, out UUID objectuuid) == false)
|
||||||
{
|
{
|
||||||
return Failure("Invaild object UUID");
|
return Failure("Invaild object UUID", "ClickObject", new string[] { target });
|
||||||
}
|
}
|
||||||
Dictionary<uint, Primitive> objectsentrys = bot.GetClient.Network.CurrentSim.ObjectsPrimitives.Copy();
|
Dictionary<uint, Primitive> objectsentrys = bot.GetClient.Network.CurrentSim.ObjectsPrimitives.Copy();
|
||||||
bool found_object = false;
|
bool found_object = false;
|
||||||
|
|
@ -107,7 +107,7 @@ namespace BetterSecondBot.HttpService
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return BasicReply(found_object.ToString());
|
return BasicReply(found_object.ToString(), "ClickObject", new string[] { target });
|
||||||
}
|
}
|
||||||
|
|
||||||
[About("Makes the bot kill itself you monster")]
|
[About("Makes the bot kill itself you monster")]
|
||||||
|
|
@ -117,14 +117,14 @@ namespace BetterSecondBot.HttpService
|
||||||
{
|
{
|
||||||
if (tokens.Allow(token, "self", "Logoff", handleGetClientIP()) == false)
|
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)
|
if (bot.KillMe == false)
|
||||||
{
|
{
|
||||||
bot.GetClient.Self.Chat("Laters im out", 0, ChatType.Normal);
|
bot.GetClient.Self.Chat("Laters im out", 0, ChatType.Normal);
|
||||||
bot.KillMePlease();
|
bot.KillMePlease();
|
||||||
}
|
}
|
||||||
return BasicReply("ok");
|
return BasicReply("ok", "Logoff", new string[] { });
|
||||||
}
|
}
|
||||||
|
|
||||||
[About("Makes the bot kill itself you monster")]
|
[About("Makes the bot kill itself you monster")]
|
||||||
|
|
@ -134,14 +134,14 @@ namespace BetterSecondBot.HttpService
|
||||||
{
|
{
|
||||||
if (tokens.Allow(token, "self", "Logout", handleGetClientIP()) == false)
|
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)
|
if (bot.KillMe == false)
|
||||||
{
|
{
|
||||||
bot.GetClient.Self.Chat("Laters im out", 0, ChatType.Normal);
|
bot.GetClient.Self.Chat("Laters im out", 0, ChatType.Normal);
|
||||||
bot.KillMePlease();
|
bot.KillMePlease();
|
||||||
}
|
}
|
||||||
return BasicReply("ok");
|
return BasicReply("ok", "Logout", new string[] { });
|
||||||
}
|
}
|
||||||
|
|
||||||
[About("Makes the bot kill itself you monster - without making a sound")]
|
[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)
|
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)
|
if (bot.KillMe == false)
|
||||||
{
|
{
|
||||||
bot.KillMePlease();
|
bot.KillMePlease();
|
||||||
}
|
}
|
||||||
return BasicReply("ok");
|
return BasicReply("ok", "Bye", new string[] { });
|
||||||
}
|
}
|
||||||
|
|
||||||
[About("Gets the last 5 commands issued to the bot")]
|
[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)
|
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);
|
return bot.GetLastCommands(5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -186,35 +187,35 @@ namespace BetterSecondBot.HttpService
|
||||||
{
|
{
|
||||||
if (tokens.Allow(token, "self", "SetPermFlag", handleGetClientIP()) == false)
|
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);
|
ProcessAvatar(avatar);
|
||||||
if (avataruuid == UUID.Zero)
|
if (avataruuid == UUID.Zero)
|
||||||
{
|
{
|
||||||
return Failure("avatar lookup");
|
return Failure("avatar lookup", "SetPermFlag", new string[] { avatar, flag, state, sticky });
|
||||||
}
|
}
|
||||||
bool stateflag = false;
|
bool stateflag = false;
|
||||||
bool stickyflag = false;
|
bool stickyflag = false;
|
||||||
if(bool.TryParse(state,out stateflag) == 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)
|
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" };
|
string[] AcceptedFlags = new string[] { "friend", "group", "animation", "teleport", "command" };
|
||||||
if (AcceptedFlags.Contains(flag) == true)
|
if (AcceptedFlags.Contains(flag) == true)
|
||||||
{
|
{
|
||||||
return Failure("Invaild flag");
|
return Failure("Invaild flag", "SetPermFlag", new string[] { avatar, flag, state, sticky });
|
||||||
}
|
}
|
||||||
if (stateflag == true)
|
if (stateflag == true)
|
||||||
{
|
{
|
||||||
bot.Add_action_from(flag, avataruuid, stickyflag);
|
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);
|
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 });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,15 +33,15 @@ namespace BetterSecondBot.HttpService
|
||||||
{
|
{
|
||||||
if (tokens.Allow(token, "streamadmin", "FetchNextNotecard", handleGetClientIP()) == false)
|
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)
|
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)
|
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";
|
string attempt_endpoint = endpoint + "endpoint.php";
|
||||||
|
|
@ -53,24 +53,24 @@ namespace BetterSecondBot.HttpService
|
||||||
IRestResponse endpoint_checks = client.Post(request);
|
IRestResponse endpoint_checks = client.Post(request);
|
||||||
if (endpoint_checks.StatusCode != System.Net.HttpStatusCode.OK)
|
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
|
try
|
||||||
{
|
{
|
||||||
notecardendpoint server_reply = JsonConvert.DeserializeObject<notecardendpoint>(endpoint_checks.Content);
|
notecardendpoint server_reply = JsonConvert.DeserializeObject<notecardendpoint>(endpoint_checks.Content);
|
||||||
if (server_reply.status == false)
|
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)
|
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)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
return Failure("Error: " + e.Message + "");
|
return Failure("Error: " + e.Message + "", "FetchNextNotecard", new string[] { endpoint, endpointcode });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -460,13 +460,20 @@ namespace BetterSecondBot.HttpService
|
||||||
UUID.TryParse(avatar, out avataruuid);
|
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 };
|
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 };
|
return new { reply = input, status = false };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,11 @@ namespace BetterSecondBotShared.bottypes
|
||||||
teleported = true;
|
teleported = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool TeleportStatus()
|
||||||
|
{
|
||||||
|
return teleported;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
protected Dictionary<string, string[]> custom_commands = new Dictionary<string, string[]>();
|
protected Dictionary<string, string[]> custom_commands = new Dictionary<string, string[]>();
|
||||||
public Dictionary<string, string[]> getCustomCommands { get { return custom_commands; } }
|
public Dictionary<string, string[]> getCustomCommands { get { return custom_commands; } }
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue