corrects some breaking bugs and cleans up a bit

This commit is contained in:
Madpeterz 2021-03-25 10:56:10 +00:00
parent 13cf967f84
commit 109a34bf60
28 changed files with 232 additions and 218 deletions

View file

@ -14,14 +14,14 @@ namespace BetterSecondbot.BetterAtHome
protected JsonConfig configfile;
protected bool LoginFailed = false;
protected bool LoginFailed ;
protected string whyfailed = "";
protected string whyloggedout = "";
protected bool LoggingIn = true;
protected bool LoggedIn = false;
protected bool StartingLogin = false;
protected bool LoggedIn;
protected bool StartingLogin;
protected long LastLoginEvent = 0;
protected bool FiredAfterLogin = false;
protected bool FiredAfterLogin;
protected int homeregionIndexer = 0;
protected long LastTeleportEvent = 0;
protected List<string> homeRegions = new List<string>();
@ -43,11 +43,11 @@ namespace BetterSecondbot.BetterAtHome
protected void attach_events()
{
controler.Bot.ChangeSimEvent += ChangedSim;
controler.Bot.AlertMessage += AlertMessage;
controler.Bot.StatusMessageEvent += StatusPing;
controler.Bot.LoginProgess += LoginProcess;
controler.Bot.NextHomeRegion += NextHomeRegionRequest;
controler.getBot().ChangeSimEvent += ChangedSim;
controler.getBot().AlertMessage += AlertMessage;
controler.getBot().StatusMessageEvent += StatusPing;
controler.getBot().LoginProgess += LoginProcess;
controler.getBot().NextHomeRegion += NextHomeRegionRequest;
}
protected void resetSwitchs()
@ -108,7 +108,7 @@ namespace BetterSecondbot.BetterAtHome
whyloggedout = "No control";
return false;
}
if (controler.Bot == null)
if (controler.getBot() == null)
{
whyloggedout = "No Bot";
return false;
@ -122,12 +122,12 @@ namespace BetterSecondbot.BetterAtHome
{
return false;
}
if (controler.Bot.GetClient == null)
if (controler.getBot().GetClient == null)
{
whyloggedout = "No client";
return false;
}
if (controler.Bot.GetClient.Network == null)
if (controler.getBot().GetClient.Network == null)
{
whyloggedout = "No network";
return false;
@ -161,7 +161,7 @@ namespace BetterSecondbot.BetterAtHome
return false;
}
whyloggedout = "";
return controler.Bot.GetClient.Network.Connected;
return controler.getBot().GetClient.Network.Connected;
}
protected string lastwarn = "";
@ -170,8 +170,8 @@ namespace BetterSecondbot.BetterAtHome
{
if(hasBasicBot() == true)
{
//controler.Bot.SetBetterAtHomeAction(whyloggedout+" "+message);
controler.Bot.SetBetterAtHomeAction(message);
//controler.getBot().SetBetterAtHomeAction(whyloggedout+" "+message);
controler.getBot().SetBetterAtHomeAction(message);
}
/*
* extra debug stuff
@ -214,9 +214,9 @@ namespace BetterSecondbot.BetterAtHome
protected void ChangedSim(object o, SimChangedEventArgs e)
{
simname = "";
if (controler.Bot.GetClient.Network.CurrentSim != null)
if (controler.getBot().GetClient.Network.CurrentSim != null)
{
simname = controler.Bot.GetClient.Network.CurrentSim.Name;
simname = controler.getBot().GetClient.Network.CurrentSim.Name;
}
}
@ -269,7 +269,7 @@ namespace BetterSecondbot.BetterAtHome
protected void LoggedOutActions()
{
SetBetterAtHomeAction("Logged Out Actions");
if (controler.Bot.KillMe == true)
if (controler.getBot().KillMe == true)
{
SetBetterAtHomeAction("Marked for death");
return;
@ -311,13 +311,13 @@ namespace BetterSecondbot.BetterAtHome
SetBetterAtHomeAction("[DC] Attempting login");
resetSwitchs();
StartingLogin = true;
controler.Bot.Start();
controler.getBot().Start();
}
protected void LoggedInAction()
{
SetBetterAtHomeAction("Logged In Actions");
if (controler.Bot.KillMe == true)
if (controler.getBot().KillMe == true)
{
SetBetterAtHomeAction("Marked for death");
return;
@ -334,11 +334,11 @@ namespace BetterSecondbot.BetterAtHome
SetBetterAtHomeAction("Waiting for Teleport lockout");
return;
}
if ((simname == "") || (controler.Bot.GetClient.Self.SimPosition.Z == 0))
if ((simname == "") || (controler.getBot().GetClient.Self.SimPosition.Z == 0))
{
ChangedSim(null, null);
}
if ((simname == "") || (controler.Bot.GetClient.Self.SimPosition.Z == 0))
if ((simname == "") || (controler.getBot().GetClient.Self.SimPosition.Z == 0))
{
void_counter++;
SetBetterAtHomeAction("Void counter: " + void_counter.ToString());
@ -353,8 +353,8 @@ namespace BetterSecondbot.BetterAtHome
if (FiredAfterLogin == false)
{
FiredAfterLogin = true;
controler.Bot.AfterBotLoginHandler();
controler.Bot.reconnect = true;
controler.getBot().AfterBotLoginHandler();
controler.getBot().reconnect = true;
SetBetterAtHomeAction("Starting after login events");
return;
}
@ -365,7 +365,7 @@ namespace BetterSecondbot.BetterAtHome
gotoNextHomeRegion(true);
return;
}
if (controler.Bot.TeleportStatus() == true)
if (controler.getBot().TeleportStatus() == true)
{
SetBetterAtHomeAction("Teleported");
return;
@ -415,18 +415,18 @@ namespace BetterSecondbot.BetterAtHome
SetBetterAtHomeAction("Teleporting to home region: " + homeRegions[homeregionIndexer] + "");
LastTeleportEvent = helpers.UnixTimeNow();
controler.Bot.TeleportWithSLurl(configfile.Basic_HomeRegions[homeregionIndexer]);
controler.getBot().TeleportWithSLurl(configfile.Basic_HomeRegions[homeregionIndexer]);
}
protected bool IsAtHome()
{
if ((simname == "") || (FiredAfterLogin == false))
{
if (controler.Bot.GetClient.Network.CurrentSim == null)
if (controler.getBot().GetClient.Network.CurrentSim == null)
{
return true;
}
simname = controler.Bot.GetClient.Network.CurrentSim.Name;
simname = controler.getBot().GetClient.Network.CurrentSim.Name;
}
return homeRegions.Contains(simname);
}

View file

@ -17,23 +17,23 @@ namespace BetterSecondbot.DataStorage
protected void attach_events()
{
controler.Bot.ChangeSimEvent += ChangedSim;
controler.Bot.LoginProgess += LoginProcess;
controler.Bot.StatusMessageEvent += StatusPing;
controler.getBot().ChangeSimEvent += ChangedSim;
controler.getBot().LoginProgess += LoginProcess;
controler.getBot().StatusMessageEvent += StatusPing;
}
protected void StatusPing(object o, StatusMessageEvent e)
{
if(simname != "")
{
if (controler.Bot.GetClient.Network.CurrentSim != null)
if (controler.getBot().GetClient.Network.CurrentSim != null)
{
if (controler.Bot.GetClient.Network.CurrentSim.IsEstateManager == true)
if (controler.getBot().GetClient.Network.CurrentSim.IsEstateManager == true)
{
long dif = helpers.UnixTimeNow() - controler.Bot._lastUpdatedSimBlacklist.lastupdated;
long dif = helpers.UnixTimeNow() - controler.getBot()._lastUpdatedSimBlacklist.lastupdated;
if (dif > 120)
{
controler.Bot.GetClient.Estate.RequestInfo();
controler.getBot().GetClient.Estate.RequestInfo();
}
}
}
@ -50,7 +50,7 @@ namespace BetterSecondbot.DataStorage
if(attachedClientEvents == false)
{
attachedClientEvents = true;
controler.Bot.GetClient.Estate.EstateBansReply += EstateBansReply;
controler.getBot().GetClient.Estate.EstateBansReply += EstateBansReply;
}
}
@ -58,15 +58,15 @@ namespace BetterSecondbot.DataStorage
protected void ChangedSim(object o, SimChangedEventArgs e)
{
simname = "";
if (controler.Bot.GetClient.Network.CurrentSim != null)
if (controler.getBot().GetClient.Network.CurrentSim != null)
{
simname = controler.Bot.GetClient.Network.CurrentSim.Name;
simname = controler.getBot().GetClient.Network.CurrentSim.Name;
}
if(simname != "")
{
if(controler.Bot.GetClient.Network.CurrentSim.IsEstateManager == true)
if(controler.getBot().GetClient.Network.CurrentSim.IsEstateManager == true)
{
controler.Bot.GetClient.Estate.RequestInfo();
controler.getBot().GetClient.Estate.RequestInfo();
}
}
}
@ -77,10 +77,10 @@ namespace BetterSecondbot.DataStorage
working.lastupdated = helpers.UnixTimeNow();
foreach(UUID av in e.Banned)
{
working.banned.Add(av,"lookup"); // controler.Bot.FindAvatarKey2Name(av)
working.banned.Add(av,"lookup"); // controler.getBot().FindAvatarKey2Name(av)
}
working.regionname = controler.Bot.GetClient.Network.CurrentSim.Name;
controler.Bot.UpdateSimBlacklist(working);
working.regionname = controler.getBot().GetClient.Network.CurrentSim.Name;
controler.getBot().UpdateSimBlacklist(working);
}
}

View file

@ -195,9 +195,9 @@ namespace BetterSecondBot.DiscordSupervisor
}
else if (sender_id == UUID.Zero.ToString())
{
if (controler.Bot != null)
if (controler.getBot() != null)
{
display_topic = "" + myconfig.Basic_BotUserName + " #" + controler.Bot.MyVersion + "";
display_topic = "" + myconfig.Basic_BotUserName + " #" + controler.getBot().MyVersion + "";
}
}
else if (channeltopictype == "Group")
@ -286,7 +286,7 @@ namespace BetterSecondBot.DiscordSupervisor
if (HasBot() == true)
{
foreach (Group G in controler.Bot.MyGroups.Values)
foreach (Group G in controler.getBot().MyGroups.Values)
{
string groupname = G.Name.ToLowerInvariant();
groupname = String.Concat(groupname.Where(char.IsLetterOrDigit));

View file

@ -37,7 +37,7 @@ namespace BetterSecondBot.DiscordSupervisor
LastStatusMessage = NewStatusMessage;
if (HasBasicBot() == true)
{
controler.Bot.Log2File(LogFormater.Status(LastStatusMessage, false), ConsoleLogLogLevel.Status);
controler.getBot().Log2File(LogFormater.Status(LastStatusMessage, false), ConsoleLogLogLevel.Status);
}
else
{
@ -79,11 +79,11 @@ namespace BetterSecondBot.DiscordSupervisor
if (controler != null)
{
unattach_events();
controler.Bot.KillMePlease();
controler.getBot().KillMePlease();
controler = null;
}
controler = new Cli(myconfig, running_as_docker, self_keep_alive);
controler.Bot.setDiscordClient(DiscordClient);
controler.getBot().setDiscordClient(DiscordClient);
relayService = new BetterRelay(controler, this, running_as_docker);
attach_events();
}

View file

@ -10,27 +10,27 @@ namespace BetterSecondBot.DiscordSupervisor
protected StatusMessageEvent LastNetworkEventArgs = null;
protected void attach_events()
{
controler.Bot.MessageEvent += BotChatControlerHandler;
controler.Bot.StatusMessageEvent += StatusMessageHandler;
controler.Bot.GroupsReadyEvent += GroupsReadyHandler;
controler.Bot.SendImEvent += SendImHandler;
controler.getBot().MessageEvent += BotChatControlerHandler;
controler.getBot().StatusMessageEvent += StatusMessageHandler;
controler.getBot().GroupsReadyEvent += GroupsReadyHandler;
controler.getBot().SendImEvent += SendImHandler;
}
protected void unattach_events()
{
controler.Bot.MessageEvent -= BotChatControlerHandler;
controler.Bot.StatusMessageEvent -= StatusMessageHandler;
controler.Bot.GroupsReadyEvent -= GroupsReadyHandler;
controler.Bot.SendImEvent -= SendImHandler;
controler.getBot().MessageEvent -= BotChatControlerHandler;
controler.getBot().StatusMessageEvent -= StatusMessageHandler;
controler.getBot().GroupsReadyEvent -= GroupsReadyHandler;
controler.getBot().SendImEvent -= SendImHandler;
}
protected void SendImHandler(object sender, ImSendArgs e)
{
if (controler.Bot.AvatarKey2Name.ContainsKey(e.avataruuid) == true)
if (controler.getBot().AvatarKey2Name.ContainsKey(e.avataruuid) == true)
{
if (DiscordClientConnected == true)
{
_ = SendMessageToChannelAsync(controler.Bot.AvatarKey2Name[e.avataruuid], "Bot/Script: " + e.message + "", "im", e.avataruuid, "IM").ConfigureAwait(false);
_ = SendMessageToChannelAsync(controler.getBot().AvatarKey2Name[e.avataruuid], "Bot/Script: " + e.message + "", "im", e.avataruuid, "IM").ConfigureAwait(false);
}
}
}

View file

@ -47,7 +47,7 @@ namespace BetterSecondBot.DiscordSupervisor
if (HasBot() == true)
{
IGuildUser user = (IGuildUser)message.Author;
controler.Bot.GetClient.Self.Chat(message.Content, 0, ChatType.Normal);
controler.getBot().GetClient.Self.Chat(message.Content, 0, ChatType.Normal);
return await MarkMessage(message, "✅");
}
return await MarkMessage(message, "❌");
@ -69,7 +69,7 @@ namespace BetterSecondBot.DiscordSupervisor
{
return await MarkMessage(message, "❌");
}
controler.Bot.KillMePlease();
controler.getBot().KillMePlease();
controler = null;
return await MarkMessage(message, "✅").ConfigureAwait(false);
}
@ -77,8 +77,8 @@ namespace BetterSecondBot.DiscordSupervisor
{
if (HasBot() == true)
{
controler.Bot.KillMePlease();
controler.Bot.GetClient.Network.Logout();
controler.getBot().KillMePlease();
controler.getBot().GetClient.Network.Logout();
}
exit_super = true;
return await MarkMessage(message, "✅").ConfigureAwait(false);
@ -92,7 +92,7 @@ namespace BetterSecondBot.DiscordSupervisor
{
if (message.Content == "!commands")
{
string[] commands = controler.Bot.getFullListOfCommands();
string[] commands = controler.getBot().getFullListOfCommands();
await SendMessageToChannelAsync("interface", string.Join("\n",commands)+ " \n For more details please see the wiki \n https://wiki.magicmadpeter.xyz/", "bot", UUID.Zero, "bot");
}
else
@ -116,9 +116,9 @@ namespace BetterSecondBot.DiscordSupervisor
{
args = bits[1];
}
if (controler.Bot.GetFullListOfCommandsWithCustoms().Contains(bits[0].ToLowerInvariant()) == true)
if (controler.getBot().GetFullListOfCommandsWithCustoms().Contains(bits[0].ToLowerInvariant()) == true)
{
controler.Bot.CallAPI(bits[0], args.Split("~#~"), target);
controler.getBot().CallAPI(bits[0], args.Split("~#~"), target);
await MarkMessage(message, "✅").ConfigureAwait(false);
}
else
@ -175,7 +175,7 @@ namespace BetterSecondBot.DiscordSupervisor
{
if (UUID.TryParse(bits[1], out UUID group) == true)
{
if (controler.Bot.MyGroups.ContainsKey(group) == true)
if (controler.getBot().MyGroups.ContainsKey(group) == true)
{
if (message.Content == "!clear")
{
@ -197,13 +197,13 @@ namespace BetterSecondBot.DiscordSupervisor
}
Noticetitle = Noticetitle.Replace("!notice ", "");
Noticetitle = Noticetitle.Trim();
controler.Bot.CallAPI("Groupnotice", new [] { Noticetitle, Noticemessage });
controler.getBot().CallAPI("Groupnotice", new [] { Noticetitle, Noticemessage });
await MarkMessage(message, "✅");
}
else
{
IGuildUser user = (IGuildUser)message.Author;
controler.Bot.CallAPI("Groupchat", new [] { group.ToString(), message.Content });
controler.getBot().CallAPI("Groupchat", new [] { group.ToString(), message.Content });
await MarkMessage(message, "✅");
}
}

View file

@ -1,29 +1,29 @@
using BetterSecondBotShared.Json;
using Discord;
using Discord.WebSocket;
using System.Collections.Generic;
namespace BetterSecondBot.DiscordSupervisor
{
public abstract class DiscordValues
{
protected JsonConfig myconfig;
protected bool exit_super = false;
protected Cli controler;
protected bool running_as_docker = false;
protected bool discord_group_relay;
protected DiscordSocketClient DiscordClient;
protected bool DiscordClientConnected;
protected IGuild DiscordServer;
protected string LastSendDiscordStatus = "";
protected long DiscordUnixTimeOnine;
protected bool DiscordLock;
protected string LastStatusMessage = "";
protected Dictionary<string, ICategoryChannel> catmap = new Dictionary<string, ICategoryChannel>();
using Discord;
using Discord.WebSocket;
using System.Collections.Generic;
namespace BetterSecondBot.DiscordSupervisor
{
public abstract class DiscordValues
{
protected JsonConfig myconfig;
protected bool exit_super = false;
protected Cli controler;
protected bool running_as_docker = false;
protected bool discord_group_relay;
protected DiscordSocketClient DiscordClient;
protected bool DiscordClientConnected;
protected IGuild DiscordServer;
protected string LastSendDiscordStatus = "";
protected long DiscordUnixTimeOnine;
protected bool DiscordLock;
protected string LastStatusMessage = "";
protected Dictionary<string, ICategoryChannel> catmap = new Dictionary<string, ICategoryChannel>();
protected virtual void login_bot(bool self_keepalive)
{
@ -38,20 +38,20 @@ namespace BetterSecondBot.DiscordSupervisor
{
if (HasBasicBot() == true)
{
return controler.Bot.GetClient.Network.Connected;
return controler.getBot().GetClient.Network.Connected;
}
return false;
}
}
protected bool HasBasicBot()
{
if (controler != null)
{
if (controler.Bot != null)
if (controler.getBot() != null)
{
if (controler.Bot.GetClient != null)
if (controler.getBot().GetClient != null)
{
if (controler.Bot.GetClient.Network != null)
if (controler.getBot().GetClient.Network != null)
{
return true;
}
@ -59,6 +59,6 @@ namespace BetterSecondBot.DiscordSupervisor
}
}
return false;
}
}
}
}
}
}

View file

@ -11,7 +11,7 @@ namespace BetterSecondBot.DiscordSupervisor
{
if (HasBot() == true)
{
controler.Bot.SendIM(avatar, message);
controler.getBot().SendIM(avatar, message);
}
}
protected async Task DiscordGroupMessage(UUID group_uuid, string sender_name, string message)
@ -20,9 +20,9 @@ namespace BetterSecondBot.DiscordSupervisor
{
if ((helpers.notempty(sender_name) == true) && (helpers.notempty(message) == true))
{
if (controler.Bot.MyGroups.ContainsKey(group_uuid) == true)
if (controler.getBot().MyGroups.ContainsKey(group_uuid) == true)
{
await SendMessageToChannelAsync(controler.Bot.MyGroups[group_uuid].Name, "" + sender_name + ": " + message + "", "group", group_uuid, "Group").ConfigureAwait(false);
await SendMessageToChannelAsync(controler.getBot().MyGroups[group_uuid].Name, "" + sender_name + ": " + message + "", "group", group_uuid, "Group").ConfigureAwait(false);
}
}
}
@ -44,7 +44,7 @@ namespace BetterSecondBot.DiscordSupervisor
{
if (HasBot() == true)
{
string output = controler.Bot.CommandHistoryAdd(command, arg, status, WhyFailed);
string output = controler.getBot().CommandHistoryAdd(command, arg, status, WhyFailed);
if (output != "")
{
_ = SendMessageToChannelAsync("interface", output, "bot", UUID.Zero, "bot");
@ -68,24 +68,24 @@ namespace BetterSecondBot.DiscordSupervisor
{
if (group == true)
{
controler.Bot.Debug("DiscordBotChatControler - GroupChat:(" + group_uuid.ToString() + " -> " + sender_name + ":" + message);
controler.getBot().Debug("DiscordBotChatControler - GroupChat:(" + group_uuid.ToString() + " -> " + sender_name + ":" + message);
await DiscordGroupMessage(group_uuid, sender_name, message).ConfigureAwait(false);
}
else
{
controler.Bot.Debug("DiscordBotChatControler - IM:" + sender_name + ":" + message);
controler.getBot().Debug("DiscordBotChatControler - IM:" + sender_name + ":" + message);
await DiscordIMMessage(sender_uuid, sender_name, message).ConfigureAwait(false);
}
}
else
{
controler.Bot.Debug("DiscordBotChatControler - Localchat:" + sender_name + ":" + message);
controler.getBot().Debug("DiscordBotChatControler - Localchat:" + sender_name + ":" + message);
await SendMessageToChannelAsync("localchat", "" + sender_name + ": " + message, "bot", UUID.Zero, "bot").ConfigureAwait(false);
}
}
else
{
controler.Bot.Debug("DiscordBotChatControler - Not from an avatar");
controler.getBot().Debug("DiscordBotChatControler - Not from an avatar");
}
}
}

View file

@ -28,17 +28,17 @@ namespace BetterSecondbot.Tracking
public BetterTracking(Cli setcontroler)
{
controler = setcontroler;
if(controler.Bot.getMyConfig.Setting_Tracker.ToLowerInvariant() == "false")
if(controler.getBot().getMyConfig.Setting_Tracker.ToLowerInvariant() == "false")
{
LogFormater.Info("Tracker - Disabled because set to false");
return;
}
if(int.TryParse(controler.Bot.getMyConfig.Setting_Tracker,out output_channel) == true)
if(int.TryParse(controler.getBot().getMyConfig.Setting_Tracker,out output_channel) == true)
{
output_to_channel = true;
attachEvents();
}
else if (controler.Bot.getMyConfig.Setting_Tracker.StartsWith("http") == true)
else if (controler.getBot().getMyConfig.Setting_Tracker.StartsWith("http") == true)
{
output_to_url = true;
attachEvents();
@ -51,7 +51,7 @@ namespace BetterSecondbot.Tracking
protected void attachEvents()
{
LogFormater.Info("Tracker - Connected to login process event");
controler.Bot.LoginProgess += LoginProcess;
controler.getBot().LoginProgess += LoginProcess;
}
protected void LoginProcess(object o, LoginProgressEventArgs e)
@ -59,7 +59,7 @@ namespace BetterSecondbot.Tracking
if(e.Status == LoginStatus.ConnectingToSim)
{
LogFormater.Info("Tracker - disconnected from login process event");
controler.Bot.LoginProgess -= LoginProcess;
controler.getBot().LoginProgess -= LoginProcess;
if (AfterLogin == false)
{
AfterLogin = true;
@ -69,10 +69,10 @@ namespace BetterSecondbot.Tracking
}
if (output_to_url == true)
{
LogFormater.Info("Tracker - Enabled HTTP: " + controler.Bot.getMyConfig.Setting_Tracker);
LogFormater.Info("Tracker - Enabled HTTP: " + controler.getBot().getMyConfig.Setting_Tracker);
}
controler.Bot.StatusMessageEvent += StatusPing;
//controler.Bot.GetClient.Grid.CoarseLocationUpdate += LocationUpdate;
controler.getBot().StatusMessageEvent += StatusPing;
//controler.getBot().GetClient.Grid.CoarseLocationUpdate += LocationUpdate;
}
}
}
@ -83,28 +83,28 @@ namespace BetterSecondbot.Tracking
{
return false;
}
if (controler.Bot == null)
if (controler.getBot() == null)
{
return false;
}
if (controler.Bot.GetClient == null)
if (controler.getBot().GetClient == null)
{
return false;
}
if (controler.Bot.GetClient.Network == null)
if (controler.getBot().GetClient.Network == null)
{
return false;
}
return controler.Bot.GetClient.Network.Connected;
return controler.getBot().GetClient.Network.Connected;
}
protected void StatusPing(object o, StatusMessageEvent e)
{
if(hasBot() == true)
{
if(controler.Bot.GetClient.Network.CurrentSim != null)
if(controler.getBot().GetClient.Network.CurrentSim != null)
{
Dictionary<UUID, Vector3> entrys = controler.Bot.GetClient.Network.CurrentSim.AvatarPositions.Copy();
Dictionary<UUID, Vector3> entrys = controler.getBot().GetClient.Network.CurrentSim.AvatarPositions.Copy();
List<UUID> avs = entrys.Keys.ToList();
List<UUID> seenavs = new List<UUID>();
foreach (UUID A in avs)
@ -139,7 +139,7 @@ namespace BetterSecondbot.Tracking
string output = av.ToString() + "|||" + mode;
if (output_to_channel == true)
{
controler.Bot.GetClient.Self.Chat(output, output_channel, ChatType.Normal);
controler.getBot().GetClient.Self.Chat(output, output_channel, ChatType.Normal);
}
if(output_to_url == true)
{
@ -159,7 +159,7 @@ namespace BetterSecondbot.Tracking
var content = new FormUrlEncodedContent(values);
try
{
HTTPclient.PostAsync(controler.Bot.getMyConfig.Setting_Tracker, content);
HTTPclient.PostAsync(controler.getBot().getMyConfig.Setting_Tracker, content);
}
catch (Exception e)
{
@ -174,12 +174,12 @@ namespace BetterSecondbot.Tracking
if (AvatarSeen.ContainsKey(avuuid) == false)
{
addToSeen(avuuid);
string name = controler.Bot.FindAvatarKey2Name(avuuid);
string name = controler.getBot().FindAvatarKey2Name(avuuid);
int loop = 0;
while ((loop < 32) && (name == "lookup"))
{
Thread.Sleep(500);
name = controler.Bot.FindAvatarKey2Name(avuuid);
name = controler.getBot().FindAvatarKey2Name(avuuid);
loop++;
}
output(avuuid, "entry###" + name);
@ -217,12 +217,12 @@ namespace BetterSecondbot.Tracking
{
if (AvatarSeen.ContainsKey(avuuid) == true)
{
string name = controler.Bot.FindAvatarKey2Name(avuuid);
string name = controler.getBot().FindAvatarKey2Name(avuuid);
int loop = 0;
while ((loop < 32) && (name == "lookup"))
{
Thread.Sleep(500);
name = controler.Bot.FindAvatarKey2Name(avuuid);
name = controler.getBot().FindAvatarKey2Name(avuuid);
loop++;
}
if (AvatarSeen.ContainsKey(avuuid) == true)

View file

@ -628,7 +628,7 @@ namespace BetterSecondBot.WikiMake
}
}
}
return new [] { };
return new string[] { };
}

View file

@ -69,10 +69,10 @@ namespace BetterSecondBot.HttpService
{
if (tokens.Allow(token, "animation", "resetanimations", handleGetClientIP()) == false)
{
return BasicReply("Token not accepted", "resetanimations", new [] { });
return BasicReply("Token not accepted", "resetanimations");
}
bot.ResetAnimations();
return BasicReply("Accepted", "resetanimations", new [] { });
return BasicReply("Accepted", "resetanimations");
}
}

View file

@ -24,11 +24,11 @@ namespace BetterSecondBot.HttpService
{
if (tokens.Allow(token, "avatars", "nearmewithdetails", handleGetClientIP()) == false)
{
return BasicReply("Token not accepted", "nearmewithdetails", new [] { });
return BasicReply("Token not accepted", "nearmewithdetails");
}
if (bot.GetClient.Network.CurrentSim == null)
{
return BasicReply("Error not in a sim", "nearmewithdetails", new [] { });
return BasicReply("Error not in a sim", "nearmewithdetails");
}
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 [] { });
return BasicReply(JsonConvert.SerializeObject(BetterNearMe), "nearmewithdetails");
}
[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 [] { });
return BasicReply("Token not accepted", "nearme");
}
if (bot.GetClient.Network.CurrentSim == null)
{
return BasicReply("Error not in a sim", "nearme", new [] { });
return BasicReply("Error not in a sim", "nearme");
}
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 [] { });
return BasicReply(JsonConvert.SerializeObject(NearMe), "nearme");
}
}
}

View file

@ -23,9 +23,9 @@ namespace BetterSecondBot.HttpService
{
if (tokens.Allow(token, "chat", "LocalChatHistory", handleGetClientIP()) == false)
{
return Failure("Token not accepted", "LocalChatHistory", new [] { });
return Failure("Token not accepted", "LocalChatHistory");
}
return BasicReply(JsonConvert.SerializeObject(bot.getLocalChatHistory()), "LocalChatHistory", new [] { });
return BasicReply(JsonConvert.SerializeObject(bot.getLocalChatHistory()), "LocalChatHistory");
}
[About("sends a message to localchat")]

View file

@ -51,7 +51,7 @@ namespace BetterSecondBot.HttpService
[Route(HttpVerbs.Get, "/Hello")]
public object Hello()
{
return BasicReply("world", "Hello", new [] { });
return BasicReply("world", "Hello");
}
[About("Delays a thead by X ms<br/>Mostly pointless but good if your doing custom commands")]
@ -80,9 +80,9 @@ namespace BetterSecondBot.HttpService
{
if (tokens.Allow(token, "core", "LogoutUI", handleGetClientIP()) == false)
{
return Failure("Token not accepted", "LogoutUI", new [] { });
return Failure("Token not accepted", "LogoutUI");
}
SuccessNoReturn("LogoutUI", new [] { });
SuccessNoReturn("LogoutUI");
return tokens.Expire(token);
}
}

View file

@ -102,15 +102,15 @@ namespace BetterSecondBot.HttpService
{
if (tokens.Allow(token, "estate", "EstateParcelReclaim", handleGetClientIP()) == false)
{
return Failure("Token not accepted", "EstateParcelReclaim", new [] { });
return Failure("Token not accepted", "EstateParcelReclaim");
}
if (bot.GetClient.Network.CurrentSim.IsEstateManager == false)
{
return Failure("Not an estate manager here", "EstateParcelReclaim", new [] { });
return Failure("Not an estate manager here", "EstateParcelReclaim");
}
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 [] { });
return BasicReply("ok", "EstateParcelReclaim");
}
[About("Reclaims ownership of the current parcel")]
@ -142,9 +142,9 @@ namespace BetterSecondBot.HttpService
{
if (tokens.Allow(token, "estate", "banlist", handleGetClientIP()) == false)
{
return Failure("Token not accepted", "banlist", new [] { });
return Failure("Token not accepted", "banlist");
}
return BasicReply(JsonConvert.SerializeObject(bot._lastUpdatedSimBlacklist), "banlist", new [] { });
return BasicReply(JsonConvert.SerializeObject(bot._lastUpdatedSimBlacklist), "banlist");
}
[About("Attempts to add/remove the avatar to/from the Estate banlist")]

View file

@ -23,9 +23,9 @@ namespace BetterSecondBot.HttpService
{
if (tokens.Allow(token, "friends", "Friendslist", handleGetClientIP()) == false)
{
return Failure("Token not accepted", "Friendslist", new [] { });
return Failure("Token not accepted", "Friendslist");
}
return BasicReply(bot.getJsonFriendlist(), "Friendslist", new [] { });
return BasicReply(bot.getJsonFriendlist(), "Friendslist");
}
[About("Updates the friend perms for avatar avatar to State \n if true grants (Online/Map/Modify) perms")]

View file

@ -24,14 +24,14 @@ namespace BetterSecondBot.HttpService
{
if (tokens.Allow(token, "funds", "Balance", handleGetClientIP()) == false)
{
return Failure("Token not accepted", "Balance", new [] { });
return Failure("Token not accepted", "Balance");
}
if (bot.GetAllowFunds == false)
{
return Failure("Funds commands are disabled", "Balance", new [] { });
return Failure("Funds commands are disabled", "Balance");
}
bot.GetClient.Self.RequestBalance();
return BasicReply(bot.GetClient.Self.Balance.ToString(), "Balance", new [] { });
return BasicReply(bot.GetClient.Self.Balance.ToString(), "Balance");
}
[About("Makes the bot pay a avatar")]

View file

@ -453,14 +453,14 @@ namespace BetterSecondBot.HttpService
{
if (tokens.Allow(token, "groups", "GetGroupList", handleGetClientIP()) == false)
{
return Failure("Token not accepted", "GetGroupList", new [] {});
return Failure("Token not accepted", "GetGroupList");
}
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 [] { });
return BasicReply(JsonConvert.SerializeObject(grouppackage), "GetGroupList");
}
[About("Requests the roles for the selected group<br/>Replys with GroupRoleDetails object formated as follows <ul><li>UpdateUnderway (Bool)</li><li>RoleDataAge (Int) [default -1]</li><li>Roles (KeyPair array of UUID=Name)</li></ul><br/>")]
@ -523,9 +523,9 @@ namespace BetterSecondBot.HttpService
{
if (tokens.Allow(token, "groups", "GroupchatListAllUnreadGroups", handleGetClientIP()) == false)
{
return Failure("Token not accepted", "GroupchatListAllUnreadGroups", new [] { });
return Failure("Token not accepted", "GroupchatListAllUnreadGroups");
}
return BasicReply(JsonConvert.SerializeObject(bot.UnreadGroupchatGroups()), "GroupchatListAllUnreadGroups", new [] { });
return BasicReply(JsonConvert.SerializeObject(bot.UnreadGroupchatGroups()), "GroupchatListAllUnreadGroups");
}
[About("fetchs a list of all groups with unread messages")]
@ -561,9 +561,9 @@ namespace BetterSecondBot.HttpService
{
if (tokens.Allow(token, "groups", "GroupchatAnyUnread", handleGetClientIP()) == false)
{
return Failure("Token not accepted", "GroupchatAnyUnread", new [] { });
return Failure("Token not accepted", "GroupchatAnyUnread");
}
return BasicReply(bot.HasUnreadGroupchats().ToString(), "GroupchatAnyUnread", new [] { });
return BasicReply(bot.HasUnreadGroupchats().ToString(), "GroupchatAnyUnread");
}
[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 [] { });
return Failure("Token not accepted", "GroupchatClearAll");
}
bot.ClearAllGroupchat();
return BasicReply("ok", "GroupchatClearAll", new [] { });
return BasicReply("ok", "GroupchatClearAll");
}
[About("fetchs the groupchat history")]

View file

@ -23,10 +23,10 @@ namespace BetterSecondBot.HttpService
{
if (tokens.Allow(token, "home", "GoHome", handleGetClientIP()) == false)
{
return Failure("Token not accepted", "GoHome", new [] { });
return Failure("Token not accepted", "GoHome");
}
bot.GotoNextHomeRegion();
return BasicReply("ok", "GoHome", new [] { });
return BasicReply("ok", "GoHome");
}
}

View file

@ -22,9 +22,9 @@ namespace BetterSecondBot.HttpService
{
if (tokens.Allow(token, "im", "chatwindows", handleGetClientIP()) == false)
{
return BasicReply("Token not accepted", "chatwindows", new [] { });
return BasicReply("Token not accepted", "chatwindows");
}
return BasicReply(JsonConvert.SerializeObject(bot.GetIMChatWindowKeyNames()), "chatwindows", new [] { });
return BasicReply(JsonConvert.SerializeObject(bot.GetIMChatWindowKeyNames()), "chatwindows");
}
[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 [] { });
return BasicReply("Token not accepted", "listwithunread");
}
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 [] { });
return BasicReply(JsonConvert.SerializeObject(unreadimwindows), "listwithunread");
}
[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 [] { });
return BasicReply("Token not accepted", "haveunreadims");
}
bool reply = false;
foreach (UUID window in bot.IMChatWindows())
@ -65,7 +65,7 @@ namespace BetterSecondBot.HttpService
break;
}
}
return BasicReply(reply.ToString(), "haveunreadims", new [] { });
return BasicReply(reply.ToString(), "haveunreadims");
}
[About("gets the chat from the selected window")]

View file

@ -23,9 +23,9 @@ namespace BetterSecondBot.HttpService
{
if (tokens.Allow(token, "info", "Version", handleGetClientIP()) == false)
{
return Failure("Token not accepted", "Version", new [] { });
return Failure("Token not accepted", "Version");
}
return BasicReply(bot.MyVersion, "Version", new [] { });
return BasicReply(bot.MyVersion, "Version");
}
@ -36,9 +36,9 @@ namespace BetterSecondBot.HttpService
{
if (tokens.Allow(token, "info", "Name", handleGetClientIP()) == false)
{
return Failure("Token not accepted", "Name", new [] { });
return Failure("Token not accepted", "Name");
}
return BasicReply(bot.GetClient.Self.FirstName + " " + bot.GetClient.Self.LastName, "Name", new [] { });
return BasicReply(bot.GetClient.Self.FirstName + " " + bot.GetClient.Self.LastName, "Name");
}
[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 [] { });
return Failure("Token not accepted", "ParcelName");
}
if (bot.GetClient.Network.CurrentSim == null)
{
return Failure("Error not in a sim", "ParcelName", new [] { });
return Failure("Error not in a sim", "ParcelName");
}
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 [] { });
return Failure("Error parcel not found", "ParcelName");
}
return BasicReply(bot.GetClient.Network.CurrentSim.Parcels[localid].Name, "ParcelName", new [] { });
return BasicReply(bot.GetClient.Network.CurrentSim.Parcels[localid].Name, "ParcelName");
}
[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 [] { });
return Failure("Token not accepted", "UnixTimeNow");
}
return BasicReply(helpers.UnixTimeNow().ToString(), "UnixTimeNow", new [] { });
return BasicReply(helpers.UnixTimeNow().ToString(), "UnixTimeNow");
}
[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 [] { });
return Failure("Token not accepted", "SimName");
}
if (bot.GetClient.Network.CurrentSim == null)
{
return Failure("Error not in a sim", "SimName", new [] { });
return Failure("Error not in a sim", "SimName");
}
return BasicReply(bot.GetClient.Network.CurrentSim.Name, "SimName", new [] { });
return BasicReply(bot.GetClient.Network.CurrentSim.Name, "SimName");
}
[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 [] { });
return Failure("Token not accepted", "GetPosition");
}
if (bot.GetClient.Network.CurrentSim == null)
{
return Failure("Error not in a sim", "GetPosition", new [] { });
return Failure("Error not in a sim", "GetPosition");
}
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 [] { });
return BasicReply(JsonConvert.SerializeObject(pos), "GetPosition");
}
}
}

View file

@ -228,7 +228,7 @@ namespace BetterSecondBot.HttpService
{
if (tokens.Allow(token, "inventory", "InventoryPurgeNotecards", handleGetClientIP()) == false)
{
return Failure("Token not accepted", "InventoryPurgeNotecards", new [] { });
return Failure("Token not accepted", "InventoryPurgeNotecards");
}
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 [] { });
return Failure("Unable to find notecard folder", "InventoryPurgeNotecards");
}
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 [] { });
return BasicReply("Ok", "InventoryPurgeNotecards");
}
[About("converts a inventory uuid to a realworld uuid<br/>Needed for texture preview")]
@ -425,11 +425,11 @@ namespace BetterSecondBot.HttpService
{
if (tokens.Allow(token, "inventory", "InventoryFolders", handleGetClientIP()) == false)
{
return Failure("Token not accepted", "InventoryFolders", new [] { });
return Failure("Token not accepted", "InventoryFolders");
}
string reply = HelperInventory.MapFolderJson(bot);
if (reply != null) return BasicReply(reply, "InventoryFolders", new [] { });
return Failure("Error", "InventoryFolders", new [] { });
if (reply != null) return BasicReply(reply, "InventoryFolders");
return Failure("Error", "InventoryFolders");
}
[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>")]

View file

@ -65,10 +65,10 @@ namespace BetterSecondBot.HttpService
{
if (tokens.Allow(token, "movement", "AutoPilotStop", handleGetClientIP()) == false)
{
return Failure("Token not accepted", "AutoPilotStop", new [] { });
return Failure("Token not accepted", "AutoPilotStop");
}
bot.GetClient.Self.AutoPilotCancel();
return BasicReply("ok", "AutoPilotStop", new [] { });
return BasicReply("ok", "AutoPilotStop");
}
[About("Make the bot request the target avatar teleport to the bot")]

View file

@ -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 [] { });
return Failure(tests.Value, "GetParcelDesc");
}
return BasicReply(targetparcel.Desc, "GetParcelDesc", new [] { });
return BasicReply(targetparcel.Desc, "GetParcelDesc");
}
[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 [] { });
return Failure(tests.Value, "GetParcelFlags");
}
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 [] { });
SuccessNoReturn("GetParcelFlags");
return collection;
}
@ -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 [] { });
return Failure(tests.Value, "AbandonLand");
}
bot.GetClient.Parcels.ReleaseParcel(bot.GetClient.Network.CurrentSim, targetparcel.LocalID);
return BasicReply("ok", "AbandonLand", new [] { });
return BasicReply("ok", "AbandonLand");
}
@ -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 [] { });
return Failure(tests.Value, "GetParcelBanlist");
}
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 [] { });
return BasicReply(JsonConvert.SerializeObject(reply), "GetParcelBanlist");
}
[About("Returns a rezzed object")]

View file

@ -73,11 +73,11 @@ namespace BetterSecondBot.HttpService
{
if (tokens.Allow(token, "self", "Stand", handleGetClientIP()) == false)
{
return Failure("Token not accepted", "Stand", new [] { });
return Failure("Token not accepted", "Stand");
}
bot.GetClient.Self.Stand();
bot.ResetAnimations();
return BasicReply("ok", "Stand", new [] { });
return BasicReply("ok", "Stand");
}
[About("Makes the bot sit on the ground or on a object if it can see it")]
@ -117,14 +117,14 @@ namespace BetterSecondBot.HttpService
{
if (tokens.Allow(token, "self", "Logoff", handleGetClientIP()) == false)
{
return Failure("Token not accepted", "Logoff", new [] { });
return Failure("Token not accepted", "Logoff");
}
if (bot.KillMe == false)
{
bot.GetClient.Self.Chat("Laters im out", 0, ChatType.Normal);
bot.KillMePlease();
}
return BasicReply("ok", "Logoff", new [] { });
return BasicReply("ok", "Logoff");
}
[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 [] { });
return Failure("Token not accepted", "Logout");
}
if (bot.KillMe == false)
{
bot.GetClient.Self.Chat("Laters im out", 0, ChatType.Normal);
bot.KillMePlease();
}
return BasicReply("ok", "Logout", new [] { });
return BasicReply("ok", "Logout");
}
[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 [] { });
return Failure("Token not accepted", "Bye");
}
if (bot.KillMe == false)
{
bot.KillMePlease();
}
return BasicReply("ok", "Bye", new [] { });
return BasicReply("ok", "Bye");
}
[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 [] { });
return Failure("Token not accepted", "GetLastCommands");
}
SuccessNoReturn("GetLastCommands", new [] { });
SuccessNoReturn("GetLastCommands");
return bot.GetLastCommands(5);
}

View file

@ -460,11 +460,20 @@ namespace BetterSecondBot.HttpService
UUID.TryParse(avatar, out avataruuid);
}
protected void SuccessNoReturn(string command)
{
SuccessNoReturn(command);
}
protected void SuccessNoReturn(string command, string[] args)
{
bot.CommandHistoryAdd(command, String.Join("~#~", args), true, "");
}
protected Object BasicReply(string input, string command)
{
return BasicReply(input, command);
}
protected Object BasicReply(string input,string command, string[] args)
{
bot.CommandHistoryAdd(command, String.Join("~#~", args), true, "");
@ -477,6 +486,11 @@ namespace BetterSecondBot.HttpService
return new { reply = input, status = false };
}
protected Object Failure(string input, string command)
{
return Failure(input, command);
}
public WebApiControllerWithTokens(SecondBot mainbot, TokenStorage setuptokens)
{

View file

@ -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 [] { }; } }
public virtual string[] ArgHints { get { return new [] { }; } }
public virtual string[] ArgTypes { get { return new string[] { }; } }
public virtual string[] ArgHints { get { return new string[] { }; } }
protected string InfoBlob = "";
public string GetInfoBlob { get { return InfoBlob; } }
@ -162,7 +162,7 @@ namespace BetterSecondBotShared.API
{
return CmdGet.ArgTypes;
}
return new [] { };
return new string[] { };
}
public virtual string[] GetCommandArgHints(string cmd)
{
@ -171,7 +171,7 @@ namespace BetterSecondBotShared.API
{
return CmdGet.ArgHints;
}
return new [] { };
return new string[] { };
}
public virtual List<string> GetAllWorkspaces()

View file

@ -202,7 +202,7 @@ namespace BetterSecondBotShared.bottypes
}
protected virtual string[] getNextHomeArgs()
{
return new [] { };
return new string[] { };
}
public virtual void Start()
{