tidy up array string creation
This commit is contained in:
parent
2c6f37d358
commit
13cf967f84
34 changed files with 528 additions and 517 deletions
|
|
@ -119,7 +119,7 @@ namespace BetterSecondBot.BetterRelayService
|
|||
{
|
||||
JsonCustomRelays LoadedRelays = new JsonCustomRelays
|
||||
{
|
||||
CustomRelays = new string[] { "source-type:discord,source-filter:123451231235@12351312321,target-type:localchat,target-config:0" }
|
||||
CustomRelays = new [] { "source-type:discord,source-filter:123451231235@12351312321,target-type:localchat,target-config:0" }
|
||||
};
|
||||
string targetfile = "customrelays.json";
|
||||
SimpleIO io = new SimpleIO();
|
||||
|
|
@ -155,13 +155,13 @@ namespace BetterSecondBot.BetterRelayService
|
|||
|
||||
public void unattach_events()
|
||||
{
|
||||
controler.Bot.MessageEvent -= SLMessageHandler;
|
||||
controler.getBot().MessageEvent -= SLMessageHandler;
|
||||
superV.MessageEvent -= DiscordMessageHandler;
|
||||
}
|
||||
|
||||
protected void attach_events()
|
||||
{
|
||||
controler.Bot.MessageEvent += SLMessageHandler;
|
||||
controler.getBot().MessageEvent += SLMessageHandler;
|
||||
superV.MessageEvent += DiscordMessageHandler;
|
||||
}
|
||||
|
||||
|
|
@ -170,11 +170,26 @@ namespace BetterSecondBot.BetterRelayService
|
|||
protected async void TriggerRelay(string sourcetype, string name,string message, string filtervalue, string discordServerid, string discordChannelid)
|
||||
{
|
||||
List<relay_config> Dataset = new List<relay_config>();
|
||||
if (sourcetype == "localchat") Dataset = LocalchatRelay;
|
||||
else if (sourcetype == "groupchat") Dataset = GroupChatRelay;
|
||||
else if (sourcetype == "avatarim") Dataset = AvatarIMRelay;
|
||||
else if (sourcetype == "objectim") Dataset = ObjectIMRelay;
|
||||
else if (sourcetype == "discord") Dataset = DiscordRelay;
|
||||
if (sourcetype == "localchat")
|
||||
{
|
||||
Dataset = LocalchatRelay;
|
||||
}
|
||||
else if (sourcetype == "groupchat")
|
||||
{
|
||||
Dataset = GroupChatRelay;
|
||||
}
|
||||
else if (sourcetype == "avatarim")
|
||||
{
|
||||
Dataset = AvatarIMRelay;
|
||||
}
|
||||
else if (sourcetype == "objectim")
|
||||
{
|
||||
Dataset = ObjectIMRelay;
|
||||
}
|
||||
else if (sourcetype == "discord")
|
||||
{
|
||||
Dataset = DiscordRelay;
|
||||
}
|
||||
if(message.Contains("[relay]") == true)
|
||||
{
|
||||
return;
|
||||
|
|
@ -207,7 +222,7 @@ namespace BetterSecondBot.BetterRelayService
|
|||
{
|
||||
if ((cfga[0] + "@" + cfga[1]) != filtervalue)
|
||||
{
|
||||
await controler.Bot.SendMessageToDiscord(cfga[0], cfga[1], sendmessage, false);
|
||||
await controler.getBot().SendMessageToDiscord(cfga[0], cfga[1], sendmessage, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -232,7 +247,7 @@ namespace BetterSecondBot.BetterRelayService
|
|||
{
|
||||
int chan = 0;
|
||||
int.TryParse(cfg.targetvalue, out chan);
|
||||
controler.Bot.GetClient.Self.Chat(sendmessage, chan, ChatType.Normal);
|
||||
controler.getBot().GetClient.Self.Chat(sendmessage, chan, ChatType.Normal);
|
||||
}
|
||||
else if (cfg.targetname == "avatarchat")
|
||||
{
|
||||
|
|
@ -240,7 +255,7 @@ namespace BetterSecondBot.BetterRelayService
|
|||
{
|
||||
if (UUID.TryParse(cfg.targetvalue, out UUID target) == true)
|
||||
{
|
||||
controler.Bot.SendIM(target, sendmessage);
|
||||
controler.getBot().SendIM(target, sendmessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -248,16 +263,7 @@ namespace BetterSecondBot.BetterRelayService
|
|||
{
|
||||
if (cfg.targetvalue != filtervalue)
|
||||
{
|
||||
bool status = false;
|
||||
//bool status = controler.Bot.GetCommandsInterface.Call("groupchat", cfg.targetvalue + "~#~" + sendmessage, UUID.Zero, "~#~");
|
||||
if(status == false)
|
||||
{
|
||||
LogFormater.Info("sending via groupchat to group: " + cfg.targetvalue + " [Failed]");
|
||||
}
|
||||
else
|
||||
{
|
||||
LogFormater.Info("sending via groupchat to group: " + cfg.targetvalue+" [OK]");
|
||||
}
|
||||
controler.getBot().CallAPI("Groupchat", new[] { cfg.targetvalue, sendmessage });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,11 +15,16 @@ namespace BetterSecondBot
|
|||
{
|
||||
public bool Exited { get { return exitBot; } }
|
||||
protected bool exitBot = false;
|
||||
public SecondBot Bot;
|
||||
protected SecondBot Bot;
|
||||
protected BetterAtHome betterAtHomeService;
|
||||
protected BetterTracking betterTracking;
|
||||
protected Datastorage datastorage;
|
||||
|
||||
public SecondBot getBot()
|
||||
{
|
||||
return Bot;
|
||||
}
|
||||
|
||||
protected void keep_alive()
|
||||
{
|
||||
while (Bot.KillMe == false)
|
||||
|
|
|
|||
|
|
@ -197,13 +197,13 @@ namespace BetterSecondBot.DiscordSupervisor
|
|||
}
|
||||
Noticetitle = Noticetitle.Replace("!notice ", "");
|
||||
Noticetitle = Noticetitle.Trim();
|
||||
controler.Bot.CallAPI("Groupnotice", new string[] { Noticetitle, Noticemessage });
|
||||
controler.Bot.CallAPI("Groupnotice", new [] { Noticetitle, Noticemessage });
|
||||
await MarkMessage(message, "✅");
|
||||
}
|
||||
else
|
||||
{
|
||||
IGuildUser user = (IGuildUser)message.Author;
|
||||
controler.Bot.CallAPI("Groupchat", new string[] { group.ToString(), message.Content });
|
||||
controler.Bot.CallAPI("Groupchat", new [] { group.ToString(), message.Content });
|
||||
await MarkMessage(message, "✅");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,21 +50,21 @@ namespace BetterSecondBot.DiscordSupervisor
|
|||
}
|
||||
if(HasBasicBot() == true)
|
||||
{
|
||||
string newreply = controler.Bot.GetStatus();
|
||||
if(newreply != controler.Bot.LastStatusMessage)
|
||||
string newreply = controler.getBot().GetStatus();
|
||||
if(newreply != controler.getBot().LastStatusMessage)
|
||||
{
|
||||
controler.Bot.LastStatusMessage = newreply;
|
||||
controler.getBot().LastStatusMessage = newreply;
|
||||
}
|
||||
else
|
||||
{
|
||||
newreply = "";
|
||||
}
|
||||
reply = newreply + reply;
|
||||
if (controler.Bot.KillMe == true)
|
||||
if (controler.getBot().KillMe == true)
|
||||
{
|
||||
if (controler.Bot.GetClient.Network.Connected == true)
|
||||
if (controler.getBot().GetClient.Network.Connected == true)
|
||||
{
|
||||
controler.Bot.GetClient.Network.Logout();
|
||||
controler.getBot().GetClient.Network.Logout();
|
||||
}
|
||||
controler = null;
|
||||
reply = "[Discord-V: connected] (Logging out)";
|
||||
|
|
|
|||
|
|
@ -628,7 +628,7 @@ namespace BetterSecondBot.WikiMake
|
|||
}
|
||||
}
|
||||
}
|
||||
return new string[] { };
|
||||
return new [] { };
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -26,20 +26,20 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "animation", "addtoallowanimations", handleGetClientIP()) == false)
|
||||
{
|
||||
return BasicReply("Token not accepted", "addtoallowanimations", new string[] { avatar });
|
||||
return BasicReply("Token not accepted", "addtoallowanimations", new [] { avatar });
|
||||
}
|
||||
ProcessAvatar(avatar);
|
||||
if (avataruuid == UUID.Zero)
|
||||
{
|
||||
return BasicReply("avatar lookup", "addtoallowanimations", new string[] { avatar });
|
||||
return BasicReply("avatar lookup", "addtoallowanimations", new [] { avatar });
|
||||
}
|
||||
if (bot.Accept_action_from("animation", avataruuid) == false)
|
||||
{
|
||||
bot.Add_action_from("animation", avataruuid, bot.FindAvatarKey2Name(avataruuid));
|
||||
return BasicReply("Granted perm animation", "addtoallowanimations", new string[] { avatar });
|
||||
return BasicReply("Granted perm animation", "addtoallowanimations", new [] { avatar });
|
||||
}
|
||||
bot.Remove_action_from("animation", avataruuid, true);
|
||||
return BasicReply("Removed perm animation", "addtoallowanimations", new string[] { avatar });
|
||||
return BasicReply("Removed perm animation", "addtoallowanimations", new [] { avatar });
|
||||
}
|
||||
|
||||
[About("Attempts to play a gesture")]
|
||||
|
|
@ -51,15 +51,15 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "animation", "gesture", handleGetClientIP()) == false)
|
||||
{
|
||||
return BasicReply("Token not accepted", "gesture", new string[] { gesture });
|
||||
return BasicReply("Token not accepted", "gesture", new [] { gesture });
|
||||
}
|
||||
if (UUID.TryParse(gesture, out UUID gestureUUID) == false)
|
||||
{
|
||||
return BasicReply("Error with gesture", "gesture", new string[] { gesture });
|
||||
return BasicReply("Error with gesture", "gesture", new [] { gesture });
|
||||
}
|
||||
InventoryItem itm = bot.GetClient.Inventory.FetchItem(gestureUUID, bot.GetClient.Self.AgentID, (3 * 1000));
|
||||
bot.GetClient.Self.PlayGesture(itm.AssetUUID);
|
||||
return BasicReply("Accepted", "gesture", new string[] { gesture });
|
||||
return BasicReply("Accepted", "gesture", new [] { gesture });
|
||||
}
|
||||
|
||||
[About("Resets the animation stack for the bot")]
|
||||
|
|
@ -69,10 +69,10 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "animation", "resetanimations", handleGetClientIP()) == false)
|
||||
{
|
||||
return BasicReply("Token not accepted", "resetanimations", new string[] { });
|
||||
return BasicReply("Token not accepted", "resetanimations", new [] { });
|
||||
}
|
||||
bot.ResetAnimations();
|
||||
return BasicReply("Accepted", "resetanimations", new string[] { });
|
||||
return BasicReply("Accepted", "resetanimations", new [] { });
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,11 +24,11 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "avatars", "nearmewithdetails", handleGetClientIP()) == false)
|
||||
{
|
||||
return BasicReply("Token not accepted", "nearmewithdetails", new string[] { });
|
||||
return BasicReply("Token not accepted", "nearmewithdetails", new [] { });
|
||||
}
|
||||
if (bot.GetClient.Network.CurrentSim == null)
|
||||
{
|
||||
return BasicReply("Error not in a sim", "nearmewithdetails", new string[] { });
|
||||
return BasicReply("Error not in a sim", "nearmewithdetails", new [] { });
|
||||
}
|
||||
List<NearMeDetails> BetterNearMe = new List<NearMeDetails>();
|
||||
Dictionary<uint, Avatar> avcopy = bot.GetClient.Network.CurrentSim.ObjectsAvatars.Copy();
|
||||
|
|
@ -46,7 +46,7 @@ namespace BetterSecondBot.HttpService
|
|||
BetterNearMe.Add(details);
|
||||
}
|
||||
}
|
||||
return BasicReply(JsonConvert.SerializeObject(BetterNearMe), "nearmewithdetails", new string[] { });
|
||||
return BasicReply(JsonConvert.SerializeObject(BetterNearMe), "nearmewithdetails", new [] { });
|
||||
}
|
||||
|
||||
[About("returns a list of all known avatars nearby")]
|
||||
|
|
@ -57,11 +57,11 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "avatars", "nearme", handleGetClientIP()) == false)
|
||||
{
|
||||
return BasicReply("Token not accepted", "nearme", new string[] { });
|
||||
return BasicReply("Token not accepted", "nearme", new [] { });
|
||||
}
|
||||
if (bot.GetClient.Network.CurrentSim == null)
|
||||
{
|
||||
return BasicReply("Error not in a sim", "nearme", new string[] { });
|
||||
return BasicReply("Error not in a sim", "nearme", new [] { });
|
||||
}
|
||||
Dictionary<UUID, string> NearMe = new Dictionary<UUID, string>();
|
||||
Dictionary<uint, Avatar> avcopy = bot.GetClient.Network.CurrentSim.ObjectsAvatars.Copy();
|
||||
|
|
@ -72,7 +72,7 @@ namespace BetterSecondBot.HttpService
|
|||
NearMe.Add(av.ID, av.Name);
|
||||
}
|
||||
}
|
||||
return BasicReply(JsonConvert.SerializeObject(NearMe), "nearme", new string[] { });
|
||||
return BasicReply(JsonConvert.SerializeObject(NearMe), "nearme", new [] { });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,9 +23,9 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "chat", "LocalChatHistory", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "LocalChatHistory", new string[] { });
|
||||
return Failure("Token not accepted", "LocalChatHistory", new [] { });
|
||||
}
|
||||
return BasicReply(JsonConvert.SerializeObject(bot.getLocalChatHistory()), "LocalChatHistory", new string[] { });
|
||||
return BasicReply(JsonConvert.SerializeObject(bot.getLocalChatHistory()), "LocalChatHistory", new [] { });
|
||||
}
|
||||
|
||||
[About("sends a message to localchat")]
|
||||
|
|
@ -39,22 +39,22 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "chat", "Say", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "Say", new string[] { channel, message });
|
||||
return Failure("Token not accepted", "Say", new [] { channel, message });
|
||||
}
|
||||
if (helpers.isempty(message) == true)
|
||||
{
|
||||
return Failure("Message empty", "Say", new string[] { channel, message });
|
||||
return Failure("Message empty", "Say", new [] { channel, message });
|
||||
}
|
||||
if(int.TryParse(channel,out int channelnum) == false)
|
||||
{
|
||||
return Failure("Invaild channel", "Say", new string[] { channel, message });
|
||||
return Failure("Invaild channel", "Say", new [] { channel, message });
|
||||
}
|
||||
if(channelnum < 0)
|
||||
{
|
||||
return Failure("Invaild channel", "Say", new string[] { channel, message });
|
||||
return Failure("Invaild channel", "Say", new [] { channel, message });
|
||||
}
|
||||
bot.GetClient.Self.Chat(message, channelnum, ChatType.Normal);
|
||||
return BasicReply(JsonConvert.SerializeObject(bot.getLocalChatHistory()), "Say", new string[] { channel, message });
|
||||
return BasicReply(JsonConvert.SerializeObject(bot.getLocalChatHistory()), "Say", new [] { channel, message });
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -69,19 +69,19 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "chat", "IM", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "IM", new string[] { avatar, message });
|
||||
return Failure("Token not accepted", "IM", new [] { avatar, message });
|
||||
}
|
||||
ProcessAvatar(avatar);
|
||||
if(avataruuid == UUID.Zero)
|
||||
{
|
||||
return Failure("avatar lookup", "IM", new string[] { avatar, message });
|
||||
return Failure("avatar lookup", "IM", new [] { avatar, message });
|
||||
}
|
||||
if (helpers.isempty(message) == true)
|
||||
{
|
||||
return Failure("Message empty", "IM", new string[] { avatar, message });
|
||||
return Failure("Message empty", "IM", new [] { avatar, message });
|
||||
}
|
||||
bot.SendIM(avataruuid, message);
|
||||
return BasicReply("ok", "IM", new string[] { avatar, message });
|
||||
return BasicReply("ok", "IM", new [] { avatar, message });
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,10 +39,10 @@ namespace BetterSecondBot.HttpService
|
|||
if (hash == authcode)
|
||||
{
|
||||
string newtoken = tokens.CreateToken(handleGetClientIP());
|
||||
if(newtoken != null) return BasicReply(newtoken, "GetToken", new string[] { authcode, unixtimegiven });
|
||||
if(newtoken != null) return BasicReply(newtoken, "GetToken", new [] { authcode, unixtimegiven });
|
||||
}
|
||||
}
|
||||
return Failure("Authcode not accepted", "GetToken", new string[] { authcode, unixtimegiven });
|
||||
return Failure("Authcode not accepted", "GetToken", new [] { authcode, unixtimegiven });
|
||||
}
|
||||
|
||||
[About("Used to check HTTP connections")]
|
||||
|
|
@ -51,7 +51,7 @@ namespace BetterSecondBot.HttpService
|
|||
[Route(HttpVerbs.Get, "/Hello")]
|
||||
public object Hello()
|
||||
{
|
||||
return BasicReply("world", "Hello", new string[] { });
|
||||
return BasicReply("world", "Hello", new [] { });
|
||||
}
|
||||
|
||||
[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)
|
||||
{
|
||||
return Failure("Token not accepted", "Delay", new string[] { amount });
|
||||
return Failure("Token not accepted", "Delay", new [] { amount });
|
||||
}
|
||||
if(int.TryParse(amount,out int amountvalue) == false)
|
||||
{
|
||||
return Failure("Invaild amount", "Delay", new string[] { amount });
|
||||
return Failure("Invaild amount", "Delay", new [] { amount });
|
||||
}
|
||||
Thread.Sleep(amountvalue);
|
||||
return BasicReply("Ok", "Delay", new string[] { amount });
|
||||
return BasicReply("Ok", "Delay", new [] { amount });
|
||||
}
|
||||
|
||||
[About("Removes the given token from the accepted token pool")]
|
||||
|
|
@ -80,9 +80,9 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "core", "LogoutUI", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "LogoutUI", new string[] { });
|
||||
return Failure("Token not accepted", "LogoutUI", new [] { });
|
||||
}
|
||||
SuccessNoReturn("LogoutUI", new string[] { });
|
||||
SuccessNoReturn("LogoutUI", new [] { });
|
||||
return tokens.Expire(token);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,32 +28,32 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "dialogs", "DialogRelay", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "DialogRelay", new string[] { target });
|
||||
return Failure("Token not accepted", "DialogRelay", new [] { target });
|
||||
}
|
||||
if (target == "clear")
|
||||
{
|
||||
bot.SetRelayDialogsAvatar(UUID.Zero);
|
||||
bot.SetRelayDialogsChannel(0);
|
||||
bot.SetRelayDialogsHTTP("");
|
||||
return BasicReply("cleared", "DialogRelay", new string[] { target });
|
||||
return BasicReply("cleared", "DialogRelay", new [] { target });
|
||||
}
|
||||
ProcessAvatar(target);
|
||||
if (avataruuid != UUID.Zero)
|
||||
{
|
||||
bot.SetRelayDialogsAvatar(avataruuid);
|
||||
return BasicReply("set/avatar", "DialogRelay", new string[] { target });
|
||||
return BasicReply("set/avatar", "DialogRelay", new [] { target });
|
||||
}
|
||||
if (target.StartsWith("http") == true)
|
||||
{
|
||||
bot.SetRelayDialogsHTTP(target);
|
||||
return BasicReply("set/http", "DialogRelay", new string[] { target });
|
||||
return BasicReply("set/http", "DialogRelay", new [] { target });
|
||||
}
|
||||
if (int.TryParse(target, out int channel) == true)
|
||||
{
|
||||
bot.SetRelayDialogsChannel(channel);
|
||||
return BasicReply("set/channel", "DialogRelay", new string[] { target });
|
||||
return BasicReply("set/channel", "DialogRelay", new [] { target });
|
||||
}
|
||||
return Failure("Not a vaild option", "DialogRelay", new string[] { target });
|
||||
return Failure("Not a vaild option", "DialogRelay", new [] { target });
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -67,13 +67,13 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "dialogs", "DialogResponce", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "DialogResponce", new string[] { dialogid, buttontext });
|
||||
return Failure("Token not accepted", "DialogResponce", new [] { dialogid, buttontext });
|
||||
}
|
||||
if (int.TryParse(dialogid, out int dialogidnum) == false)
|
||||
{
|
||||
return Failure("bad dialog id", "DialogResponce", new string[] { dialogid, buttontext });
|
||||
return Failure("bad dialog id", "DialogResponce", new [] { dialogid, buttontext });
|
||||
}
|
||||
return BasicReply(bot.DialogReply(dialogidnum, buttontext).ToString(), "DialogResponce", new string[] { dialogid, buttontext });
|
||||
return BasicReply(bot.DialogReply(dialogidnum, buttontext).ToString(), "DialogResponce", new [] { dialogid, buttontext });
|
||||
}
|
||||
|
||||
[About("Should the bot track dialogs and send them to the relays setup?")]
|
||||
|
|
@ -85,14 +85,14 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "dialogs", "DialogTrack", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "DialogTrack", new string[] { status });
|
||||
return Failure("Token not accepted", "DialogTrack", new [] { status });
|
||||
}
|
||||
if (bool.TryParse(status, out bool statuscode) == false)
|
||||
{
|
||||
return Failure("bad status", "DialogTrack", new string[] { status });
|
||||
return Failure("bad status", "DialogTrack", new [] { status });
|
||||
}
|
||||
bot.SetTrackDialogs(statuscode);
|
||||
return BasicReply("updated", "DialogTrack", new string[] { status });
|
||||
return BasicReply("updated", "DialogTrack", new [] { status });
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,13 +32,13 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "discord", "Discord_AddRole", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "Discord_AddRole", new string[] { serverid, roleid, memberid });
|
||||
return Failure("Token not accepted", "Discord_AddRole", new [] { serverid, roleid, memberid });
|
||||
}
|
||||
if (bot.discordReady() == false)
|
||||
{
|
||||
return Failure("Discord client not ready", "Discord_AddRole", new string[] { serverid, roleid, memberid });
|
||||
return Failure("Discord client not ready", "Discord_AddRole", new [] { serverid, roleid, memberid });
|
||||
}
|
||||
return BasicReply(addRoleToMember(serverid, roleid, memberid).Result.ToString(), "Discord_AddRole", new string[] { serverid, roleid, memberid });
|
||||
return BasicReply(addRoleToMember(serverid, roleid, memberid).Result.ToString(), "Discord_AddRole", new [] { serverid, roleid, memberid });
|
||||
}
|
||||
|
||||
[About("Adds the selected user to the ban list - Disallows rejoining untill they are removed from the list")]
|
||||
|
|
@ -53,17 +53,17 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "discord", "Discord_BanMember", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "Discord_BanMember", new string[] { serverid, memberid, why });
|
||||
return Failure("Token not accepted", "Discord_BanMember", new [] { serverid, memberid, why });
|
||||
}
|
||||
if (bot.discordReady() == false)
|
||||
{
|
||||
return Failure("Discord client not ready", "Discord_BanMember", new string[] { serverid, memberid, why });
|
||||
return Failure("Discord client not ready", "Discord_BanMember", new [] { serverid, memberid, why });
|
||||
}
|
||||
if (helpers.notempty(why) == false)
|
||||
{
|
||||
return Failure("Why empty", "Discord_BanMember", new string[] { serverid, memberid, why });
|
||||
return Failure("Why empty", "Discord_BanMember", new [] { serverid, memberid, why });
|
||||
}
|
||||
return BasicReply(BanMember(serverid, memberid, why).Result.ToString(), "Discord_BanMember", new string[] { serverid, memberid, why });
|
||||
return BasicReply(BanMember(serverid, memberid, why).Result.ToString(), "Discord_BanMember", new [] { serverid, memberid, why });
|
||||
}
|
||||
|
||||
[About("Clears messages on the server sent by the member in the last 13 days, 22hours 59mins")]
|
||||
|
|
@ -76,13 +76,13 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "discord", "Discord_BulkClear_Messages", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "Discord_BulkClear_Messages", new string[] { serverid, memberid });
|
||||
return Failure("Token not accepted", "Discord_BulkClear_Messages", new [] { serverid, memberid });
|
||||
}
|
||||
if (bot.discordReady() == false)
|
||||
{
|
||||
return Failure("Discord client not ready", "Discord_BulkClear_Messages", new string[] { serverid, memberid });
|
||||
return Failure("Discord client not ready", "Discord_BulkClear_Messages", new [] { serverid, memberid });
|
||||
}
|
||||
SuccessNoReturn("Discord_BulkClear_Messages", new string[] { serverid, memberid });
|
||||
SuccessNoReturn("Discord_BulkClear_Messages", new [] { serverid, memberid });
|
||||
return ClearMessages(serverid, memberid).Result;
|
||||
}
|
||||
|
||||
|
|
@ -97,13 +97,13 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "discord", "Discord_Dm_Member", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "Discord_Dm_Member", new string[] { serverid, memberid, message });
|
||||
return Failure("Token not accepted", "Discord_Dm_Member", new [] { serverid, memberid, message });
|
||||
}
|
||||
if (bot.discordReady() == false)
|
||||
{
|
||||
return Failure("Discord client not ready", "Discord_Dm_Member", new string[] { serverid, memberid, message });
|
||||
return Failure("Discord client not ready", "Discord_Dm_Member", new [] { serverid, memberid, message });
|
||||
}
|
||||
return BasicReply(MessageMember(serverid, memberid, message).Result.ToString(), "Discord_Dm_Member", new string[] { serverid, memberid, message });
|
||||
return BasicReply(MessageMember(serverid, memberid, message).Result.ToString(), "Discord_Dm_Member", new [] { 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" +
|
||||
|
|
@ -117,13 +117,13 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "discord", "Discord_MembersList", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "Discord_MembersList", new string[] { serverid });
|
||||
return Failure("Token not accepted", "Discord_MembersList", new [] { serverid });
|
||||
}
|
||||
if (bot.discordReady() == false)
|
||||
{
|
||||
return Failure("Discord client not ready", "Discord_MembersList", new string[] { serverid });
|
||||
return Failure("Discord client not ready", "Discord_MembersList", new [] { serverid });
|
||||
}
|
||||
SuccessNoReturn("Discord_MembersList", new string[] { serverid });
|
||||
SuccessNoReturn("Discord_MembersList", new [] { serverid });
|
||||
return ListMembers(serverid).Result;
|
||||
}
|
||||
|
||||
|
|
@ -139,17 +139,17 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "discord", "Discord_MessageChannel", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "Discord_MessageChannel", new string[] { serverid, channelid, tts, message });
|
||||
return Failure("Token not accepted", "Discord_MessageChannel", new [] { serverid, channelid, tts, message });
|
||||
}
|
||||
if (bot.discordReady() == false)
|
||||
{
|
||||
return Failure("Discord client not ready", "Discord_MessageChannel", new string[] { serverid, channelid, tts, message });
|
||||
return Failure("Discord client not ready", "Discord_MessageChannel", new [] { serverid, channelid, tts, message });
|
||||
}
|
||||
if (helpers.notempty(message) == false)
|
||||
{
|
||||
return Failure("message empty", "Discord_MessageChannel", new string[] { serverid, channelid, tts, message });
|
||||
return Failure("message empty", "Discord_MessageChannel", new [] { serverid, channelid, tts, message });
|
||||
}
|
||||
return BasicReply(MessageChannel(serverid, channelid, message, tts).Result.ToString(), "Discord_MessageChannel", new string[] { serverid, channelid, tts, message });
|
||||
return BasicReply(MessageChannel(serverid, channelid, message, tts).Result.ToString(), "Discord_MessageChannel", new [] { serverid, channelid, tts, message });
|
||||
}
|
||||
|
||||
[About("Sends a message to the selected channel - Optional TTS usage")]
|
||||
|
|
@ -163,13 +163,13 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "discord", "Discord_MuteMember", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "Discord_MuteMember", new string[] { serverid, memberid, mode });
|
||||
return Failure("Token not accepted", "Discord_MuteMember", new [] { serverid, memberid, mode });
|
||||
}
|
||||
if (bot.discordReady() == false)
|
||||
{
|
||||
return Failure("Discord client not ready", "Discord_MuteMember", new string[] { serverid, memberid, mode });
|
||||
return Failure("Discord client not ready", "Discord_MuteMember", new [] { serverid, memberid, mode });
|
||||
}
|
||||
return BasicReply(MuteMember(serverid, memberid, mode).Result.ToString(), "Discord_MuteMember", new string[] { serverid, memberid, mode });
|
||||
return BasicReply(MuteMember(serverid, memberid, mode).Result.ToString(), "Discord_MuteMember", new [] { serverid, memberid, mode });
|
||||
}
|
||||
|
||||
[About("returns a collection of settings for the given role \n This command requires Discord full client mode enabled and connected")]
|
||||
|
|
@ -183,13 +183,13 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "discord", "Discord_Role_GetSettings", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "Discord_Role_GetSettings", new string[] { serverid, roleid });
|
||||
return Failure("Token not accepted", "Discord_Role_GetSettings", new [] { serverid, roleid });
|
||||
}
|
||||
if (bot.discordReady() == false)
|
||||
{
|
||||
return Failure("Discord client not ready", "Discord_Role_GetSettings", new string[] { serverid, roleid });
|
||||
return Failure("Discord client not ready", "Discord_Role_GetSettings", new [] { serverid, roleid });
|
||||
}
|
||||
SuccessNoReturn("Discord_Role_GetSettings", new string[] { serverid, roleid });
|
||||
SuccessNoReturn("Discord_Role_GetSettings", new [] { serverid, roleid });
|
||||
return RoleSettings(serverid,roleid);
|
||||
}
|
||||
|
||||
|
|
@ -205,13 +205,13 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "discord", "Discord_Role_UpdatePerms", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "Discord_Role_UpdatePerms", new string[] { serverid, roleid, flagscsv });
|
||||
return Failure("Token not accepted", "Discord_Role_UpdatePerms", new [] { serverid, roleid, flagscsv });
|
||||
}
|
||||
if (bot.discordReady() == false)
|
||||
{
|
||||
return Failure("Discord client not ready", "Discord_Role_UpdatePerms", new string[] { serverid, roleid, flagscsv });
|
||||
return Failure("Discord client not ready", "Discord_Role_UpdatePerms", new [] { serverid, roleid, flagscsv });
|
||||
}
|
||||
return BasicReply(UpdateRolePerms(serverid, roleid, flagscsv).Result.ToString(), "Discord_Role_UpdatePerms", new string[] { serverid, roleid, flagscsv });
|
||||
return BasicReply(UpdateRolePerms(serverid, roleid, flagscsv).Result.ToString(), "Discord_Role_UpdatePerms", new [] { 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" +
|
||||
|
|
@ -225,13 +225,13 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "discord", "Discord_RoleCreate", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "Discord_RoleCreate", new string[] { serverid, role });
|
||||
return Failure("Token not accepted", "Discord_RoleCreate", new [] { serverid, role });
|
||||
}
|
||||
if (bot.discordReady() == false)
|
||||
{
|
||||
return Failure("Discord client not ready", "Discord_RoleCreate", new string[] { serverid, role });
|
||||
return Failure("Discord client not ready", "Discord_RoleCreate", new [] { serverid, role });
|
||||
}
|
||||
SuccessNoReturn("Discord_RoleCreate", new string[] { serverid, role });
|
||||
SuccessNoReturn("Discord_RoleCreate", new [] { serverid, role });
|
||||
return CreateRole(serverid,role).Result;
|
||||
}
|
||||
|
||||
|
|
@ -244,13 +244,13 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "discord", "Discord_RoleList", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "Discord_RoleList", new string[] { serverid });
|
||||
return Failure("Token not accepted", "Discord_RoleList", new [] { serverid });
|
||||
}
|
||||
if (bot.discordReady() == false)
|
||||
{
|
||||
return Failure("Discord client not ready", "Discord_RoleList", new string[] { serverid });
|
||||
return Failure("Discord client not ready", "Discord_RoleList", new [] { serverid });
|
||||
}
|
||||
return BasicReply(ListRoles(serverid).ToString(), "Discord_RoleList", new string[] { serverid });
|
||||
return BasicReply(ListRoles(serverid).ToString(), "Discord_RoleList", new [] { serverid });
|
||||
}
|
||||
|
||||
[About("Remove a role from a server \n This command requires Discord full client mode enabled and connected")]
|
||||
|
|
@ -262,13 +262,13 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "discord", "Discord_RoleRemove", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "Discord_RoleRemove", new string[] { serverid, roleid });
|
||||
return Failure("Token not accepted", "Discord_RoleRemove", new [] { serverid, roleid });
|
||||
}
|
||||
if (bot.discordReady() == false)
|
||||
{
|
||||
return Failure("Discord client not ready", "Discord_RoleRemove", new string[] { serverid, roleid });
|
||||
return Failure("Discord client not ready", "Discord_RoleRemove", new [] { serverid, roleid });
|
||||
}
|
||||
return BasicReply(RemoveRole(serverid, roleid).Result.ToString(), "Discord_RoleRemove", new string[] { serverid, roleid });
|
||||
return BasicReply(RemoveRole(serverid, roleid).Result.ToString(), "Discord_RoleRemove", new [] { serverid, roleid });
|
||||
}
|
||||
|
||||
[About("Returns a list of text channels in a server")]
|
||||
|
|
@ -280,11 +280,11 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "discord", "Discord_TextChannels_List", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "Discord_TextChannels_List", new string[] { serverid });
|
||||
return Failure("Token not accepted", "Discord_TextChannels_List", new [] { serverid });
|
||||
}
|
||||
if (bot.discordReady() == false)
|
||||
{
|
||||
return Failure("Discord client not ready", "Discord_TextChannels_List", new string[] { serverid });
|
||||
return Failure("Discord client not ready", "Discord_TextChannels_List", new [] { serverid });
|
||||
}
|
||||
return ListTextChannels(serverid);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,17 +30,17 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "estate", "SimRestart", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "SimRestart", new string[] { delay, mode });
|
||||
return Failure("Token not accepted", "SimRestart", new [] { delay, mode });
|
||||
}
|
||||
if (bot.GetClient.Network.CurrentSim.IsEstateManager == false)
|
||||
{
|
||||
return Failure("Not an estate manager here", "SimRestart", new string[] { delay, mode });
|
||||
return Failure("Not an estate manager here", "SimRestart", new [] { delay, mode });
|
||||
}
|
||||
bool.TryParse(mode, out bool modeflag);
|
||||
if (modeflag == false)
|
||||
{
|
||||
bot.GetClient.Estate.CancelRestart();
|
||||
return BasicReply("canceled", "SimRestart", new string[] { delay, mode });
|
||||
return BasicReply("canceled", "SimRestart", new [] { delay, mode });
|
||||
}
|
||||
int delay_restart = 60;
|
||||
int.TryParse(delay, out delay_restart);
|
||||
|
|
@ -49,7 +49,7 @@ namespace BetterSecondBot.HttpService
|
|||
delay_restart = 240;
|
||||
}
|
||||
bot.GetClient.Estate.RestartRegion(delay_restart);
|
||||
return BasicReply("restarting", "SimRestart", new string[] { delay, mode });
|
||||
return BasicReply("restarting", "SimRestart", new [] { delay, mode });
|
||||
}
|
||||
|
||||
[About("Sends the message to the current sim")]
|
||||
|
|
@ -62,18 +62,18 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "estate", "SimMessage", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "SimMessage", new string[] { message });
|
||||
return Failure("Token not accepted", "SimMessage", new [] { message });
|
||||
}
|
||||
if (helpers.notempty(message) == false)
|
||||
{
|
||||
return Failure("Message empty", "SimMessage", new string[] { message });
|
||||
return Failure("Message empty", "SimMessage", new [] { message });
|
||||
}
|
||||
if (bot.GetClient.Network.CurrentSim.IsEstateManager == false)
|
||||
{
|
||||
return Failure("Not an estate manager here", "SimMessage", new string[] { message });
|
||||
return Failure("Not an estate manager here", "SimMessage", new [] { message });
|
||||
}
|
||||
bot.GetClient.Estate.SimulatorMessage(message);
|
||||
return BasicReply("ok", "SimMessage", new string[] { message });
|
||||
return BasicReply("ok", "SimMessage", new [] { message });
|
||||
}
|
||||
|
||||
[About("Fetchs the regions map tile")]
|
||||
|
|
@ -85,13 +85,13 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "estate", "GetSimTexture", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "GetSimTexture", new string[] { regionname });
|
||||
return Failure("Token not accepted", "GetSimTexture", new [] { regionname });
|
||||
}
|
||||
if (bot.GetClient.Grid.GetGridRegion(regionname, GridLayerType.Objects, out GridRegion region) == false)
|
||||
{
|
||||
return Failure("Unable to find region", "GetSimTexture", new string[] { regionname });
|
||||
return Failure("Unable to find region", "GetSimTexture", new [] { regionname });
|
||||
}
|
||||
return BasicReply(region.MapImageID.ToString(), "GetSimTexture", new string[] { regionname });
|
||||
return BasicReply(region.MapImageID.ToString(), "GetSimTexture", new [] { regionname });
|
||||
}
|
||||
|
||||
[About("Reclaims ownership of the current parcel")]
|
||||
|
|
@ -102,15 +102,15 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "estate", "EstateParcelReclaim", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "EstateParcelReclaim", new string[] { });
|
||||
return Failure("Token not accepted", "EstateParcelReclaim", new [] { });
|
||||
}
|
||||
if (bot.GetClient.Network.CurrentSim.IsEstateManager == false)
|
||||
{
|
||||
return Failure("Not an estate manager here", "EstateParcelReclaim", new string[] { });
|
||||
return Failure("Not an estate manager here", "EstateParcelReclaim", new [] { });
|
||||
}
|
||||
int localid = bot.GetClient.Parcels.GetParcelLocalID(bot.GetClient.Network.CurrentSim, bot.GetClient.Self.SimPosition);
|
||||
bot.GetClient.Parcels.Reclaim(bot.GetClient.Network.CurrentSim, localid);
|
||||
return BasicReply("ok", "EstateParcelReclaim", new string[] { });
|
||||
return BasicReply("ok", "EstateParcelReclaim", new [] { });
|
||||
}
|
||||
|
||||
[About("Reclaims ownership of the current parcel")]
|
||||
|
|
@ -121,17 +121,17 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "estate", "GetSimGlobalPos", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "GetSimGlobalPos", new string[] { regionname });
|
||||
return Failure("Token not accepted", "GetSimGlobalPos", new [] { regionname });
|
||||
}
|
||||
if (bot.GetClient.Grid.GetGridRegion(regionname, GridLayerType.Objects, out GridRegion region) == false)
|
||||
{
|
||||
return Failure("Unable to find region", "GetSimGlobalPos", new string[] { regionname });
|
||||
return Failure("Unable to find region", "GetSimGlobalPos", new [] { regionname });
|
||||
}
|
||||
Dictionary<string, string> reply = new Dictionary<string, string>();
|
||||
reply.Add("region", regionname);
|
||||
reply.Add("X", region.X.ToString());
|
||||
reply.Add("Y", region.Y.ToString());
|
||||
SuccessNoReturn("GetSimGlobalPos", new string[] { regionname });
|
||||
SuccessNoReturn("GetSimGlobalPos", new [] { regionname });
|
||||
return reply;
|
||||
}
|
||||
|
||||
|
|
@ -142,9 +142,9 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "estate", "banlist", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "banlist", new string[] { });
|
||||
return Failure("Token not accepted", "banlist", new [] { });
|
||||
}
|
||||
return BasicReply(JsonConvert.SerializeObject(bot._lastUpdatedSimBlacklist), "banlist", new string[] { });
|
||||
return BasicReply(JsonConvert.SerializeObject(bot._lastUpdatedSimBlacklist), "banlist", new [] { });
|
||||
}
|
||||
|
||||
[About("Attempts to add/remove the avatar to/from the Estate banlist")]
|
||||
|
|
@ -162,29 +162,29 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "estate", "UpdateEstateBanlist", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "UpdateEstateBanlist", new string[] { avatar, mode, global });
|
||||
return Failure("Token not accepted", "UpdateEstateBanlist", new [] { avatar, mode, global });
|
||||
}
|
||||
if (bot.GetClient.Network.CurrentSim.IsEstateManager == false)
|
||||
{
|
||||
return Failure("Not an estate manager on region " + bot.GetClient.Network.CurrentSim.Name, "UpdateEstateBanlist", new string[] { avatar, mode, global });
|
||||
return Failure("Not an estate manager on region " + bot.GetClient.Network.CurrentSim.Name, "UpdateEstateBanlist", new [] { avatar, mode, global });
|
||||
}
|
||||
UUID avataruuid = UUID.Zero;
|
||||
if (UUID.TryParse(avatar, out avataruuid) == false)
|
||||
{
|
||||
return Failure("Unable to find avatar UUID", "UpdateEstateBanlist", new string[] { avatar, mode, global });
|
||||
return Failure("Unable to find avatar UUID", "UpdateEstateBanlist", new [] { avatar, mode, global });
|
||||
}
|
||||
bool globalban = false;
|
||||
if (bool.TryParse(global, out globalban) == false)
|
||||
{
|
||||
return Failure("Unable to process global value please use true or false", "UpdateEstateBanlist", new string[] { avatar, mode, global });
|
||||
return Failure("Unable to process global value please use true or false", "UpdateEstateBanlist", new [] { avatar, mode, global });
|
||||
}
|
||||
if (mode != "add")
|
||||
{
|
||||
bot.GetClient.Estate.UnbanUser(avataruuid, globalban);
|
||||
return BasicReply("Unban request accepted", "UpdateEstateBanlist", new string[] { avatar, mode, global });
|
||||
return BasicReply("Unban request accepted", "UpdateEstateBanlist", new [] { avatar, mode, global });
|
||||
}
|
||||
bot.GetClient.Estate.BanUser(avataruuid, globalban);
|
||||
return BasicReply("Ban request accepted", "UpdateEstateBanlist", new string[] { avatar, mode, global });
|
||||
return BasicReply("Ban request accepted", "UpdateEstateBanlist", new [] { avatar, mode, global });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,9 +23,9 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "friends", "Friendslist", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "Friendslist", new string[] { });
|
||||
return Failure("Token not accepted", "Friendslist", new [] { });
|
||||
}
|
||||
return BasicReply(bot.getJsonFriendlist(), "Friendslist", new string[] { });
|
||||
return BasicReply(bot.getJsonFriendlist(), "Friendslist", new [] { });
|
||||
}
|
||||
|
||||
[About("Updates the friend perms for avatar avatar to State \n if true grants (Online/Map/Modify) perms")]
|
||||
|
|
@ -41,29 +41,29 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "friends", "FriendFullPerms", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "FriendFullPerms", new string[] { avatar , state });
|
||||
return Failure("Token not accepted", "FriendFullPerms", new [] { avatar , state });
|
||||
}
|
||||
ProcessAvatar(avatar);
|
||||
if (avataruuid == UUID.Zero)
|
||||
{
|
||||
return Failure("avatar lookup", "FriendFullPerms", new string[] { avatar, state });
|
||||
return Failure("avatar lookup", "FriendFullPerms", new [] { avatar, state });
|
||||
}
|
||||
bool status = false;
|
||||
if (bool.TryParse(state, out status) == false)
|
||||
{
|
||||
return Failure("state invaild", "FriendFullPerms", new string[] { avatar, state });
|
||||
return Failure("state invaild", "FriendFullPerms", new [] { avatar, state });
|
||||
}
|
||||
if (bot.GetClient.Friends.FriendList.ContainsKey(avataruuid) == false)
|
||||
{
|
||||
return Failure("Not A friend", "FriendFullPerms", new string[] { avatar, state });
|
||||
return Failure("Not A friend", "FriendFullPerms", new [] { avatar, state });
|
||||
}
|
||||
if (status == true)
|
||||
{
|
||||
bot.GetClient.Friends.GrantRights(avataruuid, FriendRights.CanSeeOnline | FriendRights.CanSeeOnMap | FriendRights.CanModifyObjects);
|
||||
return BasicReply("granted", "FriendFullPerms", new string[] { avatar, state });
|
||||
return BasicReply("granted", "FriendFullPerms", new [] { avatar, state });
|
||||
}
|
||||
bot.GetClient.Friends.GrantRights(avataruuid, FriendRights.None);
|
||||
return BasicReply("removed", "FriendFullPerms", new string[] { avatar, state });
|
||||
return BasicReply("removed", "FriendFullPerms", new [] { avatar, state });
|
||||
}
|
||||
|
||||
[About("Updates the friend perms for avatar avatar to State \n if true grants (Online/Map/Modify) perms")]
|
||||
|
|
@ -80,32 +80,32 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "friends", "FriendRequest", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "FriendRequest", new string[] { avatar, state });
|
||||
return Failure("Token not accepted", "FriendRequest", new [] { avatar, state });
|
||||
}
|
||||
ProcessAvatar(avatar);
|
||||
if (avataruuid == UUID.Zero)
|
||||
{
|
||||
return Failure("avatar lookup", "FriendRequest", new string[] { avatar, state });
|
||||
return Failure("avatar lookup", "FriendRequest", new [] { avatar, state });
|
||||
}
|
||||
bool status = false;
|
||||
if (bool.TryParse(state, out status) == false)
|
||||
{
|
||||
return Failure("state invaild", "FriendRequest", new string[] { avatar, state });
|
||||
return Failure("state invaild", "FriendRequest", new [] { avatar, state });
|
||||
}
|
||||
if (bot.GetClient.Friends.FriendList.ContainsKey(avataruuid) == true)
|
||||
{
|
||||
if (status == false)
|
||||
{
|
||||
bot.GetClient.Friends.TerminateFriendship(avataruuid);
|
||||
return BasicReply("Removed", "FriendRequest", new string[] { avatar, state });
|
||||
return BasicReply("Removed", "FriendRequest", new [] { avatar, state });
|
||||
}
|
||||
}
|
||||
if (status == false)
|
||||
{
|
||||
return Failure("Not in friendslist", "FriendRequest", new string[] { avatar, state });
|
||||
return Failure("Not in friendslist", "FriendRequest", new [] { avatar, state });
|
||||
}
|
||||
bot.GetClient.Friends.OfferFriendship(avataruuid);
|
||||
return BasicReply("Request sent", "FriendRequest", new string[] { avatar, state });
|
||||
return BasicReply("Request sent", "FriendRequest", new [] { avatar, state });
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,14 +24,14 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "funds", "Balance", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "Balance", new string[] { });
|
||||
return Failure("Token not accepted", "Balance", new [] { });
|
||||
}
|
||||
if (bot.GetAllowFunds == false)
|
||||
{
|
||||
return Failure("Funds commands are disabled", "Balance", new string[] { });
|
||||
return Failure("Funds commands are disabled", "Balance", new [] { });
|
||||
}
|
||||
bot.GetClient.Self.RequestBalance();
|
||||
return BasicReply(bot.GetClient.Self.Balance.ToString(), "Balance", new string[] { });
|
||||
return BasicReply(bot.GetClient.Self.Balance.ToString(), "Balance", new [] { });
|
||||
}
|
||||
|
||||
[About("Makes the bot pay a avatar")]
|
||||
|
|
@ -47,27 +47,27 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "funds", "PayAvatar", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "PayAvatar", new string[] { avatar, amount });
|
||||
return Failure("Token not accepted", "PayAvatar", new [] { avatar, amount });
|
||||
}
|
||||
if (bot.GetAllowFunds == false)
|
||||
{
|
||||
return Failure("Transfer funds to avatars disabled", "PayAvatar", new string[] { avatar, amount });
|
||||
return Failure("Transfer funds to avatars disabled", "PayAvatar", new [] { avatar, amount });
|
||||
}
|
||||
ProcessAvatar(avatar);
|
||||
if (avataruuid == UUID.Zero)
|
||||
{
|
||||
return BasicReply("avatar lookup", "PayAvatar", new string[] { avatar, amount });
|
||||
return BasicReply("avatar lookup", "PayAvatar", new [] { avatar, amount });
|
||||
}
|
||||
if (int.TryParse(amount, out int amountvalue) == false)
|
||||
{
|
||||
return Failure("Invaild amount", "PayAvatar", new string[] { avatar, amount });
|
||||
return Failure("Invaild amount", "PayAvatar", new [] { avatar, amount });
|
||||
}
|
||||
if ((amountvalue < 0) || (amountvalue > bot.GetClient.Self.Balance))
|
||||
{
|
||||
return Failure("Amount out of range", "PayAvatar", new string[] { avatar, amount });
|
||||
return Failure("Amount out of range", "PayAvatar", new [] { avatar, amount });
|
||||
}
|
||||
bot.GetClient.Self.GiveAvatarMoney(avataruuid, amountvalue);
|
||||
return BasicReply("Accepted", "PayAvatar", new string[] { avatar, amount });
|
||||
return BasicReply("Accepted", "PayAvatar", new [] { avatar, amount });
|
||||
}
|
||||
|
||||
[About("Makes the bot pay a object")]
|
||||
|
|
@ -86,30 +86,30 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "funds", "PayObject", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "PayObject", new string[] { objectuuid, primname, amount });
|
||||
return Failure("Token not accepted", "PayObject", new [] { objectuuid, primname, amount });
|
||||
}
|
||||
if (bot.GetAllowFunds == false)
|
||||
{
|
||||
return Failure("Funds commands are disabled", "PayObject", new string[] { objectuuid, primname, amount });
|
||||
return Failure("Funds commands are disabled", "PayObject", new [] { objectuuid, primname, amount });
|
||||
}
|
||||
if (UUID.TryParse(objectuuid, out UUID objectUUID) == false)
|
||||
{
|
||||
return Failure("Invaild object UUID", "PayObject", new string[] { objectuuid, primname, amount });
|
||||
return Failure("Invaild object UUID", "PayObject", new [] { objectuuid, primname, amount });
|
||||
}
|
||||
if (int.TryParse(amount, out int amountvalue) == false)
|
||||
{
|
||||
return Failure("Invaild amount", "PayObject", new string[] { objectuuid, primname, amount });
|
||||
return Failure("Invaild amount", "PayObject", new [] { objectuuid, primname, amount });
|
||||
}
|
||||
if((amountvalue < 0) || (amountvalue > bot.GetClient.Self.Balance))
|
||||
{
|
||||
return Failure("Amount out of range", "PayObject", new string[] { objectuuid, primname, amount });
|
||||
return Failure("Amount out of range", "PayObject", new [] { objectuuid, primname, amount });
|
||||
}
|
||||
if(helpers.notempty(primname) == false)
|
||||
{
|
||||
return Failure("Primname is empty", "PayObject", new string[] { objectuuid, primname, amount });
|
||||
return Failure("Primname is empty", "PayObject", new [] { objectuuid, primname, amount });
|
||||
}
|
||||
bot.GetClient.Self.GiveObjectMoney(objectUUID, amountvalue, primname);
|
||||
return BasicReply("ok", "PayObject", new string[] { objectuuid, primname, amount });
|
||||
return BasicReply("ok", "PayObject", new [] { objectuuid, primname, amount });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,15 +31,15 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "groups", "IsGroupMember", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "IsGroupMember", new string[] { group, avatar });
|
||||
return Failure("Token not accepted", "IsGroupMember", new [] { group, avatar });
|
||||
}
|
||||
if (UUID.TryParse(group, out UUID groupuuid) == false)
|
||||
{
|
||||
return Failure("Invaild group UUID", "IsGroupMember", new string[] { group, avatar });
|
||||
return Failure("Invaild group UUID", "IsGroupMember", new [] { group, avatar });
|
||||
}
|
||||
if (bot.MyGroups.ContainsKey(groupuuid) == false)
|
||||
{
|
||||
return Failure("Unknown group", "IsGroupMember", new string[] { group, avatar });
|
||||
return Failure("Unknown group", "IsGroupMember", new [] { group, avatar });
|
||||
}
|
||||
if (bot.NeedReloadGroupData(groupuuid) == true)
|
||||
{
|
||||
|
|
@ -49,14 +49,14 @@ namespace BetterSecondBot.HttpService
|
|||
KeyValuePair<bool, string> reply = waitForReady(true, true, groupuuid);
|
||||
if (reply.Key == false)
|
||||
{
|
||||
return Failure(reply.Value, "IsGroupMember", new string[] { group, avatar });
|
||||
return Failure(reply.Value, "IsGroupMember", new [] { group, avatar });
|
||||
}
|
||||
IsGroupMemberReply replyobject = new IsGroupMemberReply();
|
||||
replyobject.membershipStatus = bot.FastCheckInGroup(groupuuid, avataruuid);
|
||||
replyobject.AvatarUUID = avataruuid.ToString();
|
||||
replyobject.AvatarnameIfKnown = bot.FindAvatarKey2Name(avataruuid);
|
||||
replyobject.GroupUUID = groupuuid.ToString();
|
||||
return BasicReply(JsonConvert.SerializeObject(replyobject), "IsGroupMember", new string[] { group, avatar });
|
||||
return BasicReply(JsonConvert.SerializeObject(replyobject), "IsGroupMember", new [] { group, avatar });
|
||||
}
|
||||
|
||||
[About("Gets membership of a group")]
|
||||
|
|
@ -71,15 +71,15 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "groups", "GetGroupMembers", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "GetGroupMembers", new string[] { group });
|
||||
return Failure("Token not accepted", "GetGroupMembers", new [] { group });
|
||||
}
|
||||
if (UUID.TryParse(group, out UUID groupuuid) == false)
|
||||
{
|
||||
return Failure("Invaild group UUID", "GetGroupMembers", new string[] { group });
|
||||
return Failure("Invaild group UUID", "GetGroupMembers", new [] { group });
|
||||
}
|
||||
if (bot.MyGroups.ContainsKey(groupuuid) == false)
|
||||
{
|
||||
return Failure("Unknown group", "GetGroupMembers", new string[] { group });
|
||||
return Failure("Unknown group", "GetGroupMembers", new [] { group });
|
||||
}
|
||||
if (bot.NeedReloadGroupData(groupuuid) == true)
|
||||
{
|
||||
|
|
@ -88,9 +88,9 @@ namespace BetterSecondBot.HttpService
|
|||
KeyValuePair<bool, string> reply = waitForReady(false, true, groupuuid);
|
||||
if (reply.Key == false)
|
||||
{
|
||||
return Failure(reply.Value, "GetGroupMembers", new string[] { group });
|
||||
return Failure(reply.Value, "GetGroupMembers", new [] { group });
|
||||
}
|
||||
SuccessNoReturn("GetGroupMembers", new string[] { group });
|
||||
SuccessNoReturn("GetGroupMembers", new [] { group });
|
||||
return bot.GetGroupMembers(groupuuid);
|
||||
}
|
||||
|
||||
|
|
@ -109,29 +109,29 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "groups", "GroupBan", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "GroupBan", new string[] { group,avatar,state });
|
||||
return Failure("Token not accepted", "GroupBan", new [] { group,avatar,state });
|
||||
}
|
||||
if (UUID.TryParse(group, out UUID groupuuid) == false)
|
||||
{
|
||||
return Failure("Invaild group UUID", "GroupBan", new string[] { group, avatar, state });
|
||||
return Failure("Invaild group UUID", "GroupBan", new [] { group, avatar, state });
|
||||
}
|
||||
if (bot.MyGroups.ContainsKey(groupuuid) == false)
|
||||
{
|
||||
return Failure("Unknown group", "GroupBan", new string[] { group, avatar, state });
|
||||
return Failure("Unknown group", "GroupBan", new [] { group, avatar, state });
|
||||
}
|
||||
Group G = bot.MyGroups[groupuuid];
|
||||
if (G.Powers.HasFlag(GroupPowers.GroupBanAccess) == false)
|
||||
{
|
||||
return Failure("Missing group GroupBanAccess power", "GroupBan", new string[] { group, avatar, state });
|
||||
return Failure("Missing group GroupBanAccess power", "GroupBan", new [] { group, avatar, state });
|
||||
}
|
||||
if (bool.TryParse(state, out bool banstate) == false)
|
||||
{
|
||||
return Failure("Invaild ban state", "GroupBan", new string[] { group, avatar, state });
|
||||
return Failure("Invaild ban state", "GroupBan", new [] { group, avatar, state });
|
||||
}
|
||||
ProcessAvatar(avatar);
|
||||
if(avataruuid == UUID.Zero)
|
||||
{
|
||||
return Failure("avatar lookup", "GroupBan", new string[] { group, avatar, state });
|
||||
return Failure("avatar lookup", "GroupBan", new [] { group, avatar, state });
|
||||
}
|
||||
GroupBanAction action = GroupBanAction.Unban;
|
||||
string statename = "Unban";
|
||||
|
|
@ -141,7 +141,7 @@ namespace BetterSecondBot.HttpService
|
|||
statename = "Ban";
|
||||
}
|
||||
bot.GetClient.Groups.RequestBanAction(groupuuid, action, new UUID[] { avataruuid });
|
||||
return BasicReply(statename+" request accepted", "GroupBan", new string[] { group, avatar, state });
|
||||
return BasicReply(statename+" request accepted", "GroupBan", new [] { group, avatar, state });
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -161,28 +161,28 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "groups", "GroupEject", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "GroupEject", new string[] { group, avatar });
|
||||
return Failure("Token not accepted", "GroupEject", new [] { group, avatar });
|
||||
}
|
||||
if (UUID.TryParse(group, out UUID groupuuid) == false)
|
||||
{
|
||||
return Failure("Invaild group UUID", "GroupEject", new string[] { group, avatar });
|
||||
return Failure("Invaild group UUID", "GroupEject", new [] { group, avatar });
|
||||
}
|
||||
if (bot.MyGroups.ContainsKey(groupuuid) == false)
|
||||
{
|
||||
return Failure("Unknown group", "GroupEject", new string[] { group, avatar });
|
||||
return Failure("Unknown group", "GroupEject", new [] { group, avatar });
|
||||
}
|
||||
Group G = bot.MyGroups[groupuuid];
|
||||
if (G.Powers.HasFlag(GroupPowers.Eject) == false)
|
||||
{
|
||||
return Failure("Missing group Eject power", "GroupEject", new string[] { group, avatar });
|
||||
return Failure("Missing group Eject power", "GroupEject", new [] { group, avatar });
|
||||
}
|
||||
ProcessAvatar(avatar);
|
||||
if (avataruuid == UUID.Zero)
|
||||
{
|
||||
return Failure("avatar lookup", "GroupEject", new string[] { group, avatar });
|
||||
return Failure("avatar lookup", "GroupEject", new [] { group, avatar });
|
||||
}
|
||||
bot.GetClient.Groups.EjectUser(groupuuid, avataruuid);
|
||||
return BasicReply("Requested", "GroupEject", new string[] { group, avatar });
|
||||
return BasicReply("Requested", "GroupEject", new [] { 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")]
|
||||
|
|
@ -201,19 +201,19 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "groups", "GroupAddRole", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "GroupAddRole", new string[] { group, avatar });
|
||||
return Failure("Token not accepted", "GroupAddRole", new [] { group, avatar });
|
||||
}
|
||||
if (UUID.TryParse(group, out UUID groupuuid) == false)
|
||||
{
|
||||
return Failure("Invaild group UUID", "GroupAddRole", new string[] { group, avatar });
|
||||
return Failure("Invaild group UUID", "GroupAddRole", new [] { group, avatar });
|
||||
}
|
||||
if (UUID.TryParse(role, out UUID roleuuid) == false)
|
||||
{
|
||||
return Failure("Invaild role UUID", "GroupAddRole", new string[] { group, avatar });
|
||||
return Failure("Invaild role UUID", "GroupAddRole", new [] { group, avatar });
|
||||
}
|
||||
if (bot.MyGroups.ContainsKey(groupuuid) == false)
|
||||
{
|
||||
return Failure("Unknown group", "GroupAddRole", new string[] { group, avatar });
|
||||
return Failure("Unknown group", "GroupAddRole", new [] { group, avatar });
|
||||
}
|
||||
if (bot.NeedReloadGroupData(groupuuid) == true)
|
||||
{
|
||||
|
|
@ -223,16 +223,16 @@ namespace BetterSecondBot.HttpService
|
|||
KeyValuePair<bool, string> reply = waitForReady(true, true, groupuuid);
|
||||
if (reply.Key == false)
|
||||
{
|
||||
return Failure(reply.Value, "GroupAddRole", new string[] { group, avatar });
|
||||
return Failure(reply.Value, "GroupAddRole", new [] { group, avatar });
|
||||
}
|
||||
bool status = bot.FastCheckInGroup(groupuuid, avataruuid);
|
||||
if (status == false)
|
||||
{
|
||||
bot.GetClient.Groups.Invite(groupuuid, new List<UUID>() { roleuuid }, avataruuid);
|
||||
return BasicReply("Invite sent", "GroupAddRole", new string[] { group, avatar });
|
||||
return BasicReply("Invite sent", "GroupAddRole", new [] { group, avatar });
|
||||
}
|
||||
bot.GetClient.Groups.AddToRole(groupuuid, roleuuid, avataruuid);
|
||||
return BasicReply("Roles updated", "GroupAddRole", new string[] { group, avatar });
|
||||
return BasicReply("Roles updated", "GroupAddRole", new [] { group, avatar });
|
||||
}
|
||||
|
||||
[About("Eject selected avatar from group")]
|
||||
|
|
@ -251,15 +251,15 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "groups", "GroupInvite", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "GroupInvite", new string[] { group, avatar, role });
|
||||
return Failure("Token not accepted", "GroupInvite", new [] { group, avatar, role });
|
||||
}
|
||||
if (UUID.TryParse(group, out UUID groupuuid) == false)
|
||||
{
|
||||
return Failure("Invaild group UUID", "GroupInvite", new string[] { group, avatar, role });
|
||||
return Failure("Invaild group UUID", "GroupInvite", new [] { group, avatar, role });
|
||||
}
|
||||
if (bot.MyGroups.ContainsKey(groupuuid) == false)
|
||||
{
|
||||
return Failure("Unknown group", "GroupInvite", new string[] { group, avatar, role });
|
||||
return Failure("Unknown group", "GroupInvite", new [] { group, avatar, role });
|
||||
}
|
||||
if (bot.NeedReloadGroupData(groupuuid) == true)
|
||||
{
|
||||
|
|
@ -268,12 +268,12 @@ namespace BetterSecondBot.HttpService
|
|||
ProcessAvatar(avatar);
|
||||
if (avataruuid == UUID.Zero)
|
||||
{
|
||||
return Failure("avatar lookup", "GroupInvite", new string[] { group, avatar, role });
|
||||
return Failure("avatar lookup", "GroupInvite", new [] { group, avatar, role });
|
||||
}
|
||||
bool status = bot.FastCheckInGroup(groupuuid, avataruuid);
|
||||
if (status == true)
|
||||
{
|
||||
return Failure("Already in group", "GroupInvite", new string[] { group, avatar, role });
|
||||
return Failure("Already in group", "GroupInvite", new [] { group, avatar, role });
|
||||
}
|
||||
if(role == "everyone")
|
||||
{
|
||||
|
|
@ -281,15 +281,15 @@ namespace BetterSecondBot.HttpService
|
|||
}
|
||||
if(UUID.TryParse(role,out UUID roleuuid) == false)
|
||||
{
|
||||
return Failure("Unable to process role UUID", "GroupInvite", new string[] { group, avatar, role });
|
||||
return Failure("Unable to process role UUID", "GroupInvite", new [] { group, avatar, role });
|
||||
}
|
||||
Group G = bot.MyGroups[groupuuid];
|
||||
if(G.Powers.HasFlag(GroupPowers.Invite) == false)
|
||||
{
|
||||
return Failure("Missing group invite power", "GroupInvite", new string[] { group, avatar, role });
|
||||
return Failure("Missing group invite power", "GroupInvite", new [] { group, avatar, role });
|
||||
}
|
||||
bot.GetClient.Groups.Invite(groupuuid, new List<UUID>() { roleuuid }, avataruuid);
|
||||
return BasicReply("Invite sent", "GroupInvite", new string[] { group, avatar, role });
|
||||
return BasicReply("Invite sent", "GroupInvite", new [] { group, avatar, role });
|
||||
}
|
||||
|
||||
[About("Sends a group notice (No attachments please use GroupnoticeWithAttachment to attach items!)")]
|
||||
|
|
@ -307,35 +307,35 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "groups", "Groupnotice", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "Groupnotice", new string[] { group, title, message });
|
||||
return Failure("Token not accepted", "Groupnotice", new [] { group, title, message });
|
||||
}
|
||||
if (UUID.TryParse(group, out UUID groupuuid) == false)
|
||||
{
|
||||
return Failure("Invaild group UUID", "Groupnotice", new string[] { group, title, message });
|
||||
return Failure("Invaild group UUID", "Groupnotice", new [] { group, title, message });
|
||||
}
|
||||
if (bot.MyGroups.ContainsKey(groupuuid) == false)
|
||||
{
|
||||
return Failure("Unknown group", "Groupnotice", new string[] { group, title, message });
|
||||
return Failure("Unknown group", "Groupnotice", new [] { group, title, message });
|
||||
}
|
||||
if (helpers.notempty(title) == false)
|
||||
{
|
||||
return Failure("Title empty", "Groupnotice", new string[] { group, title, message });
|
||||
return Failure("Title empty", "Groupnotice", new [] { group, title, message });
|
||||
}
|
||||
if (helpers.notempty(message) == false)
|
||||
{
|
||||
return Failure("Message empty", "Groupnotice", new string[] { group, title, message });
|
||||
return Failure("Message empty", "Groupnotice", new [] { group, title, message });
|
||||
}
|
||||
Group G = bot.MyGroups[groupuuid];
|
||||
if (G.Powers.HasFlag(GroupPowers.SendNotices) == false)
|
||||
{
|
||||
return Failure("Missing group notice power", "Groupnotice", new string[] { group, title, message });
|
||||
return Failure("Missing group notice power", "Groupnotice", new [] { group, title, message });
|
||||
}
|
||||
GroupNotice NewNotice = new GroupNotice();
|
||||
NewNotice.Subject = title;
|
||||
NewNotice.Message = message;
|
||||
NewNotice.OwnerID = bot.GetClient.Self.AgentID;
|
||||
bot.GetClient.Groups.SendGroupNotice(groupuuid, NewNotice);
|
||||
return BasicReply("Sending notice", "Groupnotice", new string[] { group, title, message });
|
||||
return BasicReply("Sending notice", "Groupnotice", new [] { group, title, message });
|
||||
}
|
||||
|
||||
[About("Activates the selected title")]
|
||||
|
|
@ -350,22 +350,22 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "groups", "GroupActiveTitle", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "GroupActiveTitle", new string[] { group, role });
|
||||
return Failure("Token not accepted", "GroupActiveTitle", new [] { group, role });
|
||||
}
|
||||
if (UUID.TryParse(group, out UUID groupuuid) == false)
|
||||
{
|
||||
return Failure("Invaild group UUID", "GroupActiveTitle", new string[] { group, role });
|
||||
return Failure("Invaild group UUID", "GroupActiveTitle", new [] { group, role });
|
||||
}
|
||||
if (UUID.TryParse(role, out UUID roleuuid) == false)
|
||||
{
|
||||
return Failure("Invaild role UUID", "GroupActiveTitle", new string[] { group, role });
|
||||
return Failure("Invaild role UUID", "GroupActiveTitle", new [] { group, role });
|
||||
}
|
||||
if (bot.MyGroups.ContainsKey(groupuuid) == false)
|
||||
{
|
||||
return Failure("Unknown group", "GroupActiveTitle", new string[] { group, role });
|
||||
return Failure("Unknown group", "GroupActiveTitle", new [] { group, role });
|
||||
}
|
||||
bot.GetClient.Groups.ActivateTitle(groupuuid, roleuuid);
|
||||
return BasicReply("Switching title", "GroupActiveTitle", new string[] { group, role });
|
||||
return BasicReply("Switching title", "GroupActiveTitle", new [] { group, role });
|
||||
}
|
||||
|
||||
[About("Sets the selected group to the active group")]
|
||||
|
|
@ -378,18 +378,18 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "groups", "GroupActiveGroup", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "GroupActiveGroup", new string[] { group });
|
||||
return Failure("Token not accepted", "GroupActiveGroup", new [] { group });
|
||||
}
|
||||
if (UUID.TryParse(group, out UUID groupuuid) == false)
|
||||
{
|
||||
return Failure("Invaild group UUID", "GroupActiveGroup", new string[] { group });
|
||||
return Failure("Invaild group UUID", "GroupActiveGroup", new [] { group });
|
||||
}
|
||||
if (bot.MyGroups.ContainsKey(groupuuid) == false)
|
||||
{
|
||||
return Failure("Unknown group", "GroupActiveGroup", new string[] { group });
|
||||
return Failure("Unknown group", "GroupActiveGroup", new [] { group });
|
||||
}
|
||||
bot.GetClient.Groups.ActivateGroup(groupuuid);
|
||||
return BasicReply("Switching active group", "GroupActiveGroup", new string[] { group });
|
||||
return BasicReply("Switching active group", "GroupActiveGroup", new [] { group });
|
||||
}
|
||||
|
||||
[About("Sends a group notice with an attachment")]
|
||||
|
|
@ -409,32 +409,32 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "groups", "GroupnoticeWithAttachment", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "GroupnoticeWithAttachment", new string[] { group, title, message, attachment });
|
||||
return Failure("Token not accepted", "GroupnoticeWithAttachment", new [] { group, title, message, attachment });
|
||||
}
|
||||
if (UUID.TryParse(group, out UUID groupuuid) == false)
|
||||
{
|
||||
return Failure("Invaild group UUID", "GroupnoticeWithAttachment", new string[] { group, title, message, attachment });
|
||||
return Failure("Invaild group UUID", "GroupnoticeWithAttachment", new [] { group, title, message, attachment });
|
||||
}
|
||||
if (UUID.TryParse(attachment, out UUID inventoryuuid) == false)
|
||||
{
|
||||
return Failure("Invaild inventory UUID", "GroupnoticeWithAttachment", new string[] { group, title, message, attachment });
|
||||
return Failure("Invaild inventory UUID", "GroupnoticeWithAttachment", new [] { group, title, message, attachment });
|
||||
}
|
||||
if (bot.MyGroups.ContainsKey(groupuuid) == false)
|
||||
{
|
||||
return Failure("Unknown group", "GroupnoticeWithAttachment", new string[] { group, title, message, attachment });
|
||||
return Failure("Unknown group", "GroupnoticeWithAttachment", new [] { group, title, message, attachment });
|
||||
}
|
||||
if (helpers.notempty(title) == false)
|
||||
{
|
||||
return Failure("Title empty", "GroupnoticeWithAttachment", new string[] { group, title, message, attachment });
|
||||
return Failure("Title empty", "GroupnoticeWithAttachment", new [] { group, title, message, attachment });
|
||||
}
|
||||
if (helpers.notempty(message) == false)
|
||||
{
|
||||
return Failure("Message empty", "GroupnoticeWithAttachment", new string[] { group, title, message, attachment });
|
||||
return Failure("Message empty", "GroupnoticeWithAttachment", new [] { group, title, message, attachment });
|
||||
}
|
||||
Group G = bot.MyGroups[groupuuid];
|
||||
if (G.Powers.HasFlag(GroupPowers.SendNotices) == false)
|
||||
{
|
||||
return Failure("Missing group notice power", "GroupnoticeWithAttachment", new string[] { group, title, message, attachment });
|
||||
return Failure("Missing group notice power", "GroupnoticeWithAttachment", new [] { group, title, message, attachment });
|
||||
}
|
||||
GroupNotice NewNotice = new GroupNotice();
|
||||
NewNotice.Subject = title;
|
||||
|
|
@ -442,7 +442,7 @@ namespace BetterSecondBot.HttpService
|
|||
NewNotice.OwnerID = bot.GetClient.Self.AgentID;
|
||||
NewNotice.AttachmentID = inventoryuuid;
|
||||
bot.GetClient.Groups.SendGroupNotice(groupuuid, NewNotice);
|
||||
return BasicReply("Sending notice with attachment", "GroupnoticeWithAttachment", new string[] { group, title, message, attachment });
|
||||
return BasicReply("Sending notice with attachment", "GroupnoticeWithAttachment", new [] { group, title, message, attachment });
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -453,14 +453,14 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "groups", "GetGroupList", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "GetGroupList", new string[] {});
|
||||
return Failure("Token not accepted", "GetGroupList", new [] {});
|
||||
}
|
||||
Dictionary<string, string> grouppackage = new Dictionary<string, string>();
|
||||
foreach (KeyValuePair<UUID, Group> entry in bot.MyGroups)
|
||||
{
|
||||
grouppackage.Add(entry.Value.ID.ToString(), entry.Value.Name);
|
||||
}
|
||||
return BasicReply(JsonConvert.SerializeObject(grouppackage), "GetGroupList", new string[] { });
|
||||
return BasicReply(JsonConvert.SerializeObject(grouppackage), "GetGroupList", new [] { });
|
||||
}
|
||||
|
||||
[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/>")]
|
||||
|
|
@ -474,15 +474,15 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "groups", "GetGroupRoles", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "GetGroupRoles", new string[] { group });
|
||||
return Failure("Token not accepted", "GetGroupRoles", new [] { group });
|
||||
}
|
||||
if (UUID.TryParse(group, out UUID groupuuid) == false)
|
||||
{
|
||||
return Failure("Invaild group UUID", "GetGroupRoles", new string[] { group });
|
||||
return Failure("Invaild group UUID", "GetGroupRoles", new [] { group });
|
||||
}
|
||||
if (bot.MyGroups.ContainsKey(groupuuid) == false)
|
||||
{
|
||||
return Failure("Unknown group", "GetGroupRoles", new string[] { group });
|
||||
return Failure("Unknown group", "GetGroupRoles", new [] { group });
|
||||
}
|
||||
GroupRoleDetails reply = new GroupRoleDetails();
|
||||
reply.UpdateUnderway = false;
|
||||
|
|
@ -510,10 +510,10 @@ namespace BetterSecondBot.HttpService
|
|||
bot.GetClient.Groups.RequestGroupRoles(groupuuid);
|
||||
if (reply.Roles.Count == 0)
|
||||
{
|
||||
return Failure("Updating", "GetGroupRoles", new string[] { group });
|
||||
return Failure("Updating", "GetGroupRoles", new [] { group });
|
||||
}
|
||||
}
|
||||
return BasicReply(JsonConvert.SerializeObject(reply), "GetGroupRoles", new string[] { group });
|
||||
return BasicReply(JsonConvert.SerializeObject(reply), "GetGroupRoles", new [] { group });
|
||||
}
|
||||
|
||||
[About("fetchs a list of all groups with unread messages")]
|
||||
|
|
@ -523,9 +523,9 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "groups", "GroupchatListAllUnreadGroups", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "GroupchatListAllUnreadGroups", new string[] { });
|
||||
return Failure("Token not accepted", "GroupchatListAllUnreadGroups", new [] { });
|
||||
}
|
||||
return BasicReply(JsonConvert.SerializeObject(bot.UnreadGroupchatGroups()), "GroupchatListAllUnreadGroups", new string[] { });
|
||||
return BasicReply(JsonConvert.SerializeObject(bot.UnreadGroupchatGroups()), "GroupchatListAllUnreadGroups", new [] { });
|
||||
}
|
||||
|
||||
[About("fetchs a list of all groups with unread messages")]
|
||||
|
|
@ -539,18 +539,18 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "groups", "GroupchatGroupHasUnread", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "GroupchatGroupHasUnread", new string[] { group });
|
||||
return Failure("Token not accepted", "GroupchatGroupHasUnread", new [] { group });
|
||||
}
|
||||
UUID groupUUID = UUID.Zero;
|
||||
if(UUID.TryParse(group,out groupUUID) == false)
|
||||
{
|
||||
return Failure("group value is invaild", "GroupchatGroupHasUnread", new string[] { group });
|
||||
return Failure("group value is invaild", "GroupchatGroupHasUnread", new [] { group });
|
||||
}
|
||||
if(bot.MyGroups.ContainsKey(groupUUID) == false)
|
||||
{
|
||||
return Failure("Unknown group", "GroupchatGroupHasUnread", new string[] { group });
|
||||
return Failure("Unknown group", "GroupchatGroupHasUnread", new [] { group });
|
||||
}
|
||||
return BasicReply(bot.GroupHasUnread(groupUUID).ToString(), "GroupchatGroupHasUnread", new string[] { group });
|
||||
return BasicReply(bot.GroupHasUnread(groupUUID).ToString(), "GroupchatGroupHasUnread", new [] { group });
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -561,9 +561,9 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "groups", "GroupchatAnyUnread", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "GroupchatAnyUnread", new string[] { });
|
||||
return Failure("Token not accepted", "GroupchatAnyUnread", new [] { });
|
||||
}
|
||||
return BasicReply(bot.HasUnreadGroupchats().ToString(), "GroupchatAnyUnread", new string[] { });
|
||||
return BasicReply(bot.HasUnreadGroupchats().ToString(), "GroupchatAnyUnread", new [] { });
|
||||
}
|
||||
|
||||
[About("Clears all group chat buffers at once")]
|
||||
|
|
@ -573,10 +573,10 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "groups", "GroupchatClearAll", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "GroupchatClearAll", new string[] { });
|
||||
return Failure("Token not accepted", "GroupchatClearAll", new [] { });
|
||||
}
|
||||
bot.ClearAllGroupchat();
|
||||
return BasicReply("ok", "GroupchatClearAll", new string[] { });
|
||||
return BasicReply("ok", "GroupchatClearAll", new [] { });
|
||||
}
|
||||
|
||||
[About("fetchs the groupchat history")]
|
||||
|
|
@ -588,13 +588,13 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "groups", "GroupchatHistory", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "GroupchatHistory", new string[] { group });
|
||||
return Failure("Token not accepted", "GroupchatHistory", new [] { group });
|
||||
}
|
||||
if (UUID.TryParse(group, out UUID groupUUID) == false)
|
||||
{
|
||||
return Failure("Group UUID invaild", "GroupchatHistory", new string[] { group });
|
||||
return Failure("Group UUID invaild", "GroupchatHistory", new [] { group });
|
||||
}
|
||||
return BasicReply(JsonConvert.SerializeObject(bot.GetGroupchat(groupUUID)), "GroupchatHistory", new string[] { group });
|
||||
return BasicReply(JsonConvert.SerializeObject(bot.GetGroupchat(groupUUID)), "GroupchatHistory", new [] { group });
|
||||
}
|
||||
|
||||
[About("sends a message to the groupchat")]
|
||||
|
|
@ -610,29 +610,29 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "groups", "Groupchat", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "Groupchat", new string[] { group, message });
|
||||
return Failure("Token not accepted", "Groupchat", new [] { group, message });
|
||||
}
|
||||
UUID groupUUID = UUID.Zero;
|
||||
if (UUID.TryParse(group, out groupUUID) == false)
|
||||
{
|
||||
return Failure("group value is invaild", "Groupchat", new string[] { group, message });
|
||||
return Failure("group value is invaild", "Groupchat", new [] { group, message });
|
||||
}
|
||||
if (bot.MyGroups.ContainsKey(groupUUID) == false)
|
||||
{
|
||||
return Failure("Unknown group", "Groupchat", new string[] { group, message });
|
||||
return Failure("Unknown group", "Groupchat", new [] { group, message });
|
||||
}
|
||||
Group G = bot.MyGroups[groupUUID];
|
||||
if (G.Powers.HasFlag(GroupPowers.JoinChat) == false)
|
||||
{
|
||||
return Failure("Missing group JoinChat power", "Groupchat", new string[] { group, message });
|
||||
return Failure("Missing group JoinChat power", "Groupchat", new [] { group, message });
|
||||
}
|
||||
if (bot.GetActiveGroupchatSessions.Contains(groupUUID) == false)
|
||||
{
|
||||
bot.GetClient.Self.RequestJoinGroupChat(groupUUID);
|
||||
return Failure("Opening groupchat", "Groupchat", new string[] { group, message });
|
||||
return Failure("Opening groupchat", "Groupchat", new [] { group, message });
|
||||
}
|
||||
bot.GetClient.Self.InstantMessageGroup(groupUUID, message);
|
||||
return BasicReply("Sending", "Groupchat", new string[] { group, message });
|
||||
return BasicReply("Sending", "Groupchat", new [] { group, message });
|
||||
}
|
||||
|
||||
protected KeyValuePair<bool, string> waitForReady(bool avatar, bool group, UUID groupuuid)
|
||||
|
|
|
|||
|
|
@ -23,10 +23,10 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "home", "GoHome", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "GoHome", new string[] { });
|
||||
return Failure("Token not accepted", "GoHome", new [] { });
|
||||
}
|
||||
bot.GotoNextHomeRegion();
|
||||
return BasicReply("ok", "GoHome", new string[] { });
|
||||
return BasicReply("ok", "GoHome", new [] { });
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,9 +22,9 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "im", "chatwindows", handleGetClientIP()) == false)
|
||||
{
|
||||
return BasicReply("Token not accepted", "chatwindows", new string[] { });
|
||||
return BasicReply("Token not accepted", "chatwindows", new [] { });
|
||||
}
|
||||
return BasicReply(JsonConvert.SerializeObject(bot.GetIMChatWindowKeyNames()), "chatwindows", new string[] { });
|
||||
return BasicReply(JsonConvert.SerializeObject(bot.GetIMChatWindowKeyNames()), "chatwindows", new [] { });
|
||||
}
|
||||
|
||||
[About("gets a list of chat windows with unread messages")]
|
||||
|
|
@ -34,7 +34,7 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "im", "listwithunread", handleGetClientIP()) == false)
|
||||
{
|
||||
return BasicReply("Token not accepted", "listwithunread", new string[] { });
|
||||
return BasicReply("Token not accepted", "listwithunread", new [] { });
|
||||
}
|
||||
List<UUID> unreadimwindows = new List<UUID>();
|
||||
foreach (UUID window in bot.IMChatWindows())
|
||||
|
|
@ -44,7 +44,7 @@ namespace BetterSecondBot.HttpService
|
|||
unreadimwindows.Add(window);
|
||||
}
|
||||
}
|
||||
return BasicReply(JsonConvert.SerializeObject(unreadimwindows), "listwithunread", new string[] { });
|
||||
return BasicReply(JsonConvert.SerializeObject(unreadimwindows), "listwithunread", new [] { });
|
||||
}
|
||||
|
||||
[About("gets if there are any unread im messages at all")]
|
||||
|
|
@ -54,7 +54,7 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "im", "haveunreadims", handleGetClientIP()) == false)
|
||||
{
|
||||
return BasicReply("Token not accepted", "haveunreadims", new string[] { });
|
||||
return BasicReply("Token not accepted", "haveunreadims", new [] { });
|
||||
}
|
||||
bool reply = false;
|
||||
foreach (UUID window in bot.IMChatWindows())
|
||||
|
|
@ -65,7 +65,7 @@ namespace BetterSecondBot.HttpService
|
|||
break;
|
||||
}
|
||||
}
|
||||
return BasicReply(reply.ToString(), "haveunreadims", new string[] { });
|
||||
return BasicReply(reply.ToString(), "haveunreadims", new [] { });
|
||||
}
|
||||
|
||||
[About("gets the chat from the selected window")]
|
||||
|
|
@ -77,13 +77,13 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "im", "getimchat", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "getimchat", new string[] { window });
|
||||
return Failure("Token not accepted", "getimchat", new [] { window });
|
||||
}
|
||||
if (UUID.TryParse(window, out UUID windowUUID) == false)
|
||||
{
|
||||
return Failure("Window UUID invaild", "getimchat", new string[] { window });
|
||||
return Failure("Window UUID invaild", "getimchat", new [] { window });
|
||||
}
|
||||
return BasicReply(JsonConvert.SerializeObject(bot.GetIMChatWindow(windowUUID)), "getimchat", new string[] { window });
|
||||
return BasicReply(JsonConvert.SerializeObject(bot.GetIMChatWindow(windowUUID)), "getimchat", new [] { window });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,9 +23,9 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "info", "Version", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "Version", new string[] { });
|
||||
return Failure("Token not accepted", "Version", new [] { });
|
||||
}
|
||||
return BasicReply(bot.MyVersion, "Version", new string[] { });
|
||||
return BasicReply(bot.MyVersion, "Version", new [] { });
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -36,9 +36,9 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "info", "Name", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "Name", new string[] { });
|
||||
return Failure("Token not accepted", "Name", new [] { });
|
||||
}
|
||||
return BasicReply(bot.GetClient.Self.FirstName + " " + bot.GetClient.Self.LastName, "Name", new string[] { });
|
||||
return BasicReply(bot.GetClient.Self.FirstName + " " + bot.GetClient.Self.LastName, "Name", new [] { });
|
||||
}
|
||||
|
||||
[About("Fetchs the current parcels name")]
|
||||
|
|
@ -50,18 +50,18 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "info", "ParcelName", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "ParcelName", new string[] { });
|
||||
return Failure("Token not accepted", "ParcelName", new [] { });
|
||||
}
|
||||
if (bot.GetClient.Network.CurrentSim == null)
|
||||
{
|
||||
return Failure("Error not in a sim", "ParcelName", new string[] { });
|
||||
return Failure("Error not in a sim", "ParcelName", new [] { });
|
||||
}
|
||||
int localid = bot.GetClient.Parcels.GetParcelLocalID(bot.GetClient.Network.CurrentSim, bot.GetClient.Self.SimPosition);
|
||||
if (bot.GetClient.Network.CurrentSim.Parcels.ContainsKey(localid) == false)
|
||||
{
|
||||
return Failure("Error parcel not found", "ParcelName", new string[] { });
|
||||
return Failure("Error parcel not found", "ParcelName", new [] { });
|
||||
}
|
||||
return BasicReply(bot.GetClient.Network.CurrentSim.Parcels[localid].Name, "ParcelName", new string[] { });
|
||||
return BasicReply(bot.GetClient.Network.CurrentSim.Parcels[localid].Name, "ParcelName", new [] { });
|
||||
}
|
||||
|
||||
[About("Requests the current unixtime at the bot")]
|
||||
|
|
@ -71,9 +71,9 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "info", "UnixTimeNow", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "UnixTimeNow", new string[] { });
|
||||
return Failure("Token not accepted", "UnixTimeNow", new [] { });
|
||||
}
|
||||
return BasicReply(helpers.UnixTimeNow().ToString(), "UnixTimeNow", new string[] { });
|
||||
return BasicReply(helpers.UnixTimeNow().ToString(), "UnixTimeNow", new [] { });
|
||||
}
|
||||
|
||||
[About("Fetchs the current region name")]
|
||||
|
|
@ -84,13 +84,13 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "info", "SimName", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "SimName", new string[] { });
|
||||
return Failure("Token not accepted", "SimName", new [] { });
|
||||
}
|
||||
if (bot.GetClient.Network.CurrentSim == null)
|
||||
{
|
||||
return Failure("Error not in a sim", "SimName", new string[] { });
|
||||
return Failure("Error not in a sim", "SimName", new [] { });
|
||||
}
|
||||
return BasicReply(bot.GetClient.Network.CurrentSim.Name, "SimName", new string[] { });
|
||||
return BasicReply(bot.GetClient.Network.CurrentSim.Name, "SimName", new [] { });
|
||||
}
|
||||
|
||||
[About("Fetchs the current location of the bot")]
|
||||
|
|
@ -101,17 +101,17 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "info", "GetPosition", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "GetPosition", new string[] { });
|
||||
return Failure("Token not accepted", "GetPosition", new [] { });
|
||||
}
|
||||
if (bot.GetClient.Network.CurrentSim == null)
|
||||
{
|
||||
return Failure("Error not in a sim", "GetPosition", new string[] { });
|
||||
return Failure("Error not in a sim", "GetPosition", new [] { });
|
||||
}
|
||||
Dictionary<string, int> pos = new Dictionary<string, int>();
|
||||
pos.Add("x", (int)Math.Round(bot.GetClient.Self.SimPosition.X));
|
||||
pos.Add("y", (int)Math.Round(bot.GetClient.Self.SimPosition.Y));
|
||||
pos.Add("z", (int)Math.Round(bot.GetClient.Self.SimPosition.Z));
|
||||
return BasicReply(JsonConvert.SerializeObject(pos), "GetPosition", new string[] { });
|
||||
return BasicReply(JsonConvert.SerializeObject(pos), "GetPosition", new [] { });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,19 +26,19 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "inventory", "RezObject", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "RezObject", new string[] { item });
|
||||
return Failure("Token not accepted", "RezObject", new [] { item });
|
||||
}
|
||||
if (UUID.TryParse(item, out UUID targetitem) == true)
|
||||
{
|
||||
return Failure("Invaild item UUID", "RezObject", new string[] { item });
|
||||
return Failure("Invaild item UUID", "RezObject", new [] { item });
|
||||
}
|
||||
InventoryItem itm = bot.GetClient.Inventory.FetchItem(targetitem, bot.GetClient.Self.AgentID, (5 * 1000));
|
||||
if (itm == null)
|
||||
{
|
||||
return Failure("Unable to find item", "RezObject", new string[] { item });
|
||||
return Failure("Unable to find item", "RezObject", new [] { item });
|
||||
}
|
||||
UUID rezedobject = bot.GetClient.Inventory.RequestRezFromInventory(bot.GetClient.Network.CurrentSim, bot.GetClient.Self.SimRotation, bot.GetClient.Self.RelativePosition, itm);
|
||||
return BasicReply(rezedobject.ToString(), "RezObject", new string[] { item });
|
||||
return BasicReply(rezedobject.ToString(), "RezObject", new [] { item });
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -54,24 +54,24 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "inventory", "RenameInventory", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "RenameInventory", new string[] { item, newname });
|
||||
return Failure("Token not accepted", "RenameInventory", new [] { item, newname });
|
||||
}
|
||||
if (UUID.TryParse(item, out UUID target) == false)
|
||||
{
|
||||
return Failure("invaild item uuid", "RenameInventory", new string[] { item, newname });
|
||||
return Failure("invaild item uuid", "RenameInventory", new [] { item, newname });
|
||||
}
|
||||
if (newname.Length < 3)
|
||||
{
|
||||
return Failure("Item name is to short", "RenameInventory", new string[] { item, newname });
|
||||
return Failure("Item name is to short", "RenameInventory", new [] { item, newname });
|
||||
}
|
||||
InventoryItem realitem = HelperInventory.getItemByInventoryUUID(bot, target);
|
||||
if (realitem == null)
|
||||
{
|
||||
return Failure("Unable to find inventory item", "RenameInventory", new string[] { item, newname });
|
||||
return Failure("Unable to find inventory item", "RenameInventory", new [] { item, newname });
|
||||
}
|
||||
realitem.Name = newname;
|
||||
bot.GetClient.Inventory.RequestUpdateItem(realitem);
|
||||
return BasicReply("Ok", "RenameInventory", new string[] { item, newname });
|
||||
return BasicReply("Ok", "RenameInventory", new [] { item, newname });
|
||||
}
|
||||
|
||||
[About("Attempts to Remove the given inventory item")]
|
||||
|
|
@ -83,14 +83,14 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "inventory", "DeleteInventoryItem", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "DeleteInventoryItem", new string[] { item });
|
||||
return Failure("Token not accepted", "DeleteInventoryItem", new [] { item });
|
||||
}
|
||||
if (UUID.TryParse(item, out UUID target) == false)
|
||||
{
|
||||
return Failure("invaild item uuid", "DeleteInventoryItem", new string[] { item });
|
||||
return Failure("invaild item uuid", "DeleteInventoryItem", new [] { item });
|
||||
}
|
||||
bot.GetClient.Inventory.Remove(new List<UUID>() { target }, new List<UUID>());
|
||||
return BasicReply("Ok", "DeleteInventoryItem", new string[] { item });
|
||||
return BasicReply("Ok", "DeleteInventoryItem", new [] { item });
|
||||
}
|
||||
|
||||
[About("Attempts to Remove the given inventory folder")]
|
||||
|
|
@ -102,14 +102,14 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "inventory", "DeleteInventoryFolder", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "DeleteInventoryFolder", new string[] { folder });
|
||||
return Failure("Token not accepted", "DeleteInventoryFolder", new [] { folder });
|
||||
}
|
||||
if (UUID.TryParse(folder, out UUID target) == false)
|
||||
{
|
||||
return Failure("invaild folder uuid", "DeleteInventoryFolder", new string[] { folder });
|
||||
return Failure("invaild folder uuid", "DeleteInventoryFolder", new [] { folder });
|
||||
}
|
||||
bot.GetClient.Inventory.Remove(new List<UUID>(), new List<UUID>() { target });
|
||||
return BasicReply("Ok", "DeleteInventoryFolder", new string[] { folder });
|
||||
return BasicReply("Ok", "DeleteInventoryFolder", new [] { folder });
|
||||
}
|
||||
|
||||
[About("Attempts to attach the given inventory item")]
|
||||
|
|
@ -121,15 +121,15 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "inventory", "Attach", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "Attach", new string[] { item });
|
||||
return Failure("Token not accepted", "Attach", new [] { item });
|
||||
}
|
||||
if(UUID.TryParse(item,out UUID itemuuid) == false)
|
||||
{
|
||||
return Failure("invaild item uuid", "Attach", new string[] { item });
|
||||
return Failure("invaild item uuid", "Attach", new [] { item });
|
||||
}
|
||||
InventoryItem realitem = HelperInventory.getItemByInventoryUUID(bot, itemuuid);
|
||||
bot.GetClient.Appearance.AddAttachments(new List<InventoryItem>() { realitem }, false, false);
|
||||
return BasicReply("Ok", "Attach", new string[] { item });
|
||||
return BasicReply("Ok", "Attach", new [] { item });
|
||||
}
|
||||
|
||||
[About("Attempts to Remove the given inventory folder")]
|
||||
|
|
@ -141,15 +141,15 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "inventory", "Detach", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "Detach", new string[] { item });
|
||||
return Failure("Token not accepted", "Detach", new [] { item });
|
||||
}
|
||||
if (UUID.TryParse(item, out UUID itemuuid) == false)
|
||||
{
|
||||
return Failure("invaild item uuid", "Detach", new string[] { item });
|
||||
return Failure("invaild item uuid", "Detach", new [] { item });
|
||||
}
|
||||
InventoryItem realitem = HelperInventory.getItemByInventoryUUID(bot, itemuuid);
|
||||
bot.GetClient.Appearance.RemoveFromOutfit(realitem);
|
||||
return BasicReply("Ok", "Detach", new string[] { item });
|
||||
return BasicReply("Ok", "Detach", new [] { 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!")]
|
||||
|
|
@ -164,11 +164,11 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "inventory", "Outfit", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "Outfit", new string[] { name });
|
||||
return Failure("Token not accepted", "Outfit", new [] { name });
|
||||
}
|
||||
if (helpers.notempty(name) == false)
|
||||
{
|
||||
return Failure("Named folder value is empty", "Outfit", new string[] { name });
|
||||
return Failure("Named folder value is empty", "Outfit", new [] { name });
|
||||
}
|
||||
// uses the Clothing folder
|
||||
// must be a full outfit (shapes/eyes ect)
|
||||
|
|
@ -185,7 +185,7 @@ namespace BetterSecondBot.HttpService
|
|||
}
|
||||
if (AA == null)
|
||||
{
|
||||
return Failure("Cant find Clothing folder", "Outfit", new string[] { name });
|
||||
return Failure("Cant find Clothing folder", "Outfit", new [] { name });
|
||||
}
|
||||
T = bot.GetClient.Inventory.Store.GetContents(AA);
|
||||
AA = null;
|
||||
|
|
@ -199,13 +199,13 @@ namespace BetterSecondBot.HttpService
|
|||
}
|
||||
if (AA == null)
|
||||
{
|
||||
return Failure("Cant find target folder", "Outfit", new string[] { name });
|
||||
return Failure("Cant find target folder", "Outfit", new [] { name });
|
||||
}
|
||||
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>();
|
||||
if (contents == null)
|
||||
{
|
||||
return Failure("target folder is empty or so full I cant get it in 5 secs...", "Outfit", new string[] { name });
|
||||
return Failure("target folder is empty or so full I cant get it in 5 secs...", "Outfit", new [] { name });
|
||||
}
|
||||
foreach (InventoryBase item in contents)
|
||||
{
|
||||
|
|
@ -215,7 +215,7 @@ namespace BetterSecondBot.HttpService
|
|||
}
|
||||
}
|
||||
bot.GetClient.Appearance.ReplaceOutfit(wareables, false);
|
||||
return BasicReply("ok", "Outfit", new string[] { name });
|
||||
return BasicReply("ok", "Outfit", new [] { name });
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -228,7 +228,7 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "inventory", "InventoryPurgeNotecards", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "InventoryPurgeNotecards", new string[] { });
|
||||
return Failure("Token not accepted", "InventoryPurgeNotecards", new [] { });
|
||||
}
|
||||
List<InventoryBase> T = bot.GetClient.Inventory.Store.GetContents(bot.GetClient.Inventory.Store.RootFolder);
|
||||
InventoryBase NotecardFolder = null;
|
||||
|
|
@ -242,7 +242,7 @@ namespace BetterSecondBot.HttpService
|
|||
}
|
||||
if (NotecardFolder != null)
|
||||
{
|
||||
return Failure("Unable to find notecard folder", "InventoryPurgeNotecards", new string[] { });
|
||||
return Failure("Unable to find notecard folder", "InventoryPurgeNotecards", new [] { });
|
||||
}
|
||||
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);
|
||||
|
|
@ -262,7 +262,7 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
bot.GetClient.Inventory.Remove(purge_notecards, new List<UUID>());
|
||||
}
|
||||
return BasicReply("Ok", "InventoryPurgeNotecards", new string[] { });
|
||||
return BasicReply("Ok", "InventoryPurgeNotecards", new [] { });
|
||||
}
|
||||
|
||||
[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)
|
||||
{
|
||||
return Failure("Token not accepted", "getRealUUID", new string[] { item });
|
||||
return Failure("Token not accepted", "getRealUUID", new [] { item });
|
||||
}
|
||||
if (UUID.TryParse(item, out UUID itemUUID) == false)
|
||||
{
|
||||
return Failure("Invaild item uuid", "getRealUUID", new string[] { item });
|
||||
return Failure("Invaild item uuid", "getRealUUID", new [] { item });
|
||||
}
|
||||
UUID reply = HelperInventory.GetAssetUUID(bot, itemUUID);
|
||||
return BasicReply(reply.ToString(), "getRealUUID", new string[] { item });
|
||||
return BasicReply(reply.ToString(), "getRealUUID", new [] { item });
|
||||
}
|
||||
|
||||
[About("sends a item to an avatar")]
|
||||
|
|
@ -297,24 +297,24 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "inventory", "SendItem", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "SendItem", new string[] { item, avatar });
|
||||
return Failure("Token not accepted", "SendItem", new [] { item, avatar });
|
||||
}
|
||||
ProcessAvatar(avatar);
|
||||
if(avataruuid == UUID.Zero)
|
||||
{
|
||||
return Failure("Invaild avatar uuid", "SendItem", new string[] { item, avatar });
|
||||
return Failure("Invaild avatar uuid", "SendItem", new [] { item, avatar });
|
||||
}
|
||||
if (UUID.TryParse(item, out UUID targetitem) == true)
|
||||
{
|
||||
return Failure("Invaild item uuid", "SendItem", new string[] { item, avatar });
|
||||
return Failure("Invaild item uuid", "SendItem", new [] { item, avatar });
|
||||
}
|
||||
InventoryItem itm = bot.GetClient.Inventory.FetchItem(targetitem, bot.GetClient.Self.AgentID, (3 * 1000));
|
||||
if (itm == null)
|
||||
{
|
||||
return Failure("Unable to find item", "SendItem", new string[] { item, avatar });
|
||||
return Failure("Unable to find item", "SendItem", new [] { item, avatar });
|
||||
}
|
||||
bot.GetClient.Inventory.GiveItem(itm.UUID, itm.Name, itm.AssetType, avataruuid, false);
|
||||
return BasicReply("ok", "SendItem", new string[] { item, avatar });
|
||||
return BasicReply("ok", "SendItem", new [] { item, avatar });
|
||||
}
|
||||
|
||||
[About("Sends a folder to an avatar")]
|
||||
|
|
@ -330,24 +330,24 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "inventory", "SendFolder", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "SendFolder", new string[] { folder, avatar });
|
||||
return Failure("Token not accepted", "SendFolder", new [] { folder, avatar });
|
||||
}
|
||||
ProcessAvatar(avatar);
|
||||
if (avataruuid == UUID.Zero)
|
||||
{
|
||||
return Failure("Invaild avatar uuid", "SendFolder", new string[] { folder, avatar });
|
||||
return Failure("Invaild avatar uuid", "SendFolder", new [] { folder, avatar });
|
||||
}
|
||||
if (UUID.TryParse(folder, out UUID targetfolder) == true)
|
||||
{
|
||||
return Failure("Invaild folder uuid", "SendFolder", new string[] { folder, avatar });
|
||||
return Failure("Invaild folder uuid", "SendFolder", new [] { folder, avatar });
|
||||
}
|
||||
InventoryBase FindFolderHelper = HelperInventory.FindFolder(bot, bot.GetClient.Inventory.Store.RootFolder, targetfolder);
|
||||
if (FindFolderHelper == null)
|
||||
{
|
||||
return Failure("Unable to find folder", "SendFolder", new string[] { folder, avatar });
|
||||
return Failure("Unable to find folder", "SendFolder", new [] { folder, avatar });
|
||||
}
|
||||
bot.GetClient.Inventory.GiveFolder(FindFolderHelper.UUID, FindFolderHelper.Name, avataruuid, false);
|
||||
return BasicReply("ok", "SendFolder", new string[] { folder, avatar });
|
||||
return BasicReply("ok", "SendFolder", new [] { folder, avatar });
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -369,25 +369,25 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "inventory", "TransferInventoryToObject", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "TransferInventoryToObject", new string[] { item, objectuuid, running });
|
||||
return Failure("Token not accepted", "TransferInventoryToObject", new [] { item, objectuuid, running });
|
||||
}
|
||||
if (UUID.TryParse(item, out UUID itemuuid) == false)
|
||||
{
|
||||
return Failure("Invaild item uuid", "TransferInventoryToObject", new string[] { item, objectuuid, running });
|
||||
return Failure("Invaild item uuid", "TransferInventoryToObject", new [] { item, objectuuid, running });
|
||||
}
|
||||
if (UUID.TryParse(objectuuid, out UUID objectUUID) == false)
|
||||
{
|
||||
return Failure("Invaild object uuid", "TransferInventoryToObject", new string[] { item, objectuuid, running });
|
||||
return Failure("Invaild object uuid", "TransferInventoryToObject", new [] { item, objectuuid, running });
|
||||
}
|
||||
if (bool.TryParse(running, out bool runscript) == false)
|
||||
{
|
||||
return Failure("Invaild running", "TransferInventoryToObject", new string[] { item, objectuuid, running });
|
||||
return Failure("Invaild running", "TransferInventoryToObject", new [] { item, objectuuid, running });
|
||||
}
|
||||
|
||||
InventoryItem itm = bot.GetClient.Inventory.FetchItem(itemuuid, bot.GetClient.Self.AgentID, (3 * 1000));
|
||||
if (itm == null)
|
||||
{
|
||||
return Failure("Unable to find inventory", "TransferInventoryToObject", new string[] { item, objectuuid, running });
|
||||
return Failure("Unable to find inventory", "TransferInventoryToObject", new [] { item, objectuuid, running });
|
||||
}
|
||||
Dictionary<uint, Primitive> objects_copy = bot.GetClient.Network.CurrentSim.ObjectsPrimitives.Copy();
|
||||
KeyValuePair<uint, Primitive> RealObject = new KeyValuePair<uint, Primitive>(0,null);
|
||||
|
|
@ -401,7 +401,7 @@ namespace BetterSecondBot.HttpService
|
|||
}
|
||||
if (RealObject.Value == null)
|
||||
{
|
||||
return Failure("Unable to find object", "TransferInventoryToObject", new string[] { item, objectuuid, running });
|
||||
return Failure("Unable to find object", "TransferInventoryToObject", new [] { item, objectuuid, running });
|
||||
}
|
||||
bool scriptState = runscript;
|
||||
if (itm.AssetType != AssetType.LSLText)
|
||||
|
|
@ -411,10 +411,10 @@ namespace BetterSecondBot.HttpService
|
|||
if (itm.AssetType == AssetType.LSLText)
|
||||
{
|
||||
bot.GetClient.Inventory.CopyScriptToTask(RealObject.Key, itm, scriptState);
|
||||
return BasicReply("Transfering script [state: "+scriptState.ToString()+"]", "TransferInventoryToObject", new string[] { item, objectuuid, running });
|
||||
return BasicReply("Transfering script [state: "+scriptState.ToString()+"]", "TransferInventoryToObject", new [] { item, objectuuid, running });
|
||||
}
|
||||
bot.GetClient.Inventory.UpdateTaskInventory(RealObject.Key, itm);
|
||||
return BasicReply("Transfering inventory", "TransferInventoryToObject", new string[] { item, objectuuid, running });
|
||||
return BasicReply("Transfering inventory", "TransferInventoryToObject", new [] { 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>")]
|
||||
|
|
@ -425,11 +425,11 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "inventory", "InventoryFolders", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "InventoryFolders", new string[] { });
|
||||
return Failure("Token not accepted", "InventoryFolders", new [] { });
|
||||
}
|
||||
string reply = HelperInventory.MapFolderJson(bot);
|
||||
if (reply != null) return BasicReply(reply, "InventoryFolders", new string[] { });
|
||||
return Failure("Error", "InventoryFolders", new string[] { });
|
||||
if (reply != null) return BasicReply(reply, "InventoryFolders", new [] { });
|
||||
return Failure("Error", "InventoryFolders", new [] { });
|
||||
}
|
||||
|
||||
[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)
|
||||
{
|
||||
return Failure("Token not accepted", "InventoryContents", new string[] { folderUUID });
|
||||
return Failure("Token not accepted", "InventoryContents", new [] { folderUUID });
|
||||
}
|
||||
if (UUID.TryParse(folderUUID, out UUID folder) == false)
|
||||
{
|
||||
return Failure("Invaild folder UUID", "InventoryContents", new string[] { folderUUID });
|
||||
return Failure("Invaild folder UUID", "InventoryContents", new [] { folderUUID });
|
||||
}
|
||||
return BasicReply(HelperInventory.MapFolderInventoryJson(bot, folder), "InventoryContents", new string[] { folderUUID });
|
||||
return BasicReply(HelperInventory.MapFolderInventoryJson(bot, folder), "InventoryContents", new [] { folderUUID });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,23 +31,23 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "movement", "AutoPilot", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "AutoPilot", new string[] { x, y, z });
|
||||
return Failure("Token not accepted", "AutoPilot", new [] { x, y, z });
|
||||
}
|
||||
if (Vector3.TryParse("<" + x + "," + y + "," + z + ">", out Vector3 pos) == false)
|
||||
{
|
||||
return Failure("Convert to vector has failed", "AutoPilot", new string[] { x, y, z });
|
||||
return Failure("Convert to vector has failed", "AutoPilot", new [] { x, y, z });
|
||||
}
|
||||
if (helpers.inrange(pos.X, 0, 255) == false)
|
||||
{
|
||||
return Failure("x value out of range 0-255", "AutoPilot", new string[] { x, y, z });
|
||||
return Failure("x value out of range 0-255", "AutoPilot", new [] { x, y, z });
|
||||
}
|
||||
if (helpers.inrange(pos.Y, 0, 255) == false)
|
||||
{
|
||||
return Failure("y value out of range 0-255", "AutoPilot", new string[] { x, y, z });
|
||||
return Failure("y value out of range 0-255", "AutoPilot", new [] { x, y, z });
|
||||
}
|
||||
if (helpers.inrange(pos.Z, 0, 5000) == false)
|
||||
{
|
||||
return Failure("z value out of range 0-5000", "AutoPilot", new string[] { x, y, z });
|
||||
return Failure("z value out of range 0-5000", "AutoPilot", new [] { x, y, z });
|
||||
}
|
||||
bot.GetClient.Self.AutoPilotCancel();
|
||||
bot.GetClient.Self.Movement.TurnToward(pos, true);
|
||||
|
|
@ -55,7 +55,7 @@ namespace BetterSecondBot.HttpService
|
|||
uint Globalx, Globaly;
|
||||
Utils.LongToUInts(bot.GetClient.Network.CurrentSim.Handle, out Globalx, out Globaly);
|
||||
bot.GetClient.Self.AutoPilot((ulong)(Globalx + pos.X), (ulong)(Globaly + pos.Y), pos.Z);
|
||||
return BasicReply("ok", "AutoPilot", new string[] { x, y, z });
|
||||
return BasicReply("ok", "AutoPilot", new [] { x, y, z });
|
||||
}
|
||||
|
||||
[About("Attempt to teleport to a new region")]
|
||||
|
|
@ -65,10 +65,10 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "movement", "AutoPilotStop", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "AutoPilotStop", new string[] { });
|
||||
return Failure("Token not accepted", "AutoPilotStop", new [] { });
|
||||
}
|
||||
bot.GetClient.Self.AutoPilotCancel();
|
||||
return BasicReply("ok", "AutoPilotStop", new string[] { });
|
||||
return BasicReply("ok", "AutoPilotStop", new [] { });
|
||||
}
|
||||
|
||||
[About("Make the bot request the target avatar teleport to the bot")]
|
||||
|
|
@ -80,15 +80,15 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "movement", "SendTeleportLure", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "SendTeleportLure", new string[] { avatar });
|
||||
return Failure("Token not accepted", "SendTeleportLure", new [] { avatar });
|
||||
}
|
||||
ProcessAvatar(avatar);
|
||||
if(avataruuid == UUID.Zero)
|
||||
{
|
||||
return Failure("Invaild avatar UUID", "SendTeleportLure", new string[] { avatar });
|
||||
return Failure("Invaild avatar UUID", "SendTeleportLure", new [] { avatar });
|
||||
}
|
||||
bot.GetClient.Self.SendTeleportLure(avataruuid);
|
||||
return BasicReply("ok", "SendTeleportLure", new string[] { avatar });
|
||||
return BasicReply("ok", "SendTeleportLure", new [] { avatar });
|
||||
}
|
||||
|
||||
[About("Sends a teleport request (Move the bot to the avatar)")]
|
||||
|
|
@ -100,16 +100,16 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "movement", "RequestTeleport", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "RequestTeleport", new string[] { avatar });
|
||||
return Failure("Token not accepted", "RequestTeleport", new [] { avatar });
|
||||
}
|
||||
ProcessAvatar(avatar);
|
||||
if (avataruuid == UUID.Zero)
|
||||
{
|
||||
return Failure("Invaild avatar UUID", "RequestTeleport", new string[] { avatar });
|
||||
return Failure("Invaild avatar UUID", "RequestTeleport", new [] { avatar });
|
||||
}
|
||||
bot.Add_action_from("teleport", avataruuid, bot.FindAvatarKey2Name(avataruuid));
|
||||
bot.GetClient.Self.SendTeleportLureRequest(avataruuid, "I would like to teleport to you");
|
||||
return BasicReply("ok", "RequestTeleport", new string[] { avatar });
|
||||
return BasicReply("ok", "RequestTeleport", new [] { avatar });
|
||||
}
|
||||
|
||||
[About("Makes the bot fly (or not)")]
|
||||
|
|
@ -121,15 +121,15 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "movement", "Fly", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "Fly", new string[] { mode });
|
||||
return Failure("Token not accepted", "Fly", new [] { mode });
|
||||
}
|
||||
if (bool.TryParse(mode, out bool flymode) == false)
|
||||
{
|
||||
return Failure("Invaild mode", "Fly", new string[] { mode });
|
||||
return Failure("Invaild mode", "Fly", new [] { mode });
|
||||
}
|
||||
bot.GetClient.Self.Movement.Fly = flymode;
|
||||
bot.GetClient.Self.Movement.SendUpdate();
|
||||
return BasicReply("ok", "Fly", new string[] { mode });
|
||||
return BasicReply("ok", "Fly", new [] { mode });
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -144,25 +144,25 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "movement", "RotateToFaceVector", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "RotateToFaceVector", new string[] { vector });
|
||||
return Failure("Token not accepted", "RotateToFaceVector", new [] { vector });
|
||||
}
|
||||
if (Vector3.TryParse(vector, out Vector3 pos) == false)
|
||||
{
|
||||
return Failure("Invaild vector", "RotateToFaceVector", new string[] { vector });
|
||||
return Failure("Invaild vector", "RotateToFaceVector", new [] { vector });
|
||||
}
|
||||
if (helpers.inrange(pos.X, 0, 255) == false)
|
||||
{
|
||||
return Failure("Vector x value is out of range 0-255", "RotateToFaceVector", new string[] { vector });
|
||||
return Failure("Vector x value is out of range 0-255", "RotateToFaceVector", new [] { vector });
|
||||
}
|
||||
if (helpers.inrange(pos.Y, 0, 255) == false)
|
||||
{
|
||||
return Failure("Vector y value is out of range 0-255", "RotateToFaceVector", new string[] { vector });
|
||||
return Failure("Vector y value is out of range 0-255", "RotateToFaceVector", new [] { vector });
|
||||
}
|
||||
if (helpers.inrange(pos.Z, 0, 5000) == false)
|
||||
{
|
||||
return Failure("Vector z value is out of range 0-5000", "RotateToFaceVector", new string[] { vector });
|
||||
return Failure("Vector z value is out of range 0-5000", "RotateToFaceVector", new [] { vector });
|
||||
}
|
||||
return BasicReply(bot.GetClient.Self.Movement.TurnToward(pos, true).ToString(), "RotateToFaceVector", new string[] { vector });
|
||||
return BasicReply(bot.GetClient.Self.Movement.TurnToward(pos, true).ToString(), "RotateToFaceVector", new [] { vector });
|
||||
}
|
||||
|
||||
[About("Rotates the bot to face a avatar")]
|
||||
|
|
@ -175,18 +175,18 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "movement", "RotateToFace", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "RotateToFace", new string[] { avatar });
|
||||
return Failure("Token not accepted", "RotateToFace", new [] { avatar });
|
||||
}
|
||||
ProcessAvatar(avatar);
|
||||
if(avataruuid == UUID.Zero)
|
||||
{
|
||||
return Failure("Invaild avatar UUID", "RotateToFace", new string[] { avatar });
|
||||
return Failure("Invaild avatar UUID", "RotateToFace", new [] { avatar });
|
||||
}
|
||||
if (bot.GetClient.Network.CurrentSim.AvatarPositions.ContainsKey(avataruuid) == false)
|
||||
{
|
||||
return Failure("Unable to see avatar", "RotateToFace", new string[] { avatar });
|
||||
return Failure("Unable to see avatar", "RotateToFace", new [] { avatar });
|
||||
}
|
||||
return BasicReply(bot.GetClient.Self.Movement.TurnToward(bot.GetClient.Network.CurrentSim.AvatarPositions[avataruuid], true).ToString(), "RotateToFace", new string[] { avatar });
|
||||
return BasicReply(bot.GetClient.Self.Movement.TurnToward(bot.GetClient.Network.CurrentSim.AvatarPositions[avataruuid], true).ToString(), "RotateToFace", new [] { avatar });
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -199,11 +199,11 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "movement", "RotateTo", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "RotateTo", new string[] { deg });
|
||||
return Failure("Token not accepted", "RotateTo", new [] { deg });
|
||||
}
|
||||
if (float.TryParse(deg, out float target_yaw) == true)
|
||||
{
|
||||
return Failure("Unable to process rotation", "RotateTo", new string[] { deg });
|
||||
return Failure("Unable to process rotation", "RotateTo", new [] { deg });
|
||||
}
|
||||
float yaw = target_yaw;
|
||||
bot.GetClient.Self.Movement.BodyRotation.GetEulerAngles(out float roll, out float pitch, out _);
|
||||
|
|
@ -226,7 +226,7 @@ namespace BetterSecondBot.HttpService
|
|||
result.Z = cosYawOver2 * cosPitchOver2 * sinRollOver2 - sinYawOver2 * sinPitchOver2 * cosRollOver2;
|
||||
bot.GetClient.Self.Movement.BodyRotation = result;
|
||||
bot.GetClient.Self.Movement.SendUpdate();
|
||||
return BasicReply("ok", "RotateTo", new string[] { deg });
|
||||
return BasicReply("ok", "RotateTo", new [] { deg });
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -243,15 +243,15 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "movement", "Teleport", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "Teleport", new string[] { region,x,y,z });
|
||||
return Failure("Token not accepted", "Teleport", new [] { region,x,y,z });
|
||||
}
|
||||
bool status = TeleportRequest(new string[] { region, x, y, z });
|
||||
bool status = TeleportRequest(new [] { region, x, y, z });
|
||||
if (status == false)
|
||||
{
|
||||
return Failure("Error Unable to Teleport to location", "Teleport", new string[] { region, x, y, z });
|
||||
return Failure("Error Unable to Teleport to location", "Teleport", new [] { region, x, y, z });
|
||||
}
|
||||
bot.SetTeleported();
|
||||
return BasicReply("Accepted", "Teleport", new string[] { region, x, y, z });
|
||||
return BasicReply("Accepted", "Teleport", new [] { region, x, y, z });
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -264,14 +264,14 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "movement", "TeleportSLURL", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "TeleportSLURL", new string[] { slurl });
|
||||
return Failure("Token not accepted", "TeleportSLURL", new [] { slurl });
|
||||
}
|
||||
if(helpers.notempty(slurl) == false)
|
||||
{
|
||||
return Failure("slurl is empty", "TeleportSLURL", new string[] { slurl });
|
||||
return Failure("slurl is empty", "TeleportSLURL", new [] { slurl });
|
||||
}
|
||||
bot.SetTeleported();
|
||||
return BasicReply(TeleportRequest(new string[] { slurl }).ToString(), "TeleportSLURL", new string[] { slurl });
|
||||
return BasicReply(TeleportRequest(new [] { slurl }).ToString(), "TeleportSLURL", new [] { slurl });
|
||||
}
|
||||
|
||||
protected bool TeleportRequest(string[] args)
|
||||
|
|
|
|||
|
|
@ -26,18 +26,18 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "notecard", "NotecardAdd", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "NotecardAdd", new string[] { collection, content });
|
||||
return Failure("Token not accepted", "NotecardAdd", new [] { collection, content });
|
||||
}
|
||||
if (helpers.notempty(collection) == false)
|
||||
{
|
||||
return Failure("Collection value is empty", "NotecardAdd", new string[] { collection, content });
|
||||
return Failure("Collection value is empty", "NotecardAdd", new [] { collection, content });
|
||||
}
|
||||
if (helpers.notempty(content) == false)
|
||||
{
|
||||
return Failure("Content value is empty", "NotecardAdd", new string[] { collection, content });
|
||||
return Failure("Content value is empty", "NotecardAdd", new [] { collection, content });
|
||||
}
|
||||
bot.NotecardAddContent(collection, content);
|
||||
return BasicReply("ok", "NotecardAdd", new string[] { collection, content });
|
||||
return BasicReply("ok", "NotecardAdd", new [] { collection, content });
|
||||
}
|
||||
|
||||
[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)
|
||||
{
|
||||
return Failure("Token not accepted", "NotecardClear", new string[] { collection });
|
||||
return Failure("Token not accepted", "NotecardClear", new [] { collection });
|
||||
}
|
||||
if (helpers.notempty(collection) == false)
|
||||
{
|
||||
return Failure("Collection value is empty", "NotecardClear", new string[] { collection });
|
||||
return Failure("Collection value is empty", "NotecardClear", new [] { collection });
|
||||
}
|
||||
bot.ClearNotecardStorage(collection);
|
||||
return BasicReply("ok", "NotecardClear", new string[] { collection });
|
||||
return BasicReply("ok", "NotecardClear", new [] { collection });
|
||||
}
|
||||
|
||||
[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)
|
||||
{
|
||||
return Failure("Token not accepted", "NotecardSend", new string[] { avatar, collection, notecardname });
|
||||
return Failure("Token not accepted", "NotecardSend", new [] { avatar, collection, notecardname });
|
||||
}
|
||||
if (helpers.notempty(collection) == false)
|
||||
{
|
||||
return Failure("Collection value is empty", "NotecardSend", new string[] { avatar, collection, notecardname });
|
||||
return Failure("Collection value is empty", "NotecardSend", new [] { avatar, collection, notecardname });
|
||||
}
|
||||
if (helpers.notempty(notecardname) == false)
|
||||
{
|
||||
return Failure("Notecardname value is empty", "NotecardSend", new string[] { avatar, collection, notecardname });
|
||||
return Failure("Notecardname value is empty", "NotecardSend", new [] { avatar, collection, notecardname });
|
||||
}
|
||||
ProcessAvatar(avatar);
|
||||
if(avataruuid == UUID.Zero)
|
||||
{
|
||||
return Failure("Invaild avatar uuid", "NotecardSend", new string[] { avatar, collection, notecardname });
|
||||
return Failure("Invaild avatar uuid", "NotecardSend", new [] { avatar, collection, notecardname });
|
||||
}
|
||||
string content = bot.GetNotecardContent(collection);
|
||||
if (content == null)
|
||||
{
|
||||
return Failure("No content in notecard storage " + collection, "NotecardSend", new string[] { avatar, collection, notecardname });
|
||||
return Failure("No content in notecard storage " + collection, "NotecardSend", new [] { avatar, collection, notecardname });
|
||||
}
|
||||
bot.ClearNotecardStorage(collection);
|
||||
return BasicReply(bot.SendNotecard(notecardname, content, avataruuid).ToString(), "NotecardSend", new string[] { avatar, collection, notecardname });
|
||||
return BasicReply(bot.SendNotecard(notecardname, content, avataruuid).ToString(), "NotecardSend", new [] { avatar, collection, notecardname });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,15 +32,15 @@ namespace BetterSecondBot.HttpService
|
|||
KeyValuePair<bool, string> tests = SetupCurrentParcel(token, "parcel", "SetParcelSale");
|
||||
if(tests.Key == false)
|
||||
{
|
||||
return Failure(tests.Value, "SetParcelSale", new string[] { amount, avatar });
|
||||
return Failure(tests.Value, "SetParcelSale", new [] { amount, avatar });
|
||||
}
|
||||
if (int.TryParse(amount,out int amountvalue) == false)
|
||||
{
|
||||
return Failure("Invaild amount", "SetParcelSale", new string[] { amount, avatar });
|
||||
return Failure("Invaild amount", "SetParcelSale", new [] { amount, avatar });
|
||||
}
|
||||
if((amountvalue < 1) || (amountvalue > 9999999))
|
||||
{
|
||||
return Failure("Invaild amount", "SetParcelSale", new string[] { amount, avatar });
|
||||
return Failure("Invaild amount", "SetParcelSale", new [] { amount, avatar });
|
||||
}
|
||||
ProcessAvatar(avatar);
|
||||
targetparcel.SalePrice = amountvalue;
|
||||
|
|
@ -48,7 +48,7 @@ namespace BetterSecondBot.HttpService
|
|||
parcel_static.ParcelSetFlag(ParcelFlags.ForSale, targetparcel, true);
|
||||
parcel_static.ParcelSetFlag(ParcelFlags.ForSaleObjects, targetparcel, false);
|
||||
targetparcel.Update(bot.GetClient.Network.CurrentSim, false);
|
||||
return Failure("ok", "SetParcelSale", new string[] { amount, avatar });
|
||||
return Failure("ok", "SetParcelSale", new [] { amount, avatar });
|
||||
}
|
||||
|
||||
[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");
|
||||
if (tests.Key == false)
|
||||
{
|
||||
return Failure(tests.Value, "SetParcelLandingZone", new string[] { x, y, z });
|
||||
return Failure(tests.Value, "SetParcelLandingZone", new [] { x, y, z });
|
||||
}
|
||||
if(int.TryParse(x,out int X) == false)
|
||||
{
|
||||
return Failure("Unable to process landing point x value", "SetParcelLandingZone", new string[] { x, y, z });
|
||||
return Failure("Unable to process landing point x value", "SetParcelLandingZone", new [] { x, y, z });
|
||||
}
|
||||
if (int.TryParse(y, out int Y) == false)
|
||||
{
|
||||
return Failure("Unable to process landing point y value", "SetParcelLandingZone", new string[] { x, y, z });
|
||||
return Failure("Unable to process landing point y value", "SetParcelLandingZone", new [] { x, y, z });
|
||||
}
|
||||
if (int.TryParse(z, out int Z) == false)
|
||||
{
|
||||
return Failure("Unable to process landing point z value", "SetParcelLandingZone", new string[] { x, y, z });
|
||||
return Failure("Unable to process landing point z value", "SetParcelLandingZone", new [] { x, y, z });
|
||||
}
|
||||
targetparcel.Landing = LandingType.LandingPoint;
|
||||
targetparcel.UserLocation = new Vector3(X, Y, Z);
|
||||
targetparcel.Update(bot.GetClient.Network.CurrentSim, false);
|
||||
return BasicReply("ok", "SetParcelLandingZone", new string[] { x, y, z });
|
||||
return BasicReply("ok", "SetParcelLandingZone", new [] { x, y, z });
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -98,15 +98,15 @@ namespace BetterSecondBot.HttpService
|
|||
KeyValuePair<bool, string> tests = SetupCurrentParcel(token, "parcel", "SetParcelName");
|
||||
if (tests.Key == false)
|
||||
{
|
||||
return Failure(tests.Value, "SetParcelName", new string[] { name });
|
||||
return Failure(tests.Value, "SetParcelName", new [] { name });
|
||||
}
|
||||
if (helpers.notempty(name) == false)
|
||||
{
|
||||
return Failure("Parcel name is empty", "SetParcelName", new string[] { name });
|
||||
return Failure("Parcel name is empty", "SetParcelName", new [] { name });
|
||||
}
|
||||
targetparcel.Name = name;
|
||||
targetparcel.Update(bot.GetClient.Network.CurrentSim, false);
|
||||
return BasicReply("ok", "SetParcelName", new string[] { name });
|
||||
return BasicReply("ok", "SetParcelName", new [] { name });
|
||||
}
|
||||
|
||||
[About("Updates the current parcels description")]
|
||||
|
|
@ -120,11 +120,11 @@ namespace BetterSecondBot.HttpService
|
|||
KeyValuePair<bool, string> tests = SetupCurrentParcel(token, "parcel", "SetParcelDesc");
|
||||
if (tests.Key == false)
|
||||
{
|
||||
return Failure(tests.Value, "SetParcelDesc", new string[] { desc });
|
||||
return Failure(tests.Value, "SetParcelDesc", new [] { desc });
|
||||
}
|
||||
targetparcel.Desc = desc;
|
||||
targetparcel.Update(bot.GetClient.Network.CurrentSim, false);
|
||||
return BasicReply("ok", "SetParcelDesc", new string[] { desc });
|
||||
return BasicReply("ok", "SetParcelDesc", new [] { desc });
|
||||
}
|
||||
|
||||
[About("Fetchs the current parcels desc")]
|
||||
|
|
@ -137,9 +137,9 @@ namespace BetterSecondBot.HttpService
|
|||
KeyValuePair<bool, string> tests = SetupCurrentParcel(token, "parcel", "GetParcelDesc");
|
||||
if (tests.Key == false)
|
||||
{
|
||||
return Failure(tests.Value, "GetParcelDesc", new string[] { });
|
||||
return Failure(tests.Value, "GetParcelDesc", new [] { });
|
||||
}
|
||||
return BasicReply(targetparcel.Desc, "GetParcelDesc", new string[] { });
|
||||
return BasicReply(targetparcel.Desc, "GetParcelDesc", new [] { });
|
||||
}
|
||||
|
||||
[About("gets the flags for the parcel")]
|
||||
|
|
@ -152,7 +152,7 @@ namespace BetterSecondBot.HttpService
|
|||
KeyValuePair<bool, string> tests = SetupCurrentParcel(token, "parcel", "GetParcelFlags");
|
||||
if (tests.Key == false)
|
||||
{
|
||||
return Failure(tests.Value, "GetParcelFlags", new string[] { });
|
||||
return Failure(tests.Value, "GetParcelFlags", new [] { });
|
||||
}
|
||||
Dictionary<string, ParcelFlags> flags = parcel_static.get_flags_list();
|
||||
Dictionary<string, string> collection = new Dictionary<string, string>();
|
||||
|
|
@ -160,7 +160,7 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
collection.Add(cfg.ToString(), targetparcel.Flags.HasFlag(cfg).ToString());
|
||||
}
|
||||
SuccessNoReturn("GetParcelFlags", new string[] { });
|
||||
SuccessNoReturn("GetParcelFlags", new [] { });
|
||||
return collection;
|
||||
}
|
||||
|
||||
|
|
@ -173,15 +173,15 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "parcel", "ParcelEject", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "ParcelEject", new string[] { avatar });
|
||||
return Failure("Token not accepted", "ParcelEject", new [] { avatar });
|
||||
}
|
||||
ProcessAvatar(avatar);
|
||||
if(avataruuid == UUID.Zero)
|
||||
{
|
||||
return Failure("Invaild avatar", "ParcelEject", new string[] { avatar });
|
||||
return Failure("Invaild avatar", "ParcelEject", new [] { avatar });
|
||||
}
|
||||
bot.GetClient.Parcels.EjectUser(avataruuid, false);
|
||||
return BasicReply("ok", "ParcelEject", new string[] { avatar });
|
||||
return BasicReply("ok", "ParcelEject", new [] { avatar });
|
||||
}
|
||||
|
||||
[About("Abandons the parcel the bot is currently on, returning it to Linden's or Estate owner")]
|
||||
|
|
@ -192,10 +192,10 @@ namespace BetterSecondBot.HttpService
|
|||
KeyValuePair<bool, string> tests = SetupCurrentParcel(token, "parcel", "AbandonLand");
|
||||
if (tests.Key == false)
|
||||
{
|
||||
return Failure(tests.Value, "AbandonLand", new string[] { });
|
||||
return Failure(tests.Value, "AbandonLand", new [] { });
|
||||
}
|
||||
bot.GetClient.Parcels.ReleaseParcel(bot.GetClient.Network.CurrentSim, targetparcel.LocalID);
|
||||
return BasicReply("ok", "AbandonLand", new string[] { });
|
||||
return BasicReply("ok", "AbandonLand", new [] { });
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -212,12 +212,12 @@ namespace BetterSecondBot.HttpService
|
|||
KeyValuePair<bool, string> tests = SetupCurrentParcel(token, "parcel", "ParcelBan");
|
||||
if (tests.Key == false)
|
||||
{
|
||||
return Failure(tests.Value, "ParcelBan", new string[] { avatar });
|
||||
return Failure(tests.Value, "ParcelBan", new [] { avatar });
|
||||
}
|
||||
ProcessAvatar(avatar);
|
||||
if (avataruuid == UUID.Zero)
|
||||
{
|
||||
return Failure("Invaild avatar", "ParcelBan", new string[] { avatar });
|
||||
return Failure("Invaild avatar", "ParcelBan", new [] { avatar });
|
||||
}
|
||||
bool alreadyBanned = false;
|
||||
foreach (ParcelAccessEntry E in targetparcel.AccessBlackList)
|
||||
|
|
@ -230,7 +230,7 @@ namespace BetterSecondBot.HttpService
|
|||
}
|
||||
if (alreadyBanned == true)
|
||||
{
|
||||
return BasicReply("Avatar is in the blacklist", "ParcelBan", new string[] { avatar });
|
||||
return BasicReply("Avatar is in the blacklist", "ParcelBan", new [] { avatar });
|
||||
}
|
||||
ParcelAccessEntry entry = new ParcelAccessEntry();
|
||||
entry.AgentID = avataruuid;
|
||||
|
|
@ -238,7 +238,7 @@ namespace BetterSecondBot.HttpService
|
|||
entry.Time = new System.DateTime(3030, 03, 03);
|
||||
targetparcel.AccessBlackList.Add(entry);
|
||||
targetparcel.Update(bot.GetClient.Network.CurrentSim, false);
|
||||
return BasicReply("ok", "ParcelBan", new string[] { avatar });
|
||||
return BasicReply("ok", "ParcelBan", new [] { avatar });
|
||||
}
|
||||
|
||||
[About("Unbans an avatar from a parcel")]
|
||||
|
|
@ -254,12 +254,12 @@ namespace BetterSecondBot.HttpService
|
|||
KeyValuePair<bool, string> tests = SetupCurrentParcel(token, "parcel", "ParcelUnBan");
|
||||
if (tests.Key == false)
|
||||
{
|
||||
return Failure(tests.Value, "ParcelUnBan", new string[] { avatar });
|
||||
return Failure(tests.Value, "ParcelUnBan", new [] { avatar });
|
||||
}
|
||||
ProcessAvatar(avatar);
|
||||
if (avataruuid == UUID.Zero)
|
||||
{
|
||||
return Failure("Invaild avatar", "ParcelUnBan", new string[] { avatar });
|
||||
return Failure("Invaild avatar", "ParcelUnBan", new [] { avatar });
|
||||
}
|
||||
bool alreadyBanned = false;
|
||||
ParcelAccessEntry removeentry = new ParcelAccessEntry();
|
||||
|
|
@ -274,11 +274,11 @@ namespace BetterSecondBot.HttpService
|
|||
}
|
||||
if (alreadyBanned == false)
|
||||
{
|
||||
return BasicReply("Avatar is already unbanned", "ParcelUnBan", new string[] { avatar });
|
||||
return BasicReply("Avatar is already unbanned", "ParcelUnBan", new [] { avatar });
|
||||
}
|
||||
targetparcel.AccessBlackList.Remove(removeentry);
|
||||
targetparcel.Update(bot.GetClient.Network.CurrentSim, false);
|
||||
return BasicReply("ok", "ParcelUnBan", new string[] { avatar });
|
||||
return BasicReply("ok", "ParcelUnBan", new [] { avatar });
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -293,10 +293,10 @@ namespace BetterSecondBot.HttpService
|
|||
KeyValuePair<bool, string> tests = SetupCurrentParcel(token, "parcel", "SetParcelMusic");
|
||||
if (tests.Key == false)
|
||||
{
|
||||
return Failure(tests.Value, "SetParcelMusic", new string[] { musicurl });
|
||||
return Failure(tests.Value, "SetParcelMusic", new [] { musicurl });
|
||||
}
|
||||
bool status = parcel_static.set_parcel_music(bot, targetparcel, musicurl);
|
||||
return BasicReply(status.ToString(), "SetParcelMusic", new string[] { musicurl });
|
||||
return BasicReply(status.ToString(), "SetParcelMusic", new [] { musicurl });
|
||||
}
|
||||
|
||||
[About("Updates the current parcels name")]
|
||||
|
|
@ -315,7 +315,7 @@ namespace BetterSecondBot.HttpService
|
|||
KeyValuePair<bool, string> tests = SetupCurrentParcel(token, "parcel", "SetParcelFlag");
|
||||
if (tests.Key == false)
|
||||
{
|
||||
return Failure(tests.Value, "SetParcelFlag", new string[] { escapedflagdata });
|
||||
return Failure(tests.Value, "SetParcelFlag", new [] { escapedflagdata });
|
||||
}
|
||||
List<string> acceptablewords = new List<string>();
|
||||
Dictionary<string, ParcelFlags> flags = parcel_static.get_flags_list();
|
||||
|
|
@ -344,11 +344,11 @@ namespace BetterSecondBot.HttpService
|
|||
}
|
||||
if (setflags.Count == 0)
|
||||
{
|
||||
return Failure("No accepted flags", "SetParcelFlag", new string[] { escapedflagdata });
|
||||
return Failure("No accepted flags", "SetParcelFlag", new [] { escapedflagdata });
|
||||
}
|
||||
if (parcel_static.has_parcel_perm(targetparcel, bot) == false)
|
||||
{
|
||||
return Failure("Incorrect perms to control parcel", "SetParcelFlag", new string[] { escapedflagdata });
|
||||
return Failure("Incorrect perms to control parcel", "SetParcelFlag", new [] { escapedflagdata });
|
||||
}
|
||||
foreach (KeyValuePair<string, bool> cfg in setflags)
|
||||
{
|
||||
|
|
@ -358,7 +358,7 @@ namespace BetterSecondBot.HttpService
|
|||
}
|
||||
}
|
||||
targetparcel.Update(bot.GetClient.Network.CurrentSim, false);
|
||||
return BasicReply("Applying perms", "SetParcelFlag", new string[] { escapedflagdata });
|
||||
return BasicReply("Applying perms", "SetParcelFlag", new [] { escapedflagdata });
|
||||
}
|
||||
|
||||
[About("Returns all objects from the current parcel for the selected avatar")]
|
||||
|
|
@ -373,15 +373,15 @@ namespace BetterSecondBot.HttpService
|
|||
KeyValuePair<bool, string> tests = SetupCurrentParcel(token, "parcel", "ParcelReturnTargeted");
|
||||
if (tests.Key == false)
|
||||
{
|
||||
return Failure(tests.Value, "ParcelReturnTargeted", new string[] { avatar });
|
||||
return Failure(tests.Value, "ParcelReturnTargeted", new [] { avatar });
|
||||
}
|
||||
ProcessAvatar(avatar);
|
||||
if (avataruuid == UUID.Zero)
|
||||
{
|
||||
return Failure("Invaild avatar UUID", "ParcelReturnTargeted", new string[] { avatar });
|
||||
return Failure("Invaild avatar UUID", "ParcelReturnTargeted", new [] { avatar });
|
||||
}
|
||||
bot.GetClient.Parcels.ReturnObjects(bot.GetClient.Network.CurrentSim, targetparcel.LocalID, ObjectReturnType.None, new List<UUID>() { avataruuid });
|
||||
return BasicReply("ok", "ParcelReturnTargeted", new string[] { avatar });
|
||||
return BasicReply("ok", "ParcelReturnTargeted", new [] { avatar });
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -397,21 +397,21 @@ namespace BetterSecondBot.HttpService
|
|||
KeyValuePair<bool, string> tests = SetupCurrentParcel(token, "parcel", "ParcelDeedToGroup");
|
||||
if (tests.Key == false)
|
||||
{
|
||||
return Failure(tests.Value, "ParcelDeedToGroup", new string[] { group });
|
||||
return Failure(tests.Value, "ParcelDeedToGroup", new [] { group });
|
||||
}
|
||||
if (UUID.TryParse(group, out UUID groupuuid) == false)
|
||||
{
|
||||
return Failure("Invaild group uuid", "ParcelDeedToGroup", new string[] { group });
|
||||
return Failure("Invaild group uuid", "ParcelDeedToGroup", new [] { group });
|
||||
}
|
||||
if (bot.MyGroups.ContainsKey(groupuuid) == false)
|
||||
{
|
||||
return Failure("Not in group", "ParcelDeedToGroup", new string[] { group });
|
||||
return Failure("Not in group", "ParcelDeedToGroup", new [] { group });
|
||||
}
|
||||
targetparcel.GroupID = groupuuid;
|
||||
targetparcel.Update(bot.GetClient.Network.CurrentSim, false);
|
||||
Thread.Sleep(500);
|
||||
bot.GetClient.Parcels.DeedToGroup(bot.GetClient.Network.CurrentSim, targetparcel.LocalID, groupuuid);
|
||||
return BasicReply("ok", "ParcelDeedToGroup", new string[] { group });
|
||||
return BasicReply("ok", "ParcelDeedToGroup", new [] { group });
|
||||
}
|
||||
|
||||
[About("Attempts to buy the parcel the bot is standing on, the amount must match the sale price for the land!")]
|
||||
|
|
@ -430,30 +430,30 @@ namespace BetterSecondBot.HttpService
|
|||
KeyValuePair<bool, string> tests = SetupCurrentParcel(token, "parcel", "ParcelBuy");
|
||||
if (tests.Key == false)
|
||||
{
|
||||
return Failure(tests.Value, "ParcelBuy", new string[] { amount });
|
||||
return Failure(tests.Value, "ParcelBuy", new [] { amount });
|
||||
}
|
||||
if (int.TryParse(amount, out int amountvalue) == false)
|
||||
{
|
||||
return Failure("Invaild amount", "ParcelBuy", new string[] { amount });
|
||||
return Failure("Invaild amount", "ParcelBuy", new [] { amount });
|
||||
}
|
||||
if (amountvalue < 1)
|
||||
{
|
||||
return Failure("Invaild amount", "ParcelBuy", new string[] { amount });
|
||||
return Failure("Invaild amount", "ParcelBuy", new [] { amount });
|
||||
};
|
||||
if (targetparcel.Flags.HasFlag(ParcelFlags.ForSale) == false)
|
||||
{
|
||||
return Failure("Parcel not for sale", "ParcelBuy", new string[] { amount });
|
||||
return Failure("Parcel not for sale", "ParcelBuy", new [] { amount });
|
||||
}
|
||||
if ((targetparcel.AuthBuyerID != UUID.Zero) && (targetparcel.AuthBuyerID != bot.GetClient.Self.AgentID))
|
||||
{
|
||||
return Failure("Parcel sale locked to other avatars", "ParcelBuy", new string[] { amount });
|
||||
return Failure("Parcel sale locked to other avatars", "ParcelBuy", new [] { amount });
|
||||
}
|
||||
if (targetparcel.SalePrice != amountvalue)
|
||||
{
|
||||
return Failure("Parcel sale price and amount do not match", "ParcelBuy", new string[] { amount });
|
||||
return Failure("Parcel sale price and amount do not match", "ParcelBuy", new [] { amount });
|
||||
}
|
||||
bot.GetClient.Parcels.Buy(bot.GetClient.Network.CurrentSim, targetparcel.LocalID, false, UUID.Zero, false, targetparcel.Area, amountvalue);
|
||||
return BasicReply("ok", "ParcelBuy", new string[] { amount });
|
||||
return BasicReply("ok", "ParcelBuy", new [] { amount });
|
||||
}
|
||||
|
||||
[About("Freezes an avatar")]
|
||||
|
|
@ -467,19 +467,19 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "parcel", "ParcelFreeze", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "ParcelFreeze", new string[] { avatar, state });
|
||||
return Failure("Token not accepted", "ParcelFreeze", new [] { avatar, state });
|
||||
}
|
||||
if(bool.TryParse(state, out bool freezestate) == false)
|
||||
{
|
||||
return Failure("Invaild state", "ParcelFreeze", new string[] { avatar, state });
|
||||
return Failure("Invaild state", "ParcelFreeze", new [] { avatar, state });
|
||||
}
|
||||
ProcessAvatar(avatar);
|
||||
if (avataruuid == UUID.Zero)
|
||||
{
|
||||
return Failure("Invaild avatar UUID", "ParcelFreeze", new string[] { avatar, state });
|
||||
return Failure("Invaild avatar UUID", "ParcelFreeze", new [] { avatar, state });
|
||||
}
|
||||
bot.GetClient.Parcels.FreezeUser(avataruuid, freezestate);
|
||||
return BasicReply("ok", "ParcelFreeze", new string[] { avatar, state });
|
||||
return BasicReply("ok", "ParcelFreeze", new [] { avatar, state });
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -493,7 +493,7 @@ namespace BetterSecondBot.HttpService
|
|||
KeyValuePair<bool, string> tests = SetupCurrentParcel(token, "parcel", "GetParcelBanlist");
|
||||
if (tests.Key == false)
|
||||
{
|
||||
return Failure(tests.Value, "GetParcelBanlist", new string[] { });
|
||||
return Failure(tests.Value, "GetParcelBanlist", new [] { });
|
||||
}
|
||||
GetParcelBanlistObject reply = new GetParcelBanlistObject();
|
||||
int delays = 0;
|
||||
|
|
@ -526,7 +526,7 @@ namespace BetterSecondBot.HttpService
|
|||
reply.delay = delays * 1000;
|
||||
reply.parcelName = targetparcel.Name;
|
||||
reply.regionName = bot.GetClient.Network.CurrentSim.Name;
|
||||
return BasicReply(JsonConvert.SerializeObject(reply), "GetParcelBanlist", new string[] { });
|
||||
return BasicReply(JsonConvert.SerializeObject(reply), "GetParcelBanlist", new [] { });
|
||||
}
|
||||
|
||||
[About("Returns a rezzed object")]
|
||||
|
|
@ -539,11 +539,11 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "parcel", "UnRezObject", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "UnRezObject", new string[] { objectuuid });
|
||||
return Failure("Token not accepted", "UnRezObject", new [] { objectuuid });
|
||||
}
|
||||
if (UUID.TryParse(objectuuid, out UUID targetobject) == false)
|
||||
{
|
||||
return Failure("Invaild object uuid", "UnRezObject", new string[] { objectuuid });
|
||||
return Failure("Invaild object uuid", "UnRezObject", new [] { objectuuid });
|
||||
}
|
||||
bool found = false;
|
||||
Dictionary<uint, Primitive> objects_copy = bot.GetClient.Network.CurrentSim.ObjectsPrimitives.Copy();
|
||||
|
|
@ -558,9 +558,9 @@ namespace BetterSecondBot.HttpService
|
|||
}
|
||||
if(found == false)
|
||||
{
|
||||
return Failure("Unable to find object", "UnRezObject", new string[] { objectuuid });
|
||||
return Failure("Unable to find object", "UnRezObject", new [] { objectuuid });
|
||||
}
|
||||
return BasicReply("ok", "UnRezObject", new string[] { objectuuid });
|
||||
return BasicReply("ok", "UnRezObject", new [] { objectuuid });
|
||||
}
|
||||
|
||||
[About("Updates the current parcels media settings \n" +
|
||||
|
|
@ -583,7 +583,7 @@ namespace BetterSecondBot.HttpService
|
|||
KeyValuePair<bool, string> tests = SetupCurrentParcel(token, "parcel", "ParcelSetMedia");
|
||||
if (tests.Key == false)
|
||||
{
|
||||
return Failure(tests.Value, "ParcelSetMedia", new string[] { escapedflagdata });
|
||||
return Failure(tests.Value, "ParcelSetMedia", new [] { escapedflagdata });
|
||||
}
|
||||
string[] args = escapedflagdata.Split(":::");
|
||||
foreach (string A in args)
|
||||
|
|
@ -644,7 +644,7 @@ namespace BetterSecondBot.HttpService
|
|||
}
|
||||
}
|
||||
targetparcel.Update(bot.GetClient.Network.CurrentSim, false);
|
||||
return BasicReply("ok", "ParcelSetMedia", new string[] { escapedflagdata });
|
||||
return BasicReply("ok", "ParcelSetMedia", new [] { escapedflagdata });
|
||||
}
|
||||
|
||||
protected bool UpdateParcel_MediaType(Parcel targetparcel, string value)
|
||||
|
|
|
|||
|
|
@ -25,12 +25,12 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "self", "PointAt", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "PointAt", new string[] { avatar });
|
||||
return Failure("Token not accepted", "PointAt", new [] { avatar });
|
||||
}
|
||||
ProcessAvatar(avatar);
|
||||
if (bot.GetClient.Network.CurrentSim.AvatarPositions.ContainsKey(avataruuid) == false)
|
||||
{
|
||||
return Failure("Cant find UUID in sim", "PointAt", new string[] { avatar });
|
||||
return Failure("Cant find UUID in sim", "PointAt", new [] { avatar });
|
||||
}
|
||||
bot.ResetAnimations();
|
||||
bot.GetClient.Self.Stand();
|
||||
|
|
@ -39,7 +39,7 @@ namespace BetterSecondBot.HttpService
|
|||
bot.GetClient.Self.AnimationStart(Animations.POINT_YOU, true);
|
||||
bot.GetClient.Self.PointAtEffect(bot.GetClient.Self.AgentID, avataruuid, new Vector3d(0, 0, 0), PointAtType.Select, UUID.Random());
|
||||
bot.GetClient.Self.BeamEffect(bot.GetClient.Self.AgentID, avataruuid, new Vector3d(0, 0, 2), new Color4(255, 255, 255, 1), (float)3.0, UUID.Random());
|
||||
return BasicReply("ok", "PointAt", new string[] { avatar });
|
||||
return BasicReply("ok", "PointAt", new [] { avatar });
|
||||
}
|
||||
|
||||
[About("Makes the bot sit on the ground or on a object if it can see it")]
|
||||
|
|
@ -51,19 +51,19 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "self", "Sit", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "Sit", new string[] { target });
|
||||
return Failure("Token not accepted", "Sit", new [] { target });
|
||||
}
|
||||
if(target == "ground")
|
||||
{
|
||||
bot.GetClient.Self.SitOnGround();
|
||||
return BasicReply("ok", "Sit", new string[] { target });
|
||||
return BasicReply("ok", "Sit", new [] { target });
|
||||
}
|
||||
if(UUID.TryParse(target,out UUID objectuuid) == false)
|
||||
{
|
||||
return Failure("Invaild object UUID", "Sit", new string[] { target });
|
||||
return Failure("Invaild object UUID", "Sit", new [] { target });
|
||||
}
|
||||
bot.GetClient.Self.RequestSit(objectuuid, Vector3.Zero);
|
||||
return BasicReply("ok", "Sit", new string[] { target });
|
||||
return BasicReply("ok", "Sit", new [] { target });
|
||||
}
|
||||
|
||||
[About("Makes the bot stand up if sitting (also resets animations)")]
|
||||
|
|
@ -73,11 +73,11 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "self", "Stand", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "Stand", new string[] { });
|
||||
return Failure("Token not accepted", "Stand", new [] { });
|
||||
}
|
||||
bot.GetClient.Self.Stand();
|
||||
bot.ResetAnimations();
|
||||
return BasicReply("ok", "Stand", new string[] { });
|
||||
return BasicReply("ok", "Stand", new [] { });
|
||||
}
|
||||
|
||||
[About("Makes the bot sit on the ground or on a object if it can see it")]
|
||||
|
|
@ -90,11 +90,11 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "self", "ClickObject", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "ClickObject", new string[] { target });
|
||||
return Failure("Token not accepted", "ClickObject", new [] { target });
|
||||
}
|
||||
if (UUID.TryParse(target, out UUID objectuuid) == false)
|
||||
{
|
||||
return Failure("Invaild object UUID", "ClickObject", new string[] { target });
|
||||
return Failure("Invaild object UUID", "ClickObject", new [] { target });
|
||||
}
|
||||
Dictionary<uint, Primitive> objectsentrys = bot.GetClient.Network.CurrentSim.ObjectsPrimitives.Copy();
|
||||
bool found_object = false;
|
||||
|
|
@ -107,7 +107,7 @@ namespace BetterSecondBot.HttpService
|
|||
break;
|
||||
}
|
||||
}
|
||||
return BasicReply(found_object.ToString(), "ClickObject", new string[] { target });
|
||||
return BasicReply(found_object.ToString(), "ClickObject", new [] { target });
|
||||
}
|
||||
|
||||
[About("Makes the bot kill itself you monster")]
|
||||
|
|
@ -117,14 +117,14 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "self", "Logoff", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "Logoff", new string[] { });
|
||||
return Failure("Token not accepted", "Logoff", new [] { });
|
||||
}
|
||||
if (bot.KillMe == false)
|
||||
{
|
||||
bot.GetClient.Self.Chat("Laters im out", 0, ChatType.Normal);
|
||||
bot.KillMePlease();
|
||||
}
|
||||
return BasicReply("ok", "Logoff", new string[] { });
|
||||
return BasicReply("ok", "Logoff", new [] { });
|
||||
}
|
||||
|
||||
[About("Makes the bot kill itself you monster")]
|
||||
|
|
@ -134,14 +134,14 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "self", "Logout", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "Logout", new string[] { });
|
||||
return Failure("Token not accepted", "Logout", new [] { });
|
||||
}
|
||||
if (bot.KillMe == false)
|
||||
{
|
||||
bot.GetClient.Self.Chat("Laters im out", 0, ChatType.Normal);
|
||||
bot.KillMePlease();
|
||||
}
|
||||
return BasicReply("ok", "Logout", new string[] { });
|
||||
return BasicReply("ok", "Logout", new [] { });
|
||||
}
|
||||
|
||||
[About("Makes the bot kill itself you monster - without making a sound")]
|
||||
|
|
@ -151,13 +151,13 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "self", "Bye", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "Bye", new string[] { });
|
||||
return Failure("Token not accepted", "Bye", new [] { });
|
||||
}
|
||||
if (bot.KillMe == false)
|
||||
{
|
||||
bot.KillMePlease();
|
||||
}
|
||||
return BasicReply("ok", "Bye", new string[] { });
|
||||
return BasicReply("ok", "Bye", new [] { });
|
||||
}
|
||||
|
||||
[About("Gets the last 5 commands issued to the bot")]
|
||||
|
|
@ -167,9 +167,9 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "self", "GetLastCommands", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "GetLastCommands", new string[] { });
|
||||
return Failure("Token not accepted", "GetLastCommands", new [] { });
|
||||
}
|
||||
SuccessNoReturn("GetLastCommands", new string[] { });
|
||||
SuccessNoReturn("GetLastCommands", new [] { });
|
||||
return bot.GetLastCommands(5);
|
||||
}
|
||||
|
||||
|
|
@ -187,35 +187,35 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "self", "SetPermFlag", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "SetPermFlag", new string[] { avatar, flag, state, sticky });
|
||||
return Failure("Token not accepted", "SetPermFlag", new [] { avatar, flag, state, sticky });
|
||||
}
|
||||
ProcessAvatar(avatar);
|
||||
if (avataruuid == UUID.Zero)
|
||||
{
|
||||
return Failure("avatar lookup", "SetPermFlag", new string[] { avatar, flag, state, sticky });
|
||||
return Failure("avatar lookup", "SetPermFlag", new [] { avatar, flag, state, sticky });
|
||||
}
|
||||
bool stateflag = false;
|
||||
bool stickyflag = false;
|
||||
if(bool.TryParse(state,out stateflag) == false)
|
||||
{
|
||||
return Failure("Invaild state", "SetPermFlag", new string[] { avatar, flag, state, sticky });
|
||||
return Failure("Invaild state", "SetPermFlag", new [] { avatar, flag, state, sticky });
|
||||
}
|
||||
if (bool.TryParse(sticky, out stickyflag) == false)
|
||||
{
|
||||
return Failure("Invaild sticky", "SetPermFlag", new string[] { avatar, flag, state, sticky });
|
||||
return Failure("Invaild sticky", "SetPermFlag", new [] { avatar, flag, state, sticky });
|
||||
}
|
||||
string[] AcceptedFlags = new string[] { "friend", "group", "animation", "teleport", "command" };
|
||||
string[] AcceptedFlags = new [] { "friend", "group", "animation", "teleport", "command" };
|
||||
if (AcceptedFlags.Contains(flag) == false)
|
||||
{
|
||||
return Failure("Invaild flag", "SetPermFlag", new string[] { avatar, flag, state, sticky });
|
||||
return Failure("Invaild flag", "SetPermFlag", new [] { avatar, flag, state, sticky });
|
||||
}
|
||||
if (stateflag == true)
|
||||
{
|
||||
bot.Add_action_from(flag, avataruuid, bot.FindAvatarKey2Name(avataruuid), stickyflag);
|
||||
return BasicReply("Added perm: " + flag + " Sticky: " + stickyflag.ToString(), "SetPermFlag", new string[] { avatar, flag, state, sticky });
|
||||
return BasicReply("Added perm: " + flag + " Sticky: " + stickyflag.ToString(), "SetPermFlag", new [] { avatar, flag, state, sticky });
|
||||
}
|
||||
bot.Remove_action_from(flag, avataruuid, stickyflag);
|
||||
return BasicReply("Removed perm: " + flag + " Sticky: " + stickyflag.ToString(), "SetPermFlag", new string[] { avatar, flag, state, sticky });
|
||||
return BasicReply("Removed perm: " + flag + " Sticky: " + stickyflag.ToString(), "SetPermFlag", new [] { avatar, flag, state, sticky });
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -33,15 +33,15 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
if (tokens.Allow(token, "streamadmin", "FetchNextNotecard", handleGetClientIP()) == false)
|
||||
{
|
||||
return Failure("Token not accepted", "FetchNextNotecard", new string[] { endpoint, endpointcode });
|
||||
return Failure("Token not accepted", "FetchNextNotecard", new [] { endpoint, endpointcode });
|
||||
}
|
||||
if(helpers.notempty(endpoint) == false)
|
||||
{
|
||||
return Failure("Endpoint is empty", "FetchNextNotecard", new string[] { endpoint, endpointcode });
|
||||
return Failure("Endpoint is empty", "FetchNextNotecard", new [] { endpoint, endpointcode });
|
||||
}
|
||||
if (helpers.notempty(endpointcode) == false)
|
||||
{
|
||||
return Failure("Endpointcode is empty", "FetchNextNotecard", new string[] { endpoint, endpointcode });
|
||||
return Failure("Endpointcode is empty", "FetchNextNotecard", new [] { endpoint, endpointcode });
|
||||
}
|
||||
|
||||
string attempt_endpoint = endpoint + "endpoint.php";
|
||||
|
|
@ -53,24 +53,24 @@ namespace BetterSecondBot.HttpService
|
|||
IRestResponse endpoint_checks = client.Post(request);
|
||||
if (endpoint_checks.StatusCode != System.Net.HttpStatusCode.OK)
|
||||
{
|
||||
return Failure("HTTP status code: " + endpoint_checks.StatusCode.ToString(), "FetchNextNotecard", new string[] { endpoint, endpointcode });
|
||||
return Failure("HTTP status code: " + endpoint_checks.StatusCode.ToString(), "FetchNextNotecard", new [] { endpoint, endpointcode });
|
||||
}
|
||||
try
|
||||
{
|
||||
notecardendpoint server_reply = JsonConvert.DeserializeObject<notecardendpoint>(endpoint_checks.Content);
|
||||
if (server_reply.status == false)
|
||||
{
|
||||
return Failure("Bad reply: " + server_reply.message, "FetchNextNotecard", new string[] { endpoint, endpointcode });
|
||||
return Failure("Bad reply: " + server_reply.message, "FetchNextNotecard", new [] { endpoint, endpointcode });
|
||||
}
|
||||
if (server_reply.NotecardTitle.Length < 3)
|
||||
{
|
||||
return Failure("Notecard title is to short", "FetchNextNotecard", new string[] { endpoint, endpointcode });
|
||||
return Failure("Notecard title is to short", "FetchNextNotecard", new [] { endpoint, endpointcode });
|
||||
}
|
||||
return BasicReply(bot.SendNotecard(server_reply.NotecardTitle, server_reply.NotecardContent, (UUID)server_reply.AvatarUUID).ToString(), "FetchNextNotecard", new string[] { endpoint, endpointcode });
|
||||
return BasicReply(bot.SendNotecard(server_reply.NotecardTitle, server_reply.NotecardContent, (UUID)server_reply.AvatarUUID).ToString(), "FetchNextNotecard", new [] { endpoint, endpointcode });
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return Failure("Error: " + e.Message + "", "FetchNextNotecard", new string[] { endpoint, endpointcode });
|
||||
return Failure("Error: " + e.Message + "", "FetchNextNotecard", new [] { endpoint, endpointcode });
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ namespace BetterSecondBot.HttpService
|
|||
{
|
||||
JsonScopedTokens LoadedTokens = new JsonScopedTokens
|
||||
{
|
||||
ScopedTokens = new string[] { "t:[XXX],ws:core" }
|
||||
ScopedTokens = new [] { "t:[XXX],ws:core" }
|
||||
};
|
||||
string targetfile = "scoped_tokens.json";
|
||||
SimpleIO io = new SimpleIO();
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ namespace BetterSecondBot.bottypes
|
|||
base.AfterBotLoginHandler();
|
||||
}
|
||||
|
||||
readonly string[] hard_blocked_agents = new string[] { "secondlife", "second life"};
|
||||
readonly string[] hard_blocked_agents = new [] { "secondlife", "second life"};
|
||||
protected override void ChatInputHandler(object sender, ChatEventArgs e)
|
||||
{
|
||||
bool fromme = false;
|
||||
|
|
|
|||
|
|
@ -29,10 +29,10 @@ namespace BetterSecondBot.bottypes
|
|||
started_friendship_hug = true;
|
||||
if (Client.Friends.FriendList.ContainsKey(master_uuid) == false)
|
||||
{
|
||||
CallAPI("IM", new string[] { myconfig.Security_MasterUsername, "Hello master, I am sending you a friend request now!" });
|
||||
CallAPI("FriendRequest", new string[] { master_uuid.ToString(), "true" });
|
||||
CallAPI("IM", new [] { myconfig.Security_MasterUsername, "Hello master, I am sending you a friend request now!" });
|
||||
CallAPI("FriendRequest", new [] { master_uuid.ToString(), "true" });
|
||||
}
|
||||
CallAPI("FriendFullPerms", new string[] { master_uuid.ToString(), "true" });
|
||||
CallAPI("FriendFullPerms", new [] { master_uuid.ToString(), "true" });
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -61,7 +61,7 @@ namespace BetterSecondBot.bottypes
|
|||
{
|
||||
if(E.AgentName == myconfig.Security_MasterUsername)
|
||||
{
|
||||
CallAPI("FriendFullPerms", new string[] { myconfig.Security_MasterUsername, "true" });
|
||||
CallAPI("FriendFullPerms", new [] { myconfig.Security_MasterUsername, "true" });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -481,7 +481,7 @@ namespace OpenMetaverse
|
|||
Client.Network.RegisterCallback(PacketType.FindAgent, OnFindAgentReplyHandler);
|
||||
|
||||
Client.Network.RegisterLoginResponseCallback(new NetworkManager.LoginResponseCallback(Network_OnLoginResponse),
|
||||
new string[] { "buddy-list" });
|
||||
new [] { "buddy-list" });
|
||||
}
|
||||
|
||||
#region Public Methods
|
||||
|
|
|
|||
|
|
@ -377,7 +377,7 @@ namespace OpenMetaverse
|
|||
#region String Arrays
|
||||
|
||||
/// <summary>Partial mapping of FolderTypes to folder names</summary>
|
||||
private static readonly string[] _NewFolderNames = new string[]
|
||||
private static readonly string[] _NewFolderNames = new []
|
||||
{
|
||||
"Textures", // 0
|
||||
"Sounds", // 1
|
||||
|
|
@ -486,7 +486,7 @@ namespace OpenMetaverse
|
|||
// Register extra parameters with login and parse the inventory data that comes back
|
||||
Client.Network.RegisterLoginResponseCallback(
|
||||
Network_OnLoginResponse,
|
||||
new string[] {
|
||||
new [] {
|
||||
"inventory-root", "inventory-skeleton", "inventory-lib-root",
|
||||
"inventory-lib-owner", "inventory-skel-lib"});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ namespace OpenMetaverse
|
|||
public object Value;
|
||||
|
||||
|
||||
private static readonly string[] TypeStrings = new string[]
|
||||
private static readonly string[] TypeStrings = new []
|
||||
{
|
||||
"STRING",
|
||||
"F32",
|
||||
|
|
@ -118,13 +118,13 @@ namespace OpenMetaverse
|
|||
"ASSET",
|
||||
"U64"
|
||||
};
|
||||
private static readonly string[] ClassStrings = new string[]
|
||||
private static readonly string[] ClassStrings = new []
|
||||
{
|
||||
"R", // Read-only
|
||||
"RW", // Read-write
|
||||
"CB" // Callback
|
||||
};
|
||||
private static readonly string[] SendtoStrings = new string[]
|
||||
private static readonly string[] SendtoStrings = new []
|
||||
{
|
||||
"S", // Sim
|
||||
"DS", // Data Sim
|
||||
|
|
|
|||
|
|
@ -1301,7 +1301,7 @@ namespace OpenMetaverse
|
|||
/// <param name="name">A string containing the new name of the object</param>
|
||||
public void SetName(Simulator simulator, uint localID, string name)
|
||||
{
|
||||
SetNames(simulator, new uint[] { localID }, new string[] { name });
|
||||
SetNames(simulator, new uint[] { localID }, new [] { name });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -1336,7 +1336,7 @@ namespace OpenMetaverse
|
|||
/// <param name="description">A string containing the new description of the object</param>
|
||||
public void SetDescription(Simulator simulator, uint localID, string description)
|
||||
{
|
||||
SetDescriptions(simulator, new uint[] { localID }, new string[] { description });
|
||||
SetDescriptions(simulator, new uint[] { localID }, new [] { description });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@ namespace BetterSecondBotShared.API
|
|||
public string CommandName { get { return GetType().Name.ToLowerInvariant(); ; } }
|
||||
public virtual int Min_Required_args { get { return 0; } }
|
||||
public virtual string Helpfile { get { return "No help given"; } }
|
||||
public virtual string[] ArgTypes { get { return new string[] { }; } }
|
||||
public virtual string[] ArgHints { get { return new string[] { }; } }
|
||||
public virtual string[] ArgTypes { get { return new [] { }; } }
|
||||
public virtual string[] ArgHints { get { return new [] { }; } }
|
||||
|
||||
protected string InfoBlob = "";
|
||||
public string GetInfoBlob { get { return InfoBlob; } }
|
||||
|
|
@ -162,7 +162,7 @@ namespace BetterSecondBotShared.API
|
|||
{
|
||||
return CmdGet.ArgTypes;
|
||||
}
|
||||
return new string[] { };
|
||||
return new [] { };
|
||||
}
|
||||
public virtual string[] GetCommandArgHints(string cmd)
|
||||
{
|
||||
|
|
@ -171,7 +171,7 @@ namespace BetterSecondBotShared.API
|
|||
{
|
||||
return CmdGet.ArgHints;
|
||||
}
|
||||
return new string[] { };
|
||||
return new [] { };
|
||||
}
|
||||
|
||||
public virtual List<string> GetAllWorkspaces()
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ namespace BetterSecondBotShared.bottypes
|
|||
string name = env.Key.ToString();
|
||||
if (name.StartsWith("cmd_") == true)
|
||||
{
|
||||
string[] steps = env.Value.ToString().Split(new string[] { "{-}" }, StringSplitOptions.None);
|
||||
string[] steps = env.Value.ToString().Split(new [] { "{-}" }, StringSplitOptions.None);
|
||||
name = name.Replace("cmd_", "");
|
||||
name = name.ToLowerInvariant();
|
||||
custom_commands.Add(name, steps);
|
||||
|
|
@ -98,7 +98,7 @@ namespace BetterSecondBotShared.bottypes
|
|||
// search for file called "commands.cmd"
|
||||
JsonCommandsfile LoadedCommands = new JsonCommandsfile
|
||||
{
|
||||
CustomCommands = new string[] { "sayexample!!!say|||Hello{-}delay|||2500{-}say|||Bye" }
|
||||
CustomCommands = new [] { "sayexample!!!say|||Hello{-}delay|||2500{-}say|||Bye" }
|
||||
};
|
||||
string CommandsFile = "custom_commands.json";
|
||||
SimpleIO io = new SimpleIO();
|
||||
|
|
@ -114,10 +114,10 @@ namespace BetterSecondBotShared.bottypes
|
|||
LoadedCommands = JsonConvert.DeserializeObject<JsonCommandsfile>(json);
|
||||
foreach (string loaded in LoadedCommands.CustomCommands)
|
||||
{
|
||||
string[] bits = loaded.Split(new string[] { "!!!" }, StringSplitOptions.None);
|
||||
string[] bits = loaded.Split(new [] { "!!!" }, StringSplitOptions.None);
|
||||
if (bits.Length == 2)
|
||||
{
|
||||
string[] steps = bits[1].Split(new string[] { "{-}" }, StringSplitOptions.None);
|
||||
string[] steps = bits[1].Split(new [] { "{-}" }, StringSplitOptions.None);
|
||||
custom_commands.Add(bits[0].ToLowerInvariant(), steps);
|
||||
}
|
||||
}
|
||||
|
|
@ -202,7 +202,7 @@ namespace BetterSecondBotShared.bottypes
|
|||
}
|
||||
protected virtual string[] getNextHomeArgs()
|
||||
{
|
||||
return new string[] { };
|
||||
return new [] { };
|
||||
}
|
||||
public virtual void Start()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -181,7 +181,7 @@ namespace BetterSecondBotShared.Json
|
|||
|
||||
public override string[] GetCommandArgHints(string cmd)
|
||||
{
|
||||
return new string[] { JsonGetCommandArgHints(cmd) };
|
||||
return new [] { JsonGetCommandArgHints(cmd) };
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue