diff --git a/BetterSecondbot/HttpService/Animation.cs b/BetterSecondbot/HttpService/Animation.cs new file mode 100644 index 0000000..c503689 --- /dev/null +++ b/BetterSecondbot/HttpService/Animation.cs @@ -0,0 +1,79 @@ +using BetterSecondBot.bottypes; +using BetterSecondBot.Static; +using EmbedIO; +using EmbedIO.Routing; +using EmbedIO.WebApi; +using System; +using System.Collections.Generic; +using System.Text; +using OpenMetaverse; +using Newtonsoft.Json; +using System.Reflection; + +namespace BetterSecondBot.HttpService +{ + public class HttpApiAnimation : WebApiControllerWithTokens + { + public HttpApiAnimation(SecondBot mainbot, TokenStorage setuptokens) : base(mainbot, setuptokens) { } + + [About("Toggles if animation requests from this avatar (used for remote poseballs) are accepted")] + [ReturnHints("Granted perm animation")] + [ReturnHints("Removed perm animation")] + [ReturnHints("avatar lookup")] + [ArgHints("avatar", "URLARG", "UUID (or Firstname Lastname)")] + [Route(HttpVerbs.Get, "/AddToAllowAnimations/{avatar}/{token}")] + public object AddToAllowAnimations(string avatar, string token) + { + if (tokens.Allow(token, "animation", "addtoallowanimations", getClientIP()) == false) + { + return BasicReply("Token not accepted"); + } + ProcessAvatar(avatar); + if (avataruuid == UUID.Zero) + { + return BasicReply("avatar lookup"); + } + if (bot.Accept_action_from("animation", avataruuid) == false) + { + bot.Add_action_from("animation", avataruuid); + return BasicReply("Granted perm animation"); + } + bot.Remove_action_from("animation", avataruuid, true); + return BasicReply("Removed perm animation"); + } + + [About("Attempts to play a gesture")] + [ReturnHints("Error with gesture")] + [ReturnHints("Accepted")] + [ArgHints("gesture", "URLARG", "Inventory UUID of the gesture")] + [Route(HttpVerbs.Get, "/PlayGesture/{gesture}/{token}")] + public object PlayGesture(string gesture, string token) + { + if (tokens.Allow(token, "animation", "gesture", getClientIP()) == false) + { + return BasicReply("Token not accepted"); + } + if (UUID.TryParse(gesture, out UUID gestureUUID) == false) + { + return BasicReply("Error with gesture"); + } + InventoryItem itm = bot.GetClient.Inventory.FetchItem(gestureUUID, bot.GetClient.Self.AgentID, (3 * 1000)); + bot.GetClient.Self.PlayGesture(itm.AssetUUID); + return BasicReply("Accepted"); + } + + [About("Resets the animation stack for the bot")] + [ReturnHints("Accepted")] + [Route(HttpVerbs.Get, "/ResetAnimations/{token}")] + public object ResetAnimations(string token) + { + if (tokens.Allow(token, "animation", "resetanimations", getClientIP()) == false) + { + return BasicReply("Token not accepted"); + } + bot.ResetAnimations(); + return BasicReply("Accepted"); + } + + } +} diff --git a/BetterSecondbot/HttpService/Avatars.cs b/BetterSecondbot/HttpService/Avatars.cs new file mode 100644 index 0000000..62903dc --- /dev/null +++ b/BetterSecondbot/HttpService/Avatars.cs @@ -0,0 +1,112 @@ +using BetterSecondBot.bottypes; +using BetterSecondBot.Static; +using EmbedIO; +using EmbedIO.Routing; +using EmbedIO.WebApi; +using System; +using System.Collections.Generic; +using System.Text; +using OpenMetaverse; +using Newtonsoft.Json; +using System.Reflection; + +namespace BetterSecondBot.HttpService +{ + public class HTTP_Avatars : WebApiControllerWithTokens + { + public HTTP_Avatars(SecondBot mainbot, TokenStorage setuptokens) : base(mainbot, setuptokens) { } + + [About("an improved version of near me with extra details
NearMeDetails is a object formated as follows
")] + [ReturnHints("array NearMeDetails")] + [ReturnHints("Error not in a sim")] + [Route(HttpVerbs.Get, "/NearmeWithDetails/{token}")] + public object NearmeWithDetails(string token) + { + if (tokens.Allow(token, "avatars", "nearmewithdetails", getClientIP()) == false) + { + return BasicReply("Token not accepted"); + } + if (bot.GetClient.Network.CurrentSim == null) + { + return BasicReply("Error not in a sim"); + } + List BetterNearMe = new List(); + Dictionary avcopy = bot.GetClient.Network.CurrentSim.ObjectsAvatars.Copy(); + foreach (Avatar av in avcopy.Values) + { + if (av.ID != bot.GetClient.Self.AgentID) + { + NearMeDetails details = new NearMeDetails(); + details.id = av.ID.ToString(); + details.name = av.Name; + details.x = (int)Math.Round(av.Position.X); + details.y = (int)Math.Round(av.Position.Y); + details.z = (int)Math.Round(av.Position.Z); + details.range = (int)Math.Round(Vector3.Distance(av.Position, bot.GetClient.Self.SimPosition)); + BetterNearMe.Add(details); + } + } + return BasicReply(JsonConvert.SerializeObject(BetterNearMe)); + } + + [About("returns a list of all known avatars nearby")] + [ReturnHints("array UUID = Name")] + [ReturnHints("Error not in a sim")] + [Route(HttpVerbs.Get, "/Nearme/{token}")] + public object Nearme(string token) + { + if (tokens.Allow(token, "avatars", "nearme", getClientIP()) == false) + { + return BasicReply("Token not accepted"); + } + if (bot.GetClient.Network.CurrentSim == null) + { + return BasicReply("Error not in a sim"); + } + Dictionary NearMe = new Dictionary(); + Dictionary avcopy = bot.GetClient.Network.CurrentSim.ObjectsAvatars.Copy(); + foreach (Avatar av in avcopy.Values) + { + if (av.ID != bot.GetClient.Self.AgentID) + { + NearMe.Add(av.ID, av.Name); + } + } + return BasicReply(JsonConvert.SerializeObject(NearMe)); + } + + + [About("Makes the bot pay a avatar")] + [ReturnHints("Accepted")] + [ReturnHints("avatar lookup")] + [ReturnHints("Invaild amount")] + [ReturnHints("Transfer funds to avatars disabled")] + [Route(HttpVerbs.Get, "/PayAvatar/{avatar}/{amount}/{token}")] + public object PayAvatar(string avatar,string amount,string token) + { + if (tokens.Allow(token, "avatars", "payavatar", getClientIP()) == false) + { + return BasicReply("Token not accepted"); + } + if (bot.GetAllowFunds == false) + { + return BasicReply("Transfer funds to avatars disabled"); + } + ProcessAvatar(avatar); + if (avataruuid == UUID.Zero) + { + return BasicReply("avatar lookup"); + } + if (int.TryParse(amount, out int amountvalue) == false) + { + return BasicReply("Invaild amount"); + } + if(amountvalue < 1) + { + return BasicReply("Invaild amount"); + } + bot.GetClient.Self.GiveAvatarMoney(avataruuid, amountvalue); + return BasicReply("Accepted"); + } + } +} diff --git a/BetterSecondbot/HttpService/Chat.cs b/BetterSecondbot/HttpService/Chat.cs index fe7f7a0..1ddf9bc 100644 --- a/BetterSecondbot/HttpService/Chat.cs +++ b/BetterSecondbot/HttpService/Chat.cs @@ -8,6 +8,7 @@ using System.Collections.Generic; using System.Text; using OpenMetaverse; using Newtonsoft.Json; +using BetterSecondBotShared.Static; namespace BetterSecondBot.HttpService { @@ -17,8 +18,8 @@ namespace BetterSecondBot.HttpService [About("fetchs the last 20 localchat messages")] [ReturnHints("array string")] - [Route(HttpVerbs.Get, "/localchathistory/{token}")] - public object localchatHistory(string token) + [Route(HttpVerbs.Get, "/LocalChatHistory/{token}")] + public object LocalChatHistory(string token) { if (tokens.Allow(token, "chat", "localchathistory", getClientIP()) == true) { @@ -30,15 +31,52 @@ namespace BetterSecondBot.HttpService [About("sends a message to localchat")] [ArgHints("message", "URLARG", "the message to send")] [ReturnHints("array string")] - [Route(HttpVerbs.Post, "/localchatsay/{token}")] - public object localchatSay(string token, [FormField] string message) + [ReturnHints("Message empty")] + [ReturnHints("Invaild channel")] + [Route(HttpVerbs.Post, "/Say/{channel}/{token}")] + public object Say(string channel,[FormField] string message,string token) { - if (tokens.Allow(token, "chat", "localchatsay", getClientIP()) == true) + if (tokens.Allow(token, "chat", "localchatsay", getClientIP()) == false) { - bot.GetCommandsInterface.Call("say", message); - return BasicReply(JsonConvert.SerializeObject(bot.getLocalChatHistory())); + return BasicReply("Token not accepted"); } - return BasicReply("Token not accepted"); + if (helpers.notempty(message) == false) + { + return BasicReply("Message empty"); + } + if(int.TryParse(channel,out int channelnum) == false) + { + return BasicReply("Invaild channel"); + } + bot.GetClient.Self.Chat(message, channelnum, ChatType.Normal); + return BasicReply(JsonConvert.SerializeObject(bot.getLocalChatHistory())); + + } + + [About("sends a im to the selected avatar")] + [ArgHints("avatar", "URLARG", "a UUID or Firstname Lastname")] + [ArgHints("message", "Text", "the message to send")] + [ReturnHints("ok")] + [ReturnHints("Message empty")] + [ReturnHints("avatar lookup")] + [Route(HttpVerbs.Post, "/IM/{avatar}/{token}")] + public object IM(string avatar, [FormField] string message, string token) + { + if (tokens.Allow(token, "chat", "im", getClientIP()) == false) + { + return BasicReply("Token not accepted"); + } + ProcessAvatar(avatar); + if(avataruuid == UUID.Zero) + { + return BasicReply("avatar lookup"); + } + if (helpers.notempty(message) == false) + { + return BasicReply("Message empty"); + } + bot.SendIM(avataruuid, message); + return BasicReply("ok"); } } diff --git a/BetterSecondbot/HttpService/Core.cs b/BetterSecondbot/HttpService/Core.cs index 07aa2a2..3defd91 100644 --- a/BetterSecondbot/HttpService/Core.cs +++ b/BetterSecondbot/HttpService/Core.cs @@ -12,9 +12,6 @@ using Newtonsoft.Json; namespace BetterSecondBot.HttpService { - - - public class HttpApiCore : WebApiControllerWithTokens { @@ -30,7 +27,7 @@ namespace BetterSecondBot.HttpService [ReturnHints("A new token with full system scope")] [ArgHints("authcode", "text", "the first 10 chars of SHA1(unixtime+WebUIkey)
unixtime can be +- 30 of the bots time.")] [ArgHints("unixtimegiven", "number", "the unixtime you made this request")] - [Route(HttpVerbs.Post, "/gettoken")] + [Route(HttpVerbs.Post, "/GetToken")] public Object GetToken([FormField] string authcode, [FormField] string unixtimegiven) { long now = helpers.UnixTimeNow(); @@ -56,7 +53,7 @@ namespace BetterSecondBot.HttpService [About("Gets the friendslist
Formated as follows
friendreplyobject
  • name: String
  • id: String
  • online: bool
")] [ReturnHints("array UUID = friendreplyobject")] - [Route(HttpVerbs.Get, "/friends/{token}")] + [Route(HttpVerbs.Get, "/Friends/{token}")] public object Friends(string token) { if (tokens.Allow(token, "core", "friends", getClientIP()) == true) @@ -72,7 +69,7 @@ namespace BetterSecondBot.HttpService [ArgHints("x", "URLARG", "X location to AutoPilot to")] [ArgHints("y", "URLARG", "y location to AutoPilot to")] [ArgHints("z", "URLARG", "z location to AutoPilot to")] - [Route(HttpVerbs.Get, "/walkto/{x}/{y}/{z}/{token}")] + [Route(HttpVerbs.Get, "/WalkTo/{x}/{y}/{z}/{token}")] public object WalkTo(string x, string y, string z, string token) { if (tokens.Allow(token, "core", "walkto", getClientIP()) == true) @@ -87,24 +84,7 @@ namespace BetterSecondBot.HttpService return BasicReply("Token not accepted"); } - [About("Attempts to play a gesture")] - [ReturnHints("Invaild gesture UUID for arg 1")] - [ReturnHints("Accepted")] - [ArgHints("gesture", "URLARG", "Inventory UUID of the gesture")] - [Route(HttpVerbs.Get, "/gesture/{gesture}/{token}")] - public object Gesture(string gesture, string token) - { - if (tokens.Allow(token, "core", "gesture", getClientIP()) == true) - { - bool status = bot.GetCommandsInterface.Call("PlayGesture", gesture); - if (status == true) - { - return BasicReply("Accepted"); - } - return BasicReply("Error with gesture"); - } - return BasicReply("Token not accepted"); - } + [About("Attempt to teleport to a new region")] [ReturnHints("Error Unable to Teleport to location")] @@ -113,7 +93,7 @@ namespace BetterSecondBot.HttpService [ArgHints("x", "URLARG", "X location to teleport to")] [ArgHints("y", "URLARG", "y location to teleport to")] [ArgHints("z", "URLARG", "z location to teleport to")] - [Route(HttpVerbs.Get, "/teleport/{region}/{x}/{y}/{z}/{token}")] + [Route(HttpVerbs.Get, "/Teleport/{region}/{x}/{y}/{z}/{token}")] public object Teleport(string region,string x, string y, string z, string token) { if (tokens.Allow(token, "core", "teleport", getClientIP()) == true) @@ -132,7 +112,7 @@ namespace BetterSecondBot.HttpService [ReturnHints("Unable to find region")] [ReturnHints("Texture UUID")] [ArgHints("regionname", "URLARG", "the name of the region we are fetching")] - [Route(HttpVerbs.Get, "/regiontile/{regionname}/{token}")] + [Route(HttpVerbs.Get, "/Regiontile/{regionname}/{token}")] public object Regiontile(string regionname, string token) { if (tokens.Allow(token, "core", "regiontile", getClientIP()) == true) @@ -149,69 +129,12 @@ namespace BetterSecondBot.HttpService return BasicReply("Token not accepted"); } - [About("an improved version of near me with extra details
NearMeDetails is a object formated as follows
  • id
  • name
  • x
  • y
  • z
  • range
")] - [ReturnHints("array NearMeDetails")] - [ReturnHints("Error not in a sim")] - [Route(HttpVerbs.Get, "/nearmewithdetails/{token}")] - public object NearmeWithDetails(string token) - { - if (tokens.Allow(token, "core", "nearmewithdetails", getClientIP()) == true) - { - if (bot.GetClient.Network.CurrentSim != null) - { - List BetterNearMe = new List(); - Dictionary avcopy = bot.GetClient.Network.CurrentSim.ObjectsAvatars.Copy(); - foreach (Avatar av in avcopy.Values) - { - if (av.ID != bot.GetClient.Self.AgentID) - { - NearMeDetails details = new NearMeDetails(); - details.id = av.ID.ToString(); - details.name = av.Name; - details.x = (int)Math.Round(av.Position.X); - details.y = (int)Math.Round(av.Position.Y); - details.z = (int)Math.Round(av.Position.Z); - details.range = (int)Math.Round(Vector3.Distance(av.Position, bot.GetClient.Self.SimPosition)); - BetterNearMe.Add(details); - } - } - return BasicReply(JsonConvert.SerializeObject(BetterNearMe)); - } - return BasicReply("Error not in a sim"); - } - return BasicReply("Token not accepted"); - } - [About("returns a list of all known avatars nearby")] - [ReturnHints("array UUID = Name")] - [ReturnHints("Error not in a sim")] - [Route(HttpVerbs.Get, "/nearme/{token}")] - public object Nearme(string token) - { - if (tokens.Allow(token, "core", "nearme", getClientIP()) == true) - { - if (bot.GetClient.Network.CurrentSim != null) - { - Dictionary NearMe = new Dictionary(); - Dictionary avcopy = bot.GetClient.Network.CurrentSim.ObjectsAvatars.Copy(); - foreach (Avatar av in avcopy.Values) - { - if (av.ID != bot.GetClient.Self.AgentID) - { - NearMe.Add(av.ID, av.Name); - } - } - return BasicReply(JsonConvert.SerializeObject(NearMe)); - } - return BasicReply("Error not in a sim"); - } - return BasicReply("Token not accepted"); - } [About("Used to check HTTP connections")] [ReturnHints("world")] [NeedsToken(false)] - [Route(HttpVerbs.Get, "/hello")] + [Route(HttpVerbs.Get, "/Hello")] public object Hello() { return BasicReply("world"); @@ -221,7 +144,7 @@ namespace BetterSecondBot.HttpService [About("Removes the given token from the accepted token pool")] [ReturnHints("Failed to remove token")] [ReturnHints("ok")] - [Route(HttpVerbs.Get, "/logout/{token}")] + [Route(HttpVerbs.Get, "/Logout/{token}")] public object Logout(string token) { if (tokens.Allow(token, "core", "logout", getClientIP()) == true) @@ -235,7 +158,7 @@ namespace BetterSecondBot.HttpService [About("Fetchs the current bot")] [ReturnHints("The build ID of the bot")] - [Route(HttpVerbs.Get, "/version/{token}")] + [Route(HttpVerbs.Get, "/Version/{token}")] public object Version(string token) { if (tokens.Allow(token, "core", "version", getClientIP()) == true) @@ -247,7 +170,7 @@ namespace BetterSecondBot.HttpService [About("Fetchs the name of the bot")] [ReturnHints("Firstname Lastname")] - [Route(HttpVerbs.Get, "/name/{token}")] + [Route(HttpVerbs.Get, "/Name/{token}")] public object Name(string token) { if (tokens.Allow(token, "core", "name", getClientIP()) == true) @@ -260,7 +183,7 @@ namespace BetterSecondBot.HttpService [About("Fetchs the current region name")] [ReturnHints("Regionname")] [ReturnHints("Error not in a sim")] - [Route(HttpVerbs.Get, "/regionname/{token}")] + [Route(HttpVerbs.Get, "/Regionname/{token}")] public object Regionname(string token) { if (tokens.Allow(token, "core", "regionname", getClientIP()) == true) @@ -277,7 +200,7 @@ namespace BetterSecondBot.HttpService [About("Fetchs the current location of the bot")] [ReturnHints("array of X,Y,Z values")] [ReturnHints("Error not in a sim")] - [Route(HttpVerbs.Get, "/location/{token}")] + [Route(HttpVerbs.Get, "/Location/{token}")] public object Location(string token) { if (tokens.Allow(token, "core", "location", getClientIP()) == true) @@ -301,8 +224,8 @@ namespace BetterSecondBot.HttpService [ReturnHints("accepted")] [ReturnHints("Auth not accepted")] [ReturnHints("Failed")] - [Route(HttpVerbs.Post, "/command/{token}")] - public async Task command(string token) + [Route(HttpVerbs.Post, "/Command/{token}")] + public async Task Command(string token) { if (tokens.Allow(token, "core", "command", getClientIP()) == true) { diff --git a/BetterSecondbot/HttpService/Dialogs.cs b/BetterSecondbot/HttpService/Dialogs.cs new file mode 100644 index 0000000..e016faa --- /dev/null +++ b/BetterSecondbot/HttpService/Dialogs.cs @@ -0,0 +1,99 @@ +using BetterSecondBot.bottypes; +using BetterSecondBot.Static; +using EmbedIO; +using EmbedIO.Routing; +using EmbedIO.WebApi; +using System; +using System.Collections.Generic; +using System.Text; +using OpenMetaverse; +using Newtonsoft.Json; +using System.Reflection; + +namespace BetterSecondBot.HttpService +{ + public class HTTP_Dialogs : WebApiControllerWithTokens + { + public HTTP_Dialogs(SecondBot mainbot, TokenStorage setuptokens) : base(mainbot, setuptokens) { } + + [About("Updates the relay target (you can have 1 of each type)
Clear will disable them all")] + [ReturnHints("cleared")] + [ReturnHints("set/avatar")] + [ReturnHints("set/http")] + [ReturnHints("set/channel")] + [ReturnHints("Not a vaild option")] + [ArgHints("target","URLARG", "Options: Channel (Any number),Avatar UUID,HTTPurl
Clear")] + [Route(HttpVerbs.Get, "/DialogRelay/{target}/{token}")] + public object DialogRelay(string target,string token) + { + if (tokens.Allow(token, "dialogs", "DialogRelay", getClientIP()) == false) + { + return BasicReply("Token not accepted"); + } + if (target == "clear") + { + bot.SetRelayDialogsAvatar(UUID.Zero); + bot.SetRelayDialogsChannel(0); + bot.SetRelayDialogsHTTP(""); + return BasicReply("cleared"); + } + ProcessAvatar(target); + if (avataruuid != UUID.Zero) + { + bot.SetRelayDialogsAvatar(avataruuid); + return BasicReply("set/avatar"); + } + if (target.StartsWith("http") == true) + { + bot.SetRelayDialogsHTTP(target); + return BasicReply("set/http"); + } + if (int.TryParse(target, out int channel) == true) + { + bot.SetRelayDialogsChannel(channel); + return BasicReply("set/channel"); + } + return BasicReply("Not a vaild option"); + + } + + [About("Makes the bot interact with the dialog [dialogid] with the button [buttontext]")] + [ReturnHints("true")] + [ReturnHints("false")] + [ReturnHints("bad dialog id")] + [ArgHints("target", "URLARG", "Options: Channel (Any number),Avatar UUID,HTTPurl
Clear")] + [Route(HttpVerbs.Get, "/DialogResponce/{dialogid}/{buttontext}/{token}")] + public object DialogResponce(string dialogid, string buttontext, string token) + { + if (tokens.Allow(token, "dialogs", "DialogResponce", getClientIP()) == false) + { + return BasicReply("Token not accepted"); + } + if (int.TryParse(dialogid, out int dialogidnum) == false) + { + return BasicReply("bad dialog id"); + } + return BasicReply(bot.DialogReply(dialogidnum, buttontext).ToString()); + } + + [About("Should the bot track dialogs and send them to the relays setup?")] + [ReturnHints("updated")] + [ReturnHints("bad status")] + [ArgHints("status", "URLARG", "true or false")] + [Route(HttpVerbs.Get, "/DialogTrack/{status}/{token}")] + public object DialogTrack(string status, string token) + { + if (tokens.Allow(token, "dialogs", "DialogTrack", getClientIP()) == false) + { + return BasicReply("Token not accepted"); + } + if (bool.TryParse(status, out bool statuscode) == false) + { + return BasicReply("bad status"); + } + bot.SetTrackDialogs(statuscode); + return BasicReply("updated"); + } + + } +} diff --git a/BetterSecondbot/HttpService/Discord.cs b/BetterSecondbot/HttpService/Discord.cs new file mode 100644 index 0000000..598a42b --- /dev/null +++ b/BetterSecondbot/HttpService/Discord.cs @@ -0,0 +1,105 @@ +using BetterSecondBot.bottypes; +using BetterSecondBot.Static; +using EmbedIO; +using EmbedIO.Routing; +using EmbedIO.WebApi; +using System; +using System.Collections.Generic; +using System.Text; +using OpenMetaverse; +using Newtonsoft.Json; +using System.Reflection; +using Discord.WebSocket; +using System.Threading.Tasks; +using Discord; + +namespace BetterSecondBot.HttpService +{ + public class HTTP_Discord : WebApiControllerWithTokens + { + public HTTP_Discord(SecondBot mainbot, TokenStorage setuptokens) : base(mainbot, setuptokens) { } + + [About("Adds a discord server role to the selected member")] + [ReturnHints("Discord client not ready")] + [ReturnHints("true")] + [ReturnHints("false")] + [ArgHints("serverid","URLARG","the server id to apply this action to")] + [ArgHints("roleid", "URLARG", "the role id we are giving")] + [ArgHints("memberid", "URLARG", "who we are giving it to")] + [Route(HttpVerbs.Get, "/Discord_AddRole/{serverid}/{roleid}/{memberid}/{token}")] + public object Discord_AddRole(string serverid,string roleid,string memberid,string token) + { + if (tokens.Allow(token, "discord", "Discord_AddRole", getClientIP()) == false) + { + return BasicReply("Token not accepted"); + } + if (bot.discordReady() == false) + { + return BasicReply("Discord client not ready"); + } + return BasicReply(addRoleToMember(serverid, roleid, memberid).Result.ToString()); + } + + [About("Adds the selected user to the ban list - Disallows rejoining untill they are removed from the list")] + [ReturnHints("Discord client not ready")] + [ReturnHints("true")] + [ReturnHints("false")] + [ArgHints("serverid", "URLARG", "the server id to apply this action to")] + [ArgHints("memberid", "URLARG", "who we are giving it to")] + [ArgHints("why", "string", "why they are being banned")] + [Route(HttpVerbs.Get, "/Discord_BanMember/{serverid}/{memberid}/{token}")] + public object Discord_BanMember(string serverid, string memberid, [FormField] string why, string token) + { + if (tokens.Allow(token, "discord", "Discord_BanMember", getClientIP()) == false) + { + return BasicReply("Token not accepted"); + } + if (bot.discordReady() == false) + { + return BasicReply("Discord client not ready"); + } + return BasicReply(BanMember(serverid, memberid, why).Result.ToString()); + } + + + protected async Task BanMember(string givenserverid, string givenmemberid, string why) + { + DiscordSocketClient Discord = bot.getDiscordClient(); + if (ulong.TryParse(givenserverid, out ulong serverid) == false) + { + return false; + } + if (ulong.TryParse(givenmemberid, out ulong memberid) == false) + { + return false; + } + SocketGuild server = Discord.GetGuild(serverid); + SocketGuildUser user = server.GetUser(memberid); + await user.BanAsync(7, why); + return true; + } + + + protected async Task addRoleToMember(string givenserverid, string givenroleid, string givenmemberid) + { + DiscordSocketClient Discord = bot.getDiscordClient(); + if (ulong.TryParse(givenserverid, out ulong serverid) == false) + { + return false; + } + if (ulong.TryParse(givenroleid, out ulong roleid) == false) + { + return false; + } + if (ulong.TryParse(givenmemberid, out ulong memberid) == false) + { + return false; + } + SocketGuild server = Discord.GetGuild(serverid); + SocketRole role = server.GetRole(roleid); + SocketGuildUser user = server.GetUser(memberid); + await user.AddRoleAsync(role); // ? Irole seems to accept SocketRole ? + return true; + } + } +} diff --git a/BetterSecondbot/HttpService/Estate.cs b/BetterSecondbot/HttpService/Estate.cs index 2ca799b..863fd4b 100644 --- a/BetterSecondbot/HttpService/Estate.cs +++ b/BetterSecondbot/HttpService/Estate.cs @@ -20,8 +20,8 @@ namespace BetterSecondBot.HttpService [About("Requests the estate banlist")] [ReturnHints("")] - [Route(HttpVerbs.Get, "/banlist/{token}")] - public Object Banlist(string token) + [Route(HttpVerbs.Get, "/GetEstateBanList/{token}")] + public Object GetEstateBanList(string token) { if (tokens.Allow(token, "estate", "banlist", getClientIP()) == true) { @@ -38,9 +38,9 @@ namespace BetterSecondBot.HttpService [ArgHints("avatar", "URLARG", "the uuid avatar you wish to ban")] [ArgHints("mode", "URLARG", "What action would you like to take
Defaults to remove if not given \"add\"")] [ArgHints("global", "URLARG", "if true this the ban/unban will be applyed to all estates the bot has access to")] - [Route(HttpVerbs.Get, "/update-banlist/{avatar}/{mode}/{global}/{token}")] + [Route(HttpVerbs.Get, "/UpdateEstateBanlist/{avatar}/{mode}/{global}/{token}")] - public Object UpdateBanlist(string avatar, string mode, string global, string token) + public Object UpdateEstateBanlist(string avatar, string mode, string global, string token) { if (tokens.Allow(token, "estate", "banlist-add", getClientIP()) == true) { diff --git a/BetterSecondbot/HttpService/HttpAsService.cs b/BetterSecondbot/HttpService/HttpAsService.cs index a09fd92..de0762d 100644 --- a/BetterSecondbot/HttpService/HttpAsService.cs +++ b/BetterSecondbot/HttpService/HttpAsService.cs @@ -14,6 +14,9 @@ using EmbedIO.Routing; using BetterSecondBotShared.logs; using BetterSecondBotShared.IO; using Newtonsoft.Json; +using OpenMetaverse; +using System.Reflection; +using System.Linq; namespace BetterSecondBot.HttpService { @@ -145,7 +148,7 @@ namespace BetterSecondBot.HttpService if (killedLogger == false) { killedLogger = true; - Logger.UnregisterLogger(); + Swan.Logging.Logger.UnregisterLogger(); } using (var server = CreateWebServer(Config.Http_Host)) { @@ -259,6 +262,24 @@ namespace BetterSecondBot.HttpService protected Dictionary scopedtokens = new Dictionary(); + protected List OneTimeTokens = new List(); + + public string OneTimeToken() + { + bool known = true; + string last = ""; + while (known == true) + { + last = helpers.GetSHA1(last + helpers.UnixTimeNow() + new Random().Next(13256).ToString()).Substring(0, 10); + if(OneTimeTokens.Contains(last) == false) + { + known = false; + OneTimeTokens.Add(last); + } + } + return last; + } + public void AddScopedToken(string code, scopedTokenInfo info) { scopedtokens.Add(code, info); @@ -308,6 +329,11 @@ namespace BetterSecondBot.HttpService return true; } } + if(OneTimeTokens.Contains(code) == true) + { + OneTimeTokens.Remove(code); + return true; + } return ScopeAllow(code, workgroup, command); } @@ -370,7 +396,43 @@ namespace BetterSecondBot.HttpService protected TokenStorage tokens; protected SecondBot bot; public bool needsToken { get; set; } + protected UUID avataruuid = UUID.Zero; + protected string CallMethod(string name,string[] args) + { + MethodInfo[] methods = this.GetType().GetMethods(); + MethodInfo found = null; + foreach(MethodInfo M in methods) + { + if(M.Name == name) + { + found = M; + break; + } + } + if(found == null) + { + return "Failed:Not Found"; + } + List settings = new List(args); + settings.Add(tokens.OneTimeToken()); + if(found.GetParameters().Length != settings.Count) + { + return "Failed:Incorrect args"; + } + string reply = (string)found.Invoke(this, settings.Cast().ToArray()); + return "Passed:"+ reply; + } + protected void ProcessAvatar(string avatar) + { + string[] bits = avatar.Split(' '); + avataruuid = UUID.Zero; + if (bits.Length == 2) + { + avatar = bot.FindAvatarName2Key(avatar); + } + UUID.TryParse(avatar, out avataruuid); + } protected Object BasicReply(string input) { diff --git a/BetterSecondbot/HttpService/Im.cs b/BetterSecondbot/HttpService/Im.cs index feaee26..ee0d79e 100644 --- a/BetterSecondbot/HttpService/Im.cs +++ b/BetterSecondbot/HttpService/Im.cs @@ -15,17 +15,16 @@ namespace BetterSecondBot.HttpService { public HttpApiIM(SecondBot mainbot, TokenStorage setuptokens) : base(mainbot, setuptokens) { } - [About("gets a full list of all chat windows")] [ReturnHints("array UUID = Name")] [Route(HttpVerbs.Get, "/chatwindows/{token}")] public object chatwindows(string token) { - if (tokens.Allow(token, "im", "chatwindows", getClientIP()) == true) + if (tokens.Allow(token, "im", "chatwindows", getClientIP()) == false) { - return BasicReply(JsonConvert.SerializeObject(bot.GetIMChatWindowKeyNames())); + return BasicReply("Token not accepted"); } - return BasicReply("Token not accepted"); + return BasicReply(JsonConvert.SerializeObject(bot.GetIMChatWindowKeyNames())); } [About("gets a list of chat windows with unread messages")] @@ -33,19 +32,19 @@ namespace BetterSecondBot.HttpService [Route(HttpVerbs.Get, "/listwithunread/{token}")] public object listwithunread(string group, string token) { - if (tokens.Allow(token, "im", "listwithunread", getClientIP()) == true) + if (tokens.Allow(token, "im", "listwithunread", getClientIP()) == false) { - List unreadimwindows = new List(); - foreach (UUID window in bot.IMChatWindows()) - { - if (bot.ImChatWindowHasUnread(window) == true) - { - unreadimwindows.Add(window); - } - } - return BasicReply(JsonConvert.SerializeObject(unreadimwindows)); + return BasicReply("Token not accepted"); } - return BasicReply("Token not accepted"); + List unreadimwindows = new List(); + foreach (UUID window in bot.IMChatWindows()) + { + if (bot.ImChatWindowHasUnread(window) == true) + { + unreadimwindows.Add(window); + } + } + return BasicReply(JsonConvert.SerializeObject(unreadimwindows)); } [About("gets if there are any unread im messages at all")] @@ -53,20 +52,20 @@ namespace BetterSecondBot.HttpService [Route(HttpVerbs.Get, "/haveunreadims/{token}")] public object haveunreadims(string token) { - if (tokens.Allow(token, "im", "haveunreadims", getClientIP()) == true) + if (tokens.Allow(token, "im", "haveunreadims", getClientIP()) == false) { - bool reply = false; - foreach(UUID window in bot.IMChatWindows()) - { - if(bot.ImChatWindowHasUnread(window) == true) - { - reply = true; - break; - } - } - return BasicReply(reply.ToString()); + return BasicReply("Token not accepted"); } - return BasicReply("Token not accepted"); + bool reply = false; + foreach (UUID window in bot.IMChatWindows()) + { + if (bot.ImChatWindowHasUnread(window) == true) + { + reply = true; + break; + } + } + return BasicReply(reply.ToString()); } [About("gets the chat from the selected window")] @@ -76,32 +75,15 @@ namespace BetterSecondBot.HttpService [Route(HttpVerbs.Get, "/getimchat/{window}/{token}")] public object getimchat(string window, string token) { - if (tokens.Allow(token, "im", "getimchat", getClientIP()) == true) + if (tokens.Allow(token, "im", "getimchat", getClientIP()) == false) + { + return BasicReply("Token not accepted"); + } + if (UUID.TryParse(window, out UUID windowUUID) == false) { - if (UUID.TryParse(window, out UUID windowUUID) == true) - { - return BasicReply(JsonConvert.SerializeObject(bot.GetIMChatWindow(windowUUID))); - } return BasicReply("Window UUID invaild"); } - return BasicReply("Token not accepted"); + return BasicReply(JsonConvert.SerializeObject(bot.GetIMChatWindow(windowUUID))); } - - [About("sends a im to the selected avatar")] - [ArgHints("avatar", "URLARG", "a UUID or Firstname Lastname")] - [ArgHints("message", "Text", "the message to send")] - [ReturnHints("ok")] - [Route(HttpVerbs.Post, "/sendimchat/{avatar}/{token}")] - public object sendimchat(string avatar, string token, [FormField] string message) - { - if (tokens.Allow(token, "im", "sendimchat", getClientIP()) == true) - { - bot.GetCommandsInterface.Call("im", avatar + "~#~" + message, UUID.Zero, "~#~"); - return BasicReply("ok"); - } - return BasicReply("Token not accepted"); - } - - } } diff --git a/BetterSecondbot/WikiMake/wikimake.cs b/BetterSecondbot/WikiMake/wikimake.cs index 7ceb9e9..fcb9b60 100644 --- a/BetterSecondbot/WikiMake/wikimake.cs +++ b/BetterSecondbot/WikiMake/wikimake.cs @@ -293,11 +293,6 @@ namespace BetterSecondBot.WikiMake api_reports.Add("Core", new KeyValuePair(cmd.ApiCommandsCount, "Good")); InterfaceWiki("Core", cmd, true); - // RLVapi - BetterSecondBot.RLV.RLVcontrol RLVapi = new BetterSecondBot.RLV.RLVcontrol(null); - api_reports.Add("RLVapi", new KeyValuePair(RLVapi.ApiCommandsCount, "Limited")); - InterfaceWiki("RLVapi", RLVapi, true); - // HTTP HTTPWiki(); diff --git a/Core/Commands/Animation/PlayGesture.cs b/Core/Commands/Animation/PlayGesture.cs deleted file mode 100644 index 56fd4e4..0000000 --- a/Core/Commands/Animation/PlayGesture.cs +++ /dev/null @@ -1,25 +0,0 @@ -using OpenMetaverse; - -namespace BetterSecondBot.Commands.Animation -{ - public class PlayGesture : CoreCommand_1arg - { - public override string[] ArgTypes { get { return new[] { "UUID" }; } } - public override string[] ArgHints { get { return new[] { "The UUID of the gesture to play" }; } } - public override string Helpfile { get { return "Triggers a gesture [once]"; } } - public override bool CallFunction(string[] args) - { - if (base.CallFunction(args) == true) - { - if (UUID.TryParse(args[0], out UUID gesture) == true) - { - InventoryItem itm = bot.GetClient.Inventory.FetchItem(gesture, bot.GetClient.Self.AgentID, (3 * 1000)); - bot.GetClient.Self.PlayGesture(itm.AssetUUID); - return true; - } - return Failed("Invaild gesture UUID for arg 1"); - } - return false; - } - } -} diff --git a/Core/Commands/Animation/addToAnimations.cs b/Core/Commands/Animation/addToAnimations.cs deleted file mode 100644 index 1bf9078..0000000 --- a/Core/Commands/Animation/addToAnimations.cs +++ /dev/null @@ -1,33 +0,0 @@ -using OpenMetaverse; - -namespace BetterSecondBot.Commands.Animation -{ - public class AddToAllowAnimations : CoreCommand_1arg - { - public override string[] ArgTypes { get { return new[] { "Avatar" }; } } - public override string[] ArgHints { get { return new[] { "Avatar UUID or Firstname Lastname" }; } } - public override string Helpfile { get { return "Toggles if animation requests from this avatar (used for remote poseballs) are accepted
Case sensitive also requires Lastname"; } } - public override bool CallFunction(string[] args) - { - if(base.CallFunction(args) == true) - { - if(UUID.TryParse(args[0],out UUID avatar) == true) - { - if(bot.Accept_action_from("animation",avatar) == false) - { - bot.Add_action_from("animation", avatar); - InfoBlob = "Granted perm animation"; - } - else - { - bot.Remove_action_from("animation", avatar,true); - InfoBlob = "Removed perm animation"; - } - return true; - } - return Failed("Invaild avatar for arg 1"); - } - return false; - } - } -} diff --git a/Core/Commands/Animation/resetAnimations.cs b/Core/Commands/Animation/resetAnimations.cs deleted file mode 100644 index 8b673b3..0000000 --- a/Core/Commands/Animation/resetAnimations.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace BetterSecondBot.Commands.Animation -{ - public class ResetAnimations : CoreCommand - { - public override string Helpfile { get { return "Resets the animation stack for the bot"; } } - public override bool CallFunction(string[] args) - { - bot.ResetAnimations(); - return true; - } - } -} diff --git a/Core/Commands/Avatars/NearMe.cs b/Core/Commands/Avatars/NearMe.cs deleted file mode 100644 index 4b301cc..0000000 --- a/Core/Commands/Avatars/NearMe.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Linq; -using OpenMetaverse; -using Newtonsoft.Json; - -namespace BetterSecondBot.Commands.Avatars -{ - class RoleCreate : CoreCommand_SmartReply_1arg - { - public override string Helpfile { get { return "Gets a list of avatars near the bot"; } } - public override bool CallFunction(string[] args) - { - if (base.CallFunction(args) == true) - { - Dictionary collection = new Dictionary(); - foreach(Avatar av in bot.GetClient.Network.CurrentSim.ObjectsAvatars.Copy().Values) - { - Vector3 pos = new Vector3(1, 1, 1); - if(bot.GetClient.Network.CurrentSim.AvatarPositions.ContainsKey(av.ID) == true) - { - pos = bot.GetClient.Network.CurrentSim.AvatarPositions[av.ID]; - } - Dictionary entrys = new Dictionary(); - entrys.Add("Username",av.Name); - entrys.Add("Pos", pos.X.ToString() + "," + pos.Y.ToString() + "," + pos.Z.ToString()); - collection.Add(av.ID.ToString(), JsonConvert.SerializeObject(entrys)); - } - return bot.GetCommandsInterface.SmartCommandReply(true, args[0], "ok", CommandName, collection); - } - return false; - } - } -} diff --git a/Core/Commands/Avatars/PayAvatar.cs b/Core/Commands/Avatars/PayAvatar.cs deleted file mode 100644 index 268124d..0000000 --- a/Core/Commands/Avatars/PayAvatar.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Linq; -using OpenMetaverse; - - -namespace BetterSecondBot.Commands.Avatars -{ - public class PayAvatar : CoreCommand_2arg - { - public override string[] ArgTypes { get { return new[] { "Avatar", "Number" }; } } - public override string[] ArgHints { get { return new[] { "Avatar [UUID or Firstname Lastname]", "Amount to pay"}; } } - public override string Helpfile { get { return "Makes the bot pay a avatar"; } } - public override bool CallFunction(string[] args) - { - if (base.CallFunction(args) == true) - { - if (bot.GetAllowFunds == true) - { - if (UUID.TryParse(args[0], out UUID avataruuid) == true) - { - if (int.TryParse(args[1], out int amount) == true) - { - if (amount > 0) - { - bot.GetClient.Self.GiveAvatarMoney(avataruuid, amount); - return true; - } - } - return Failed("Invaild amount"); - } - return Failed("Invaild avatar UUID"); - } - return Failed("Transfer funds to avatars disabled"); - } - return false; - } - } -} diff --git a/Core/Commands/Chat/LocalChatHistory.cs b/Core/Commands/Chat/LocalChatHistory.cs deleted file mode 100644 index d0fc35d..0000000 --- a/Core/Commands/Chat/LocalChatHistory.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System.Linq; -using Newtonsoft.Json; -using OpenMetaverse; - -namespace BetterSecondBot.Commands.Chat -{ - class LocalChatHistory : CoreCommand_SmartReply_1arg - { - public override string Helpfile { get { return "Gets the last 20 localchat messages the bot has."; } } - public override bool CallFunction(string[] args) - { - if(base.CallFunction(args) == true) - { - return bot.GetCommandsInterface.SmartCommandReply(true, args[0], JsonConvert.SerializeObject(bot.getLocalChatHistory()), CommandName); - } - return false; - } - } -} diff --git a/Core/Commands/Chat/im.cs b/Core/Commands/Chat/im.cs deleted file mode 100644 index 3396199..0000000 --- a/Core/Commands/Chat/im.cs +++ /dev/null @@ -1,35 +0,0 @@ -using OpenMetaverse; -using BetterSecondBotShared.Static; - -namespace BetterSecondBot.Commands.Chat -{ - class IM : CoreCommand_2arg - { - public override string[] ArgTypes { get { return new[] { "Avatar", "Text" }; } } - public override string[] ArgHints { get { return new[] { "Avatar [UUID or Firstname Lastname]","Message" }; } } - public override string Helpfile { get { return "Makes the bot send a IM to an avatar
Example: IM|||289c3e36-69b3-40c5-9229-0c6a5d230766~#~Hello Mad I am a bot"; } } - public override bool CallFunction(string[] args) - { - if (base.CallFunction(args) == true) - { - if (UUID.TryParse(args[0], out UUID target_av) == true) - { - if (helpers.notempty(args[1]) == true) - { - bot.SendIM(target_av, args[1]); - return true; - } - else - { - return Failed("Arg 2 is empty"); - } - } - else - { - return Failed("Not a vaild UUID"); - } - } - return false; - } - } -} diff --git a/Core/Commands/Chat/say.cs b/Core/Commands/Chat/say.cs deleted file mode 100644 index e07ff91..0000000 --- a/Core/Commands/Chat/say.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System.Linq; -using OpenMetaverse; - -namespace BetterSecondBot.Commands.Chat -{ - class Say : CoreCommand_1arg - { - public override string[] ArgTypes { get { return new[] { "Mixed","Text","Text" }; } } - public override string[] ArgHints { get { return new[] { "Message or channel","Message","Chat level" }; } } - public override string Helpfile { get { return "Makes the bot talk via chat
Example: say|||Hello
Example: say|||12~#~Goodbye
Example: say|||12~#~Goodbye~#~Shout
Chat levels [Arg 3]:
Whisper
Shout"; } } - public override bool CallFunction(string[] args) - { - if(base.CallFunction(args) == true) - { - string message = args[0]; - int channel = 0; - ChatType ChatLevel = ChatType.Normal; - if (args.Count() >= 2) - { - message = args[1]; - int.TryParse(args[0], out channel); - if (args.Count() == 3) - { - if (args[2] == "Shout") - { - ChatLevel = ChatType.Shout; - } - else if (args[2] == "Whisper") - { - ChatLevel = ChatType.Whisper; - } - } - } - if (channel == 0) - { - bot.AddToLocalChat(bot.GetClient.Self.Name, message); - } - bot.GetClient.Self.Chat(message, channel, ChatLevel); - return true; - } - return false; - } - } -} diff --git a/Core/Commands/Dialogs/DialogRelay.cs b/Core/Commands/Dialogs/DialogRelay.cs deleted file mode 100644 index c4e2714..0000000 --- a/Core/Commands/Dialogs/DialogRelay.cs +++ /dev/null @@ -1,46 +0,0 @@ -using OpenMetaverse; - -namespace BetterSecondBot.Commands.Dialogs -{ - class DialogRelay : CoreCommand_1arg - { - public override string[] ArgTypes { get { return new[] { "Smart" }; } } - public override string[] ArgHints { get { return new[] { "Channel (Any number),Avatar UUID,Avatar name,HTTPurl
Clear" }; } } - public override string Helpfile { get { return "Updates the relay target (you can have 1 of each type)
Clear will disable them all"; } } - public override bool CallFunction(string[] args) - { - if (base.CallFunction(args) == true) - { - if(args[0] != "Clear") - { - if (UUID.TryParse(args[0], out UUID avatar) == true) - { - bot.SetRelayDialogsAvatar(avatar); - } - else if (args[0].StartsWith("http") == true) - { - bot.SetRelayDialogsHTTP(args[0]); - } - else if (int.TryParse(args[0], out int channel) == true) - { - bot.SetRelayDialogsChannel(channel); - } - else - { - return Failed("Not a vaild option"); - } - return true; - } - else - { - bot.SetRelayDialogsAvatar(UUID.Zero); - bot.SetRelayDialogsChannel(0); - bot.SetRelayDialogsHTTP(""); - return true; - } - } - return false; - } - } - -} diff --git a/Core/Commands/Dialogs/DialogResponce.cs b/Core/Commands/Dialogs/DialogResponce.cs deleted file mode 100644 index eadf43f..0000000 --- a/Core/Commands/Dialogs/DialogResponce.cs +++ /dev/null @@ -1,25 +0,0 @@ -namespace BetterSecondBot.Commands.Dialogs -{ - class DialogResponce : CoreCommand_2arg - { - public override string[] ArgTypes { get { return new[] { "Number","Text" }; } } - public override string[] ArgHints { get { return new[] { "DialogID","Button to click" }; } } - public override string Helpfile { get { return "Makes the bot interact with the dialog [ARG 1] with the button [ARG 2]"; } } - public override bool CallFunction(string[] args) - { - if (base.CallFunction(args) == true) - { - if (int.TryParse(args[0], out int dialogid) == true) - { - return bot.DialogReply(dialogid, args[1]); - } - else - { - return Failed("Invaild dialog id"); - } - } - return false; - } - } - -} diff --git a/Core/Commands/Dialogs/DialogTrack.cs b/Core/Commands/Dialogs/DialogTrack.cs deleted file mode 100644 index 36f65db..0000000 --- a/Core/Commands/Dialogs/DialogTrack.cs +++ /dev/null @@ -1,22 +0,0 @@ -namespace BetterSecondBot.Commands.Dialogs -{ - class DialogTrack : CoreCommand_1arg - { - public override string[] ArgTypes { get { return new[] { "True|False" }; } } - public override string[] ArgHints { get { return new[] { "Status" }; } } - public override string Helpfile { get { return "Should the bot track dialogs and send them to the relays setup?"; } } - public override bool CallFunction(string[] args) - { - if (base.CallFunction(args) == true) - { - if(bool.TryParse(args[0],out bool status) == true) - { - bot.SetTrackDialogs(status); - return true; - } - } - return false; - } - } - -} diff --git a/Core/Commands/DiscordAPI/AddRole.cs b/Core/Commands/DiscordAPI/AddRole.cs deleted file mode 100644 index 8887c88..0000000 --- a/Core/Commands/DiscordAPI/AddRole.cs +++ /dev/null @@ -1,53 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Linq; -using OpenMetaverse; -using Newtonsoft.Json; -using Discord.WebSocket; -using Discord; -using Discord.Rest; -using System.Threading.Tasks; - -namespace BetterSecondBot.Commands.DiscordAPI -{ - class Discord_AddRole : CoreCommand_4arg - { - public override string[] ArgTypes { get { return new[] { "Smart", "Number", "Number", "Number" }; } } - public override string[] ArgHints { get { return new[] { "Mixed [Channel|Avatar uuid|Avatar name|http url]", "Discord server id", "Role id", "Member id" }; } } - public override string Helpfile { get { return "Adds the selected role to the member"; } } - public override bool CallFunction(string[] args) - { - if (base.CallFunction(args) == true) - { - if (bot.discordReady() == false) - { - return bot.GetCommandsInterface.SmartCommandReply(false, args[0], bot.getDiscordWhyFailed(), CommandName); - } - bool reply = addRoleToMember(args).Result; - return bot.GetCommandsInterface.SmartCommandReply(reply, args[0], "see status for state", CommandName); - } - return bot.GetCommandsInterface.SmartCommandReply(false, args[0], "incorrect args", CommandName); - } - - protected async Task addRoleToMember(string[] args) - { - DiscordSocketClient Discord = bot.getDiscordClient(); - if (ulong.TryParse(args[1], out ulong serverid) == true) - { - if(ulong.TryParse(args[2], out ulong roleid) == true) - { - if (ulong.TryParse(args[3], out ulong memberid) == true) - { - SocketGuild server = Discord.GetGuild(serverid); - SocketRole role = server.GetRole(roleid); - SocketGuildUser user = server.GetUser(memberid); - await user.AddRoleAsync(role); // ? Irole seems to accept SocketRole ? - return true; - } - } - } - return false; - } - } -} diff --git a/Core/Commands/DiscordAPI/Ban_Member.cs b/Core/Commands/DiscordAPI/Ban_Member.cs deleted file mode 100644 index 1485016..0000000 --- a/Core/Commands/DiscordAPI/Ban_Member.cs +++ /dev/null @@ -1,54 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Linq; -using OpenMetaverse; -using Newtonsoft.Json; -using Discord.WebSocket; -using Discord; -using Discord.Rest; -using System.Threading.Tasks; - -namespace BetterSecondBot.Commands.DiscordAPI -{ - class Discord_BanMember : CoreCommand_3arg - { - public override string[] ArgTypes { get { return new[] { "Smart", "Number", "Number","Text" }; } } - public override string[] ArgHints { get { return new[] { "Mixed [Channel|Avatar uuid|Avatar name|http url]", "Discord server id", "Member id","Optional why message" }; } } - public override string Helpfile { get { return "Adds the selected user to the ban list - Disallows rejoining untill they are removed from the list "; } } - public override bool CallFunction(string[] args) - { - if (base.CallFunction(args) == true) - { - if (bot.discordReady() == false) - { - return bot.GetCommandsInterface.SmartCommandReply(false, args[0], bot.getDiscordWhyFailed(), CommandName); - } - bool reply = BanMember(args).Result; - return bot.GetCommandsInterface.SmartCommandReply(reply, args[0], "see status for state", CommandName); - } - return bot.GetCommandsInterface.SmartCommandReply(false, args[0], "incorrect args", CommandName); - } - - protected async Task BanMember(string[] args) - { - DiscordSocketClient Discord = bot.getDiscordClient(); - if (ulong.TryParse(args[1], out ulong serverid) == true) - { - if (ulong.TryParse(args[2], out ulong memberid) == true) - { - SocketGuild server = Discord.GetGuild(serverid); - SocketGuildUser user = server.GetUser(memberid); - string why = "Secondbot API ban - see your own logs"; - if (args.Length == 4) - { - why = args[3]; - } - await user.BanAsync(7, why); - return true; - } - } - return false; - } - } -} diff --git a/Core/RLV/Blacklist/getblacklist.cs b/Core/RLV/Blacklist/getblacklist.cs deleted file mode 100644 index 1e7b9ad..0000000 --- a/Core/RLV/Blacklist/getblacklist.cs +++ /dev/null @@ -1,75 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace BetterSecondBot.RLV.Blacklist -{ - public class GetBlacklist : RLV_command_1arg - { - public override bool CallFunction(string[] args) - { - if (base.CallFunction(args) == true) - { - int channel; - string filter = ""; - if(args.Length == 2) - { - if(int.TryParse(args[1], out channel) == true) - { - filter = args[0]; - } - } - else - { - int.TryParse(args[0], out channel); - } - if (channel >= 0) - { - string sendim = ""; - string recvim = ""; - if (filter == "") - { - sendim = String.Join('|', bot.Getblacklist_sendim); - recvim = String.Join('|', bot.Getblacklist_recvim); - } - else - { - string addon = ""; - foreach (string a in bot.Getblacklist_sendim) - { - if (a.Contains(filter) == true) - { - sendim = "" + sendim + "" + addon + "" + a + ""; - addon = "|"; - } - } - addon = ""; - foreach (string a in bot.Getblacklist_recvim) - { - if (a.Contains(filter) == true) - { - recvim = "" + recvim + "" + addon + "" + a + ""; - addon = "|"; - } - } - } - if (sendim == "") - { - sendim = "#"; - } - if (recvim == "") - { - recvim = "#"; - } - bot.GetClient.Self.Chat("" + sendim + "," + recvim + "", channel, OpenMetaverse.ChatType.Normal); - return true; - } - else - { - return Failed("Invaild channel given"); - } - } - return false; - } - } -} diff --git a/Core/RLV/Blacklist/versionnumbl.cs b/Core/RLV/Blacklist/versionnumbl.cs deleted file mode 100644 index efa4439..0000000 --- a/Core/RLV/Blacklist/versionnumbl.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace BetterSecondBot.RLV.Blacklist -{ - public class VersionNumBL : RLV_command_1arg - { - public override bool CallFunction(string[] args) - { - if (base.CallFunction(args) == true) - { - _ = int.TryParse(args[0], out int channel); - if (channel >= 0) - { - string sendim = String.Join('|', bot.Getblacklist_sendim); - string recvim = String.Join('|', bot.Getblacklist_recvim); - if (sendim == "") { sendim = "#"; } - if (recvim == "") { recvim = "#"; } - bot.GetClient.Self.Chat("209000," + sendim + "," + recvim + "", channel, OpenMetaverse.ChatType.Normal); - return true; - } - else - { - return Failed("Invaild channel given"); - } - } - return false; - } - } -} diff --git a/Core/RLV/Camera/camavdist.cs b/Core/RLV/Camera/camavdist.cs deleted file mode 100644 index a96c182..0000000 --- a/Core/RLV/Camera/camavdist.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace BetterSecondBot.RLV.Camera -{ - public class CamAvDist : RLV_UUID_flag_arg_yn - { - - } -} diff --git a/Core/RLV/Camera/camdistmax.cs b/Core/RLV/Camera/camdistmax.cs deleted file mode 100644 index 52a3cc2..0000000 --- a/Core/RLV/Camera/camdistmax.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace BetterSecondBot.RLV.Camera -{ - public class CamDistMax : RLV_UUID_flag_arg_yn - { - } -} diff --git a/Core/RLV/Camera/camdistmin.cs b/Core/RLV/Camera/camdistmin.cs deleted file mode 100644 index b57aaec..0000000 --- a/Core/RLV/Camera/camdistmin.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace BetterSecondBot.RLV.Camera -{ - public class CamDistMin : RLV_UUID_flag_arg_yn - { - } -} diff --git a/Core/RLV/Camera/camdrawalphamax.cs b/Core/RLV/Camera/camdrawalphamax.cs deleted file mode 100644 index 686157f..0000000 --- a/Core/RLV/Camera/camdrawalphamax.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace BetterSecondBot.RLV.Camera -{ - public class CamDrawAlphaMax : RLV_UUID_flag_arg_yn - { - } -} diff --git a/Core/RLV/Camera/camdrawalphamin.cs b/Core/RLV/Camera/camdrawalphamin.cs deleted file mode 100644 index 5b45105..0000000 --- a/Core/RLV/Camera/camdrawalphamin.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace BetterSecondBot.RLV.Camera -{ - public class CamDrawAlphaMin : RLV_UUID_flag_arg_yn - { - } -} diff --git a/Core/RLV/Camera/camdrawcolor.cs b/Core/RLV/Camera/camdrawcolor.cs deleted file mode 100644 index 8dec3b2..0000000 --- a/Core/RLV/Camera/camdrawcolor.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace BetterSecondBot.RLV.Camera -{ - public class CamDrawColor : RLV_UUID_flag_4arg_yn - { - } -} diff --git a/Core/RLV/Camera/camdrawmax.cs b/Core/RLV/Camera/camdrawmax.cs deleted file mode 100644 index 18b5d98..0000000 --- a/Core/RLV/Camera/camdrawmax.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace BetterSecondBot.RLV.Camera -{ - public class CamDrawMax : RLV_UUID_flag_arg_yn - { - } -} diff --git a/Core/RLV/Camera/camdrawmin.cs b/Core/RLV/Camera/camdrawmin.cs deleted file mode 100644 index 38632a1..0000000 --- a/Core/RLV/Camera/camdrawmin.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace BetterSecondBot.RLV.Camera -{ - public class CamDrawMin : RLV_UUID_flag_arg_yn - { - } -} diff --git a/Core/RLV/Camera/camtextures.cs b/Core/RLV/Camera/camtextures.cs deleted file mode 100644 index 5e158d7..0000000 --- a/Core/RLV/Camera/camtextures.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace BetterSecondBot.RLV.Camera -{ - public class CamTextures : RLV_UUID_flag_optional_arg_yn - { - } -} diff --git a/Core/RLV/Camera/camunlock.cs b/Core/RLV/Camera/camunlock.cs deleted file mode 100644 index 17d6f43..0000000 --- a/Core/RLV/Camera/camunlock.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace BetterSecondBot.RLV.Camera -{ - public class CamUnlock : RLV_UUID_flag_yn - { - } -} diff --git a/Core/RLV/Camera/camzoommax.cs b/Core/RLV/Camera/camzoommax.cs deleted file mode 100644 index a25a2e0..0000000 --- a/Core/RLV/Camera/camzoommax.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace BetterSecondBot.RLV.Camera -{ - public class CamZoomMax : RLV_UUID_flag_arg_yn - { - } -} diff --git a/Core/RLV/Camera/camzoommin.cs b/Core/RLV/Camera/camzoommin.cs deleted file mode 100644 index ea0ed2e..0000000 --- a/Core/RLV/Camera/camzoommin.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace BetterSecondBot.RLV.Camera -{ - public class CamZoomMin : RLV_UUID_flag_arg_yn - { - } -} diff --git a/Core/RLV/Camera/getcam_avdistmax.cs b/Core/RLV/Camera/getcam_avdistmax.cs deleted file mode 100644 index d65c1e1..0000000 --- a/Core/RLV/Camera/getcam_avdistmax.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace BetterSecondBot.RLV.Camera -{ - public class GetCam_AvDistMax : RLV_UUID_flag_get - { - public override string LookupFlag { get { return "camavdistmax"; } } - } -} diff --git a/Core/RLV/Camera/getcam_avdistmin.cs b/Core/RLV/Camera/getcam_avdistmin.cs deleted file mode 100644 index 307de2c..0000000 --- a/Core/RLV/Camera/getcam_avdistmin.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace BetterSecondBot.RLV.Camera -{ - public class GetCam_AvDistMin : RLV_UUID_flag_get - { - public override string LookupFlag { get { return "camavdistmin"; } } - - } -} diff --git a/Core/RLV/Camera/getcam_fov.cs b/Core/RLV/Camera/getcam_fov.cs deleted file mode 100644 index e156c99..0000000 --- a/Core/RLV/Camera/getcam_fov.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace BetterSecondBot.RLV.Camera -{ - public class GetCam_Fov : RLV_UUID_flag_get - { - public override string LookupFlag { get { return "camfov"; } } - - } -} diff --git a/Core/RLV/Camera/getcam_fovmax.cs b/Core/RLV/Camera/getcam_fovmax.cs deleted file mode 100644 index 5ec4670..0000000 --- a/Core/RLV/Camera/getcam_fovmax.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace BetterSecondBot.RLV.Camera -{ - public class GetCam_FovMax : RLV_UUID_flag_get - { - public override string LookupFlag { get { return "camfovmax"; } } - - } -} diff --git a/Core/RLV/Camera/getcam_fovmin.cs b/Core/RLV/Camera/getcam_fovmin.cs deleted file mode 100644 index 0f275e8..0000000 --- a/Core/RLV/Camera/getcam_fovmin.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace BetterSecondBot.RLV.Camera -{ - public class GetCam_FovMin : RLV_UUID_flag_get - { - public override string LookupFlag { get { return "camfovmin"; } } - } -} diff --git a/Core/RLV/Camera/getcam_zoommin.cs b/Core/RLV/Camera/getcam_zoommin.cs deleted file mode 100644 index b516e4c..0000000 --- a/Core/RLV/Camera/getcam_zoommin.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace BetterSecondBot.RLV.Camera -{ - public class GetCam_ZoomMin : RLV_UUID_flag_get - { - public override string LookupFlag { get { return "camzoommin"; } } - - } -} diff --git a/Core/RLV/Camera/setcam_avdistmax.cs b/Core/RLV/Camera/setcam_avdistmax.cs deleted file mode 100644 index 5a1cd04..0000000 --- a/Core/RLV/Camera/setcam_avdistmax.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace BetterSecondBot.RLV.Camera -{ - public class SetCam_AvDistMax : RLV_UUID_flag_arg_yn - { - public override string SetFlagName { get { return "camavdistmax"; } } - } -} diff --git a/Core/RLV/Camera/setcam_avdistmin.cs b/Core/RLV/Camera/setcam_avdistmin.cs deleted file mode 100644 index b43a550..0000000 --- a/Core/RLV/Camera/setcam_avdistmin.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace BetterSecondBot.RLV.Camera -{ - public class SetCam_AvDistMin : RLV_UUID_flag_arg_yn - { - public override string SetFlagName { get { return "camavdistmin"; } } - - } -} diff --git a/Core/RLV/Camera/setcam_fov.cs b/Core/RLV/Camera/setcam_fov.cs deleted file mode 100644 index 8ab0cad..0000000 --- a/Core/RLV/Camera/setcam_fov.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace BetterSecondBot.RLV.Camera -{ - public class SetCam_Fov : RLV_UUID_flag_arg_yn - { - public override string SetFlagName { get { return "camfov"; } } - } -} diff --git a/Core/RLV/Camera/setcam_fovmax.cs b/Core/RLV/Camera/setcam_fovmax.cs deleted file mode 100644 index add8c0b..0000000 --- a/Core/RLV/Camera/setcam_fovmax.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace BetterSecondBot.RLV.Camera -{ - public class SetCam_FovMax : RLV_UUID_flag_arg_yn - { - public override string SetFlagName { get { return "camfovmax"; } } - } -} diff --git a/Core/RLV/Camera/setcam_fovmin.cs b/Core/RLV/Camera/setcam_fovmin.cs deleted file mode 100644 index a5241b8..0000000 --- a/Core/RLV/Camera/setcam_fovmin.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace BetterSecondBot.RLV.Camera -{ - public class SetCam_FovMin : RLV_UUID_flag_arg_yn - { - public override string SetFlagName { get { return "camfovmin"; } } - } -} diff --git a/Core/RLV/Camera/setcam_textures.cs b/Core/RLV/Camera/setcam_textures.cs deleted file mode 100644 index 7c77360..0000000 --- a/Core/RLV/Camera/setcam_textures.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace BetterSecondBot.RLV.Camera -{ - public class SetCam_Textures : RLV_UUID_flag_optional_arg_yn - { - public override string SetFlagName { get { return "camtextures"; } } - } -} diff --git a/Core/RLV/Camera/setcam_unlock.cs b/Core/RLV/Camera/setcam_unlock.cs deleted file mode 100644 index f4b6ff8..0000000 --- a/Core/RLV/Camera/setcam_unlock.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace BetterSecondBot.RLV.Camera -{ - public class SetCam_Unlock : RLV_UUID_flag_yn - { - public override string SetFlagName { get { return "camunlock"; } } - - } -} diff --git a/Core/RLV/Chat/chatnormal.cs b/Core/RLV/Chat/chatnormal.cs deleted file mode 100644 index 2100f9c..0000000 --- a/Core/RLV/Chat/chatnormal.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace BetterSecondBot.RLV.Chat -{ - public class ChatNormal : RLV_UUID_flag_yn - { - } -} diff --git a/Core/RLV/Chat/chatshout.cs b/Core/RLV/Chat/chatshout.cs deleted file mode 100644 index d4dc08e..0000000 --- a/Core/RLV/Chat/chatshout.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace BetterSecondBot.RLV.Chat -{ - public class ChatShout : RLV_UUID_flag_yn - { - } -} diff --git a/Core/RLV/Chat/chatwhisper.cs b/Core/RLV/Chat/chatwhisper.cs deleted file mode 100644 index cc67044..0000000 --- a/Core/RLV/Chat/chatwhisper.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace BetterSecondBot.RLV.Chat -{ - public class ChatWhisper : RLV_UUID_flag_yn - { - } -} diff --git a/Core/RLV/Chat/recvchat.cs b/Core/RLV/Chat/recvchat.cs deleted file mode 100644 index 459a54f..0000000 --- a/Core/RLV/Chat/recvchat.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using OpenMetaverse; - -namespace BetterSecondBot.RLV.Chat -{ - public class RecvChat : RLV_command_1arg - { - public override bool CallFunction(string[] args) - { - if (args.Length == 1) - { - if (args[0] == "y") - { - bot.SetLock("recvchat_channel_zero_lock", false); - return true; - } - else if (args[0] == "n") - { - bot.SetLock("recvchat_channel_zero_lock", true); - return true; - } - return Failed("y/n only"); - } - else if (args.Length == 2) - { - if (UUID.TryParse(args[0], out UUID rec_uuid) == true) - { - return SetFlag(args[1], "set", rec_uuid); - } - return Failed("Unable to process target UUID"); - } - return Failed("Unsupported number of args"); - } - } -} diff --git a/Core/RLV/Chat/recvchat_sec.cs b/Core/RLV/Chat/recvchat_sec.cs deleted file mode 100644 index 95a9f09..0000000 --- a/Core/RLV/Chat/recvchat_sec.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace BetterSecondBot.RLV.Chat -{ - public class RecvChat_Sec : RLV_UUID_flag_yn - { - } -} diff --git a/Core/RLV/Chat/recvchatfrom.cs b/Core/RLV/Chat/recvchatfrom.cs deleted file mode 100644 index da1908f..0000000 --- a/Core/RLV/Chat/recvchatfrom.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace BetterSecondBot.RLV.Chat -{ - public class RecvChatFrom : RLV_UUID_flag_arg_yn - { - } -} diff --git a/Core/RLV/Chat/redirchat.cs b/Core/RLV/Chat/redirchat.cs deleted file mode 100644 index 59e79d0..0000000 --- a/Core/RLV/Chat/redirchat.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace BetterSecondBot.RLV.Chat -{ - public class RedirChat : RLV_UUID_flag_arg_yn - { - } -} diff --git a/Core/RLV/Chat/sendchat.cs b/Core/RLV/Chat/sendchat.cs deleted file mode 100644 index 1dfed9a..0000000 --- a/Core/RLV/Chat/sendchat.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace BetterSecondBot.RLV.Chat -{ - public class SendChat : RLV_UUID_flag_yn - { - } -} diff --git a/Core/RLV/Chat/sendgesture.cs b/Core/RLV/Chat/sendgesture.cs deleted file mode 100644 index b913717..0000000 --- a/Core/RLV/Chat/sendgesture.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace BetterSecondBot.RLV.Chat -{ - public class SendGesture : RLV_UUID_flag_yn - { - } -} diff --git a/Core/RLV/Emotes/emote.cs b/Core/RLV/Emotes/emote.cs deleted file mode 100644 index 5cea1a0..0000000 --- a/Core/RLV/Emotes/emote.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace BetterSecondBot.RLV.Emotes -{ - public class Emote : RLV_UUID_flag_yn - { - } -} diff --git a/Core/RLV/Emotes/recvemote.cs b/Core/RLV/Emotes/recvemote.cs deleted file mode 100644 index 9cf4f61..0000000 --- a/Core/RLV/Emotes/recvemote.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using OpenMetaverse; - -namespace BetterSecondBot.RLV.Emotes -{ - public class RecvEmote : RLV_UUID_flag_optional_arg_yn - { - public override bool AsExceptionRule { get { return true; } } - public override bool CallFunction(string[] args) - { - if (args.Length == 1) - { - if (args[0] == "y") - { - bot.SetLock("recvemote_lock", false); - return true; - } - else if (args[0] == "n") - { - bot.SetLock("recvemote_lock", true); - return true; - } - return Failed("y/n only"); - } - else if (args.Length == 2) - { - if (UUID.TryParse(args[0], out UUID rec_uuid) == true) - { - return SetFlag(args[1], "set", rec_uuid); - } - return Failed("Unable to process target UUID"); - } - return Failed("Unsupported number of args"); - } - } -} diff --git a/Core/RLV/Emotes/recvemote_sec.cs b/Core/RLV/Emotes/recvemote_sec.cs deleted file mode 100644 index d3adec6..0000000 --- a/Core/RLV/Emotes/recvemote_sec.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace BetterSecondBot.RLV.Emotes -{ - public class RecvEmote_Sec : RLV_UUID_flag_yn - { - public override string SetFlagName { get { return "recvemote"; } } - } -} diff --git a/Core/RLV/Emotes/rediremote.cs b/Core/RLV/Emotes/rediremote.cs deleted file mode 100644 index 7050c13..0000000 --- a/Core/RLV/Emotes/rediremote.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace BetterSecondBot.RLV.Emotes -{ - public class RedirEmote : RLV_UUID_flag_arg_yn - { - public override string SetFlagName { get { return CommandName; } } - } -} diff --git a/Core/RLV/InstantMessages/sendim.cs b/Core/RLV/InstantMessages/sendim.cs deleted file mode 100644 index 12306b9..0000000 --- a/Core/RLV/InstantMessages/sendim.cs +++ /dev/null @@ -1,37 +0,0 @@ -using OpenMetaverse; -using System; -using System.Collections.Generic; -using System.Text; - -namespace BetterSecondBot.RLV.InstantMessages -{ - public class SendIm : RLV_command_1arg - { - public override bool CallFunction(string[] args) - { - if (args.Length == 1) - { - if (args[0] == "y") - { - bot.SetLock("sendim_lock", false); - return true; - } - else if (args[0] == "n") - { - bot.SetLock("sendim_lock", true); - return true; - } - return Failed("y/n only"); - } - else if (args.Length == 2) - { - if (UUID.TryParse(args[0], out UUID rec_uuid) == true) - { - return SetFlag(args[1], "set", rec_uuid); - } - return Failed("Unable to process target UUID"); - } - return Failed("Unsupported number of args"); - } - } -} diff --git a/Core/RLV/InstantMessages/sendim_sec.cs b/Core/RLV/InstantMessages/sendim_sec.cs deleted file mode 100644 index 0285f89..0000000 --- a/Core/RLV/InstantMessages/sendim_sec.cs +++ /dev/null @@ -1,18 +0,0 @@ -using OpenMetaverse; -using System; -using System.Collections.Generic; -using System.Text; - -namespace BetterSecondBot.RLV.InstantMessages -{ - public class SendIm_Sec : RLV_command_1arg - { - public override bool CallFunction(string[] args) - { - if (args[0] == "y") { bot.SetLock("sendim_lock", false); } - else if (args[0] == "n") { bot.SetLock("sendim_lock", true); } - else { return Failed("y/n only"); } - return true; - } - } -} \ No newline at end of file diff --git a/Core/RLV/Miscellaneous/clear.cs b/Core/RLV/Miscellaneous/clear.cs deleted file mode 100644 index 0d6a02d..0000000 --- a/Core/RLV/Miscellaneous/clear.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using OpenMetaverse; - -namespace BetterSecondBot.RLV.Miscellaneous -{ - public class Clear : RLV_command - { - public override bool CallFunction(string[] args) - { - bot.Clearrule(false, caller_uuid); - bot.Clearrule(true, caller_uuid); - return true; - } - } -} diff --git a/Core/RLV/Miscellaneous/getstatus.cs b/Core/RLV/Miscellaneous/getstatus.cs deleted file mode 100644 index fa11842..0000000 --- a/Core/RLV/Miscellaneous/getstatus.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using OpenMetaverse; - -namespace BetterSecondBot.RLV.Miscellaneous -{ - public class GetStatus : RLV_command_1arg - { - public override bool CallFunction(string[] args) - { - string part = "#"; - string split = "/"; - int channel = -1; - if (args.Length == 1) - { - _ = int.TryParse(args[0], out channel); - } - else if (args.Length == 2) - { - part = args[0]; - _ = int.TryParse(args[1], out channel); - } - else if (args.Length == 3) - { - part = args[0]; - split = args[1]; - _ = int.TryParse(args[2], out channel); - } - if (channel > -1) - { - string reply = ""; - string addon = ""; - if (bot.Getuuid_rules.ContainsKey(caller_uuid) == true) - { - foreach (string rule in bot.Getuuid_rules[caller_uuid].Keys) - { - if ((part == "#") || (rule.Contains(part) == true)) - { - reply = "" + reply + "" + addon + "" + rule + ""; - addon = split; - } - } - } - bot.GetClient.Self.Chat(reply, channel, ChatType.Normal); - return true; - } - return Failed("Invaild channel given"); - } - } -} diff --git a/Core/RLV/Miscellaneous/getstatusall.cs b/Core/RLV/Miscellaneous/getstatusall.cs deleted file mode 100644 index 2a8c5f7..0000000 --- a/Core/RLV/Miscellaneous/getstatusall.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using OpenMetaverse; - -namespace BetterSecondBot.RLV.Miscellaneous -{ - public class GetStatusAll : RLV_command_1arg - { - public override bool CallFunction(string[] args) - { - if (base.CallFunction(args) == true) - { - string part = "#"; - string split = "/"; - int channel = -1; - if (args.Length == 1) - { - int.TryParse(args[0], out channel); - } - else if (args.Length == 2) - { - part = args[0]; - int.TryParse(args[1], out channel); - } - else if (args.Length == 3) - { - part = args[0]; - split = args[1]; - int.TryParse(args[2], out channel); - } - if (channel > -1) - { - string reply = ""; - string addon = ""; - foreach (UUID a in bot.Getuuid_rules.Keys) - { - foreach (string rule in bot.Getuuid_rules[a].Keys) - { - if ((part == "#") || (rule.Contains(part) == true)) - { - reply = "" + reply + "" + addon + "" + rule + ""; - addon = split; - } - } - } - bot.GetClient.Self.Chat(reply, channel, ChatType.Normal); - return true; - } - else - { - Failed("Invaild channel given"); - } - } - return false; - } - } -} diff --git a/Core/RLV/Miscellaneous/notify.cs b/Core/RLV/Miscellaneous/notify.cs deleted file mode 100644 index e576035..0000000 --- a/Core/RLV/Miscellaneous/notify.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace BetterSecondBot.RLV.Miscellaneous -{ - public class Notify : RLV_command_2arg - { - public override bool CallFunction(string[] args) - { - _ = int.TryParse(args[0], out int channel); - if (channel >= 0) - { - string word = "#"; - string action; - if (args.Length == 3) - { - word = args[1]; - action = args[2]; - } - else - { - action = args[1]; - } - if ((action == "add") || (action == "n")) - { - bot.NotifyUpdate(true, word, channel); - return true; - } - else if ((action == "rem") || (action == "y")) - { - bot.NotifyUpdate(false, word, channel); - return true; - } - else - { - return Failed("unknown action add/rem only! Action:" + action + " Channel:" + channel.ToString() + " Word: " + word + ""); - } - } - return Failed("Invaild channel given"); - } - } -} diff --git a/Core/RLV/Miscellaneous/permissive.cs b/Core/RLV/Miscellaneous/permissive.cs deleted file mode 100644 index f139ecc..0000000 --- a/Core/RLV/Miscellaneous/permissive.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using OpenMetaverse; - -namespace BetterSecondBot.RLV.Miscellaneous -{ - public class Permissive : RLV_command_1arg - { - public override bool CallFunction(string[] args) - { - string action = args[0]; - if ((action == "y") || (action == "n")) - { - if (action == "n") - { - bot.SetPermissiveMode(caller_uuid, true); - } - else if (action == "y") - { - bot.SetPermissiveMode(caller_uuid, false); - } - return true; - } - return Failed("Permissive requires y/n!"); - } - } -} diff --git a/Core/RLV/Movement/adjustheight.cs b/Core/RLV/Movement/adjustheight.cs deleted file mode 100644 index d85a251..0000000 --- a/Core/RLV/Movement/adjustheight.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace BetterSecondBot.RLV.Movement -{ - public class AdjustHeight : RLV_command_3arg - { - public override bool CallFunction(string[] args) - { - int distance_pelvis_to_foot_in_meters = 0; - double factor = 0; - double offset = 0; - if (args[^1] == "force") - { - if(args.Length == 3) - { - int.TryParse(args[0], out distance_pelvis_to_foot_in_meters); - double.TryParse(args[1], out factor); - } - else if (args.Length == 4) - { - int.TryParse(args[0], out distance_pelvis_to_foot_in_meters); - double.TryParse(args[1], out factor); - double.TryParse(args[2], out offset); - } - Double hh = distance_pelvis_to_foot_in_meters * factor; - hh += offset; - if (hh > 2.0) - { - hh = 2.0; - } - else if (hh < -2.0) - { - hh = -2.0; - } - bot.GetClient.Self.SetHoverHeight(hh); - return true; - } - return Failed("Required magic word force missing"); - } - - } -} diff --git a/Core/RLV/Movement/alwaysrun.cs b/Core/RLV/Movement/alwaysrun.cs deleted file mode 100644 index 46394dd..0000000 --- a/Core/RLV/Movement/alwaysrun.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace BetterSecondBot.RLV.Movement -{ - public class AlwaysRun : RLV_UUID_flag_yn - { - } -} diff --git a/Core/RLV/Movement/fly.cs b/Core/RLV/Movement/fly.cs deleted file mode 100644 index 92cfbe4..0000000 --- a/Core/RLV/Movement/fly.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace BetterSecondBot.RLV.Movement -{ - public class Fly : RLV_UUID_flag_yn - { - } -} diff --git a/Core/RLV/Movement/setrot.cs b/Core/RLV/Movement/setrot.cs deleted file mode 100644 index c1eacda..0000000 --- a/Core/RLV/Movement/setrot.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using OpenMetaverse; - -namespace BetterSecondBot.RLV.Movement -{ - public class SetRot : RLV_command_2arg - { - public override bool CallFunction(string[] args) - { - if (base.CallFunction(args) == true) - { - if (args[1] == "force") - { - return bot.GetCommandsInterface.Call("rotateto", args[0], UUID.Zero); - } - return Failed("magic word force is required [dont ask me]"); - } - return false; - } - } -} diff --git a/Core/RLV/Movement/temprun.cs b/Core/RLV/Movement/temprun.cs deleted file mode 100644 index 57b895b..0000000 --- a/Core/RLV/Movement/temprun.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace BetterSecondBot.RLV.Movement -{ - public class TempRun : RLV_UUID_flag_yn - { - - } -} diff --git a/Core/RLV/PrivateChannels/sendchannel.cs b/Core/RLV/PrivateChannels/sendchannel.cs deleted file mode 100644 index c9209f5..0000000 --- a/Core/RLV/PrivateChannels/sendchannel.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace BetterSecondBot.RLV.PrivateChannels -{ - public class SendChannel : RLV_UUID_flag_arg_yn - { - } -} diff --git a/Core/RLV/PrivateChannels/sendchannel_except.cs b/Core/RLV/PrivateChannels/sendchannel_except.cs deleted file mode 100644 index 005906c..0000000 --- a/Core/RLV/PrivateChannels/sendchannel_except.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace BetterSecondBot.RLV.PrivateChannels -{ - public class SendChannel_Except : RLV_UUID_flag_arg_yn - { - public override string SetFlagName { get { return "sendchannel"; } } - } -} diff --git a/Core/RLV/PrivateChannels/sendchannel_sec.cs b/Core/RLV/PrivateChannels/sendchannel_sec.cs deleted file mode 100644 index fe07add..0000000 --- a/Core/RLV/PrivateChannels/sendchannel_sec.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace BetterSecondBot.RLV.PrivateChannels -{ - public class SendChannel_Sec : RLV_UUID_flag_arg_yn - { - public override string SetFlagName { get { return "sendchannel"; } } - } -} diff --git a/Core/RLV/RLV_commandlib.cs b/Core/RLV/RLV_commandlib.cs deleted file mode 100644 index 5500654..0000000 --- a/Core/RLV/RLV_commandlib.cs +++ /dev/null @@ -1,230 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Linq; -using OpenMetaverse; -using BetterSecondBot.bottypes; -using BetterSecondBotShared.API; -using BetterSecondBotShared.logs; - -namespace BetterSecondBot.RLV -{ - public class RLVcontrol : API_supported_interface - { - protected RLVbot bot; - protected UUID last_caller_uuid = UUID.Zero; - protected string last_caller_name = ""; - - public void SetCallerDetails(UUID callerUUID, string callerName) - { - last_caller_name = callerName; - last_caller_uuid = callerUUID; - } - - public RLVcontrol(RLVbot linktobot) - { - bot = linktobot; - API_type = typeof(RLV_command); - LoadCommandsList(); - } - - protected List suppress_warning = new List(); - public bool Call(string command, string[] args) - { - command = command.ToLowerInvariant(); - RLV_command cmd = (RLV_command)GetCommand(command); - if (cmd != null) - { - if (args.Length >= cmd.Min_Required_args) - { - cmd.Setup(bot, last_caller_uuid, last_caller_name); - return cmd.CallFunction(args); - } - else - { - LogFormater.Warn("[RLVapi/Failed] " + command + ": Incorrect number of args"); - } - } - else - { - if(suppress_warning.Contains(command) == false) - { - suppress_warning.Add(command); - LogFormater.Warn("[RLVapi/Failed] " + command + ": I have no fucking idea what you are talking about"); - } - } - return false; - } - } - public abstract class RLV_command_1arg : RLV_command - { - public override int Min_Required_args { get { return 1; } } - } - public abstract class RLV_command_2arg : RLV_command - { - public override int Min_Required_args { get { return 2; } } - } - public abstract class RLV_command_3arg : RLV_command - { - public override int Min_Required_args { get { return 3; } } - } - public abstract class RLV_command_4arg : RLV_command - { - public override int Min_Required_args { get { return 4; } } - } - public abstract class RLV_command : API_interface - { - public override string Helpfile { get { return "[Class helpfile] an RLV_command."; } } - public virtual string SetFlagName { get { return CommandName.ToLowerInvariant(); } } - protected RLVbot bot; - protected UUID caller_uuid = UUID.Zero; - protected string caller_name = ""; - - public virtual bool AsExceptionRule { get { return false; } } - - - public void Setup(RLVbot setBot, UUID callerUUID, string callerName) - { - bot = setBot; - caller_name = callerName; - caller_uuid = callerUUID; - } - - public virtual bool CallFunction(string[] args) - { - return Failed("Function not overridden"); - } - - public bool Failed(string why_failed) - { - LogFormater.Warn("[RLVapi/Failed] " + CommandName + ": " + why_failed); - return false; - } - - protected bool SetFlag(string signal,string arg) - { - return SetFlag(signal, arg, caller_uuid); - } - protected bool SetFlag(string signal, string arg,UUID caller) - { - if ((signal == "y") || (signal == "rem")) - { - return bot.RemoveRule(AsExceptionRule, SetFlagName, caller); - } - else if ((signal == "n") || (signal == "add")) - { - return bot.UpdateRule(AsExceptionRule, SetFlagName, arg, caller); - } - return Failed("[RLV/Debug] arg only accepts y/n or add/rem for control signaling [Sig: " + signal+" Arg: "+arg+"]"); - } - } - public abstract class RLV_1arg_force : RLV_command_1arg - { - public override string Helpfile { get { return "[Class helpfile] Requires you send =force at the end of the command..."; } } - public override string[] ArgTypes { get { return new[] { "TEXT" }; } } - public override string[] ArgHints { get { return new[] { "The word force"}; } } - - public override bool CallFunction(string[] args) - { - if (args.Length > 0) - { - if (args[0] == "force") - { - return true; - } - return Failed("Magic word force is missing"); - } - return Failed("[RLV/WARN] RLV_1arg_force invaild number of args"); - } - } - - - public abstract class RLV_UUID_flag_4arg_yn : RLV_UUID_flag_optional_arg_yn - { - public override int Min_Required_args { get { return 4; } } - public override string Helpfile { get { return "[Class helpfile] RLV / 4arg"; } } - public override string[] ArgTypes { get { return new[] { "Unknown", "Unknown", "Unknown", "Unknown" }; } } - public override string[] ArgHints { get { return new[] { "Unknown", "Unknown", "Unknown", "Unknown" }; } } - } - - public abstract class RLV_UUID_flag_optional_arg_yn : RLV_command_1arg - { - public override string Helpfile { get { return "[Class helpfile] RLV / UUID_flag_optional_arg_yn"; } } - public override string[] ArgTypes { get { return new[] { "Unknown", "Unknown"}; } } - public override string[] ArgHints { get { return new[] { "Unknown", "Unknown" }; } } - - public override bool CallFunction(string[] args) - { - if (args.Length == 2) - { - return SetFlag(args[^1], args[0]); - } - else if (args.Length > 0) - { - return SetFlag(args[^1], "set"); - } - return Failed("[RLV/WARN] RLV_UUID_flag_optional_arg_yn invaild number of args"); - } - } - - public abstract class RLV_UUID_flag_yn : RLV_command_1arg - { - public override string Helpfile { get { return "[Class helpfile] RLV / UUID_flag_yn "; } } - public override string[] ArgTypes { get { return new[] { "Unknown", "Unknown" }; } } - public override string[] ArgHints { get { return new[] { "Unknown", "Unknown" }; } } - public override bool CallFunction(string[] args) - { - if (args.Length >= 1) - { - return SetFlag(args[0], "set"); - } - return Failed("[RLV/WARN] RLV_UUID_flag_yn invaild number of args"); - } - } - public abstract class RLV_UUID_flag_get : RLV_command_1arg - { - public abstract string LookupFlag { get; } - public override string Helpfile { get { return "[Class helpfile]
Gets the flag value "+LookupFlag+" and returns it on channel [ARG 1]"; } } - public override string[] ArgTypes { get { return new[] { "Number"}; } } - public override string[] ArgHints { get { return new[] { "Channel" }; } } - public override bool CallFunction(string[] args) - { - if (args.Length == 1) - { - _ = int.TryParse(args[0], out int channel); - if (channel >= 0) - { - if (bot.Getuuid_rules.ContainsKey(caller_uuid) == true) - { - if (bot.Getuuid_rules[caller_uuid].ContainsKey(LookupFlag) == true) - { - bot.GetClient.Self.Chat(bot.Getuuid_rules[caller_uuid][LookupFlag], channel, ChatType.Normal); - } - } - return true; - } - else - { - return Failed("Channel number not vaild"); - } - } - return Failed("[RLV/WARN] RLV_UUID_flag_get invaild number of args"); - } - } - public abstract class RLV_UUID_flag_arg_yn : RLV_command_2arg - { - public override string Helpfile { get { return "[Class helpfile]
RLV / UUID_flag_arg_yn
When clearing please set [ARG 1] to Anything
Flags are tracked per object"; } } - public override string[] ArgTypes { get { return new[] { "Mixed", "Flag" }; } } - public override string[] ArgHints { get { return new[] { "The arg value you are setting", "[Y/N] or [Rem/Add]" }; } } - public override bool CallFunction(string[] args) - { - if (args.Length == 2) - { - return SetFlag(args[1], args[0]); - } - return Failed("[RLV/WARN] RLV_UUID_flag_arg_yn invaild number of args"); - } - } - - -} diff --git a/Core/RLV/Sitting/getsitid.cs b/Core/RLV/Sitting/getsitid.cs deleted file mode 100644 index 0a21e11..0000000 --- a/Core/RLV/Sitting/getsitid.cs +++ /dev/null @@ -1,31 +0,0 @@ -using OpenMetaverse; -using System; -using System.Collections.Generic; -using System.Text; - -namespace BetterSecondBot.RLV.Sitting -{ - class GetSitId : RLV_command_1arg - { - public override bool CallFunction(string[] args) - { - _ = int.TryParse(args[0], out int channel); - if (channel > -1) - { - if(bot.GetClient.Self.SittingOn > 0) - { - if(bot.GetClient.Network.CurrentSim.ObjectsPrimitives.ContainsKey(bot.GetClient.Self.SittingOn)) - { - Primitive obj = bot.GetClient.Network.CurrentSim.ObjectsPrimitives[bot.GetClient.Self.SittingOn]; - - bot.GetClient.Self.Chat(obj.ID.ToString(), channel, OpenMetaverse.ChatType.Normal); - return true; - } - } - bot.GetClient.Self.Chat(UUID.Zero.ToString(), channel, OpenMetaverse.ChatType.Normal); - return true; - } - return Failed("Invaild channel given"); - } - } -} diff --git a/Core/RLV/Sitting/sit.cs b/Core/RLV/Sitting/sit.cs deleted file mode 100644 index 40e910c..0000000 --- a/Core/RLV/Sitting/sit.cs +++ /dev/null @@ -1,30 +0,0 @@ -using OpenMetaverse; -using System; -using System.Collections.Generic; -using System.Text; - -namespace BetterSecondBot.RLV.Sitting -{ - public class Sit : RLV_command_1arg - { - public override bool CallFunction(string[] args) - { - if (args.Length == 1) - { - return SetFlag(args[0], "set"); - } - else if (args.Length == 2) - { - if (args[1] == "force") - { - return bot.GetCommandsInterface.Call("BotSit", args[0], UUID.Zero); - } - else - { - return Failed("Magic keyword force missing."); - } - } - return Failed("Badly formatted command."); - } - } -} diff --git a/Core/RLV/Sitting/unsit.cs b/Core/RLV/Sitting/unsit.cs deleted file mode 100644 index 00f2b53..0000000 --- a/Core/RLV/Sitting/unsit.cs +++ /dev/null @@ -1,23 +0,0 @@ -using OpenMetaverse; -using System; -using System.Collections.Generic; -using System.Text; - -namespace BetterSecondBot.RLV.Sitting -{ - public class UnSit : RLV_command_1arg - { - public override bool CallFunction(string[] args) - { - if (args[0] == "force") - { - return bot.GetCommandsInterface.Call("stand", "", UUID.Zero); - } - else if ((args[0] == "y") || (args[0] == "n")) - { - return SetFlag(args[0], "set"); - } - return Failed("Magic keyword force missing."); - } - } -} diff --git a/Core/RLV/Version/version.cs b/Core/RLV/Version/version.cs deleted file mode 100644 index 4056068..0000000 --- a/Core/RLV/Version/version.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace BetterSecondBot.RLV.Version -{ - public class Version : RLV_command - { - public override bool CallFunction(string[] args) - { - int channel = 0; - if (args.Length == 1) - { - _ = int.TryParse(args[0], out channel); - } - if (channel >= 0) - { - bot.GetClient.Self.Chat("RestrainedLife BOT (RLVa 2.9)", channel, OpenMetaverse.ChatType.Normal); - return true; - } - else - { - return Failed("Invaild channel given"); - } - } - } -} diff --git a/Core/RLV/Version/versionnew.cs b/Core/RLV/Version/versionnew.cs deleted file mode 100644 index db3e55c..0000000 --- a/Core/RLV/Version/versionnew.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace BetterSecondBot.RLV.Version -{ - public class VersionNew : RLV_command - { - public override bool CallFunction(string[] args) - { - int channel = 0; - if (args.Length == 1) - { - _ = int.TryParse(args[0], out channel); - } - if (channel >= 0) - { - bot.GetClient.Self.Chat("RestrainedLove BOT (RLVa 2.9)", channel, OpenMetaverse.ChatType.Normal); - return true; - } - else - { - return Failed("Invaild channel given"); - } - } - } -} diff --git a/Core/RLV/Version/versionnum.cs b/Core/RLV/Version/versionnum.cs deleted file mode 100644 index 0e36223..0000000 --- a/Core/RLV/Version/versionnum.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace BetterSecondBot.RLV.Version -{ - public class VersionNum : RLV_command - { - public override bool CallFunction(string[] args) - { - int channel = 0; - if (args.Length == 1) - { - _ = int.TryParse(args[0], out channel); - } - if (channel >= 0) - { - bot.GetClient.Self.Chat("209000", channel, OpenMetaverse.ChatType.Normal); - return true; - } - else - { - return Failed("Invaild channel given"); - } - } - } -} diff --git a/Core/bottypes/AVstorageBot.cs b/Core/bottypes/AVstorageBot.cs index b3aadab..babef89 100644 --- a/Core/bottypes/AVstorageBot.cs +++ b/Core/bottypes/AVstorageBot.cs @@ -287,38 +287,6 @@ namespace BetterSecondBot.bottypes } } - protected string httpLookupKey(string avatar_name) - { - if (myconfig.Name2Key_Enable == true) - { - var client = new RestClient(myconfig.Name2Key_Url); - var request = new RestRequest("name2key/" + avatar_name + "/" + myconfig.Name2Key_Key + "", Method.GET); - client.Timeout = 3000; // ? does this even do anything - request.Timeout = 3000; - IRestResponse endpoint_checks = client.Get(request); - if (endpoint_checks.StatusCode == System.Net.HttpStatusCode.OK) - { - try - { - namekeyservicereply server_reply = JsonConvert.DeserializeObject(endpoint_checks.Content); - if (server_reply.status == true) - { - if (server_reply.found == true) - { - AddAvatarToDB((UUID)server_reply.uuid, server_reply.name); - return server_reply.uuid; - } - } - } - catch - { - - } - } - } - return ""; - } - protected string FindAvatarUUIDInStorage(string avatar_name) { if (AvatarStorageLastUsed.ContainsKey(avatar_name) == true) @@ -355,11 +323,6 @@ namespace BetterSecondBot.bottypes { return uuid; } - uuid = httpLookupKey(avatar_name); - if (uuid != "") - { - return uuid; - } if (PendingAvatarFinds_vianame.ContainsKey(avatar_name) == false) { PendingAvatarFinds_vianame.Add(avatar_name, new KeyValuePair(helpers.UnixTimeNow(), 0)); @@ -383,38 +346,6 @@ namespace BetterSecondBot.bottypes return ""; } - protected string httpLookupName(UUID avatar_uuid) - { - if (myconfig.Name2Key_Enable == true) - { - var client = new RestClient(myconfig.Name2Key_Url); - var request = new RestRequest("key2name/" + avatar_uuid.ToString() + "/" + myconfig.Name2Key_Key + "", Method.GET); - client.Timeout = 3000; // ? does this even do anything - request.Timeout = 3000; - IRestResponse endpoint_checks = client.Get(request); - if (endpoint_checks.StatusCode == System.Net.HttpStatusCode.OK) - { - try - { - namekeyservicereply server_reply = JsonConvert.DeserializeObject(endpoint_checks.Content); - if (server_reply.status == true) - { - if (server_reply.found == true) - { - AddAvatarToDB((UUID)server_reply.uuid, server_reply.name); - return server_reply.name; - } - } - } - catch - { - - } - } - } - return ""; - } - public string FindAvatarKey2Name(UUID avatar_uuid) { @@ -423,11 +354,6 @@ namespace BetterSecondBot.bottypes { return avatar_name; } - avatar_name = httpLookupName(avatar_uuid); - if (avatar_name != "") - { - return avatar_name; - } if (PendingAvatarFinds_viauuid.ContainsKey(avatar_uuid) == false) { PendingAvatarFinds_viauuid.Add(avatar_uuid, new KeyValuePair(helpers.UnixTimeNow(), 0)); @@ -442,16 +368,6 @@ namespace BetterSecondBot.bottypes } } - public class namekeyservicereply - { - public string lookingfor { get; set; } - public string uuid { get; set; } - public string name { get; set; } - public bool found { get; set; } - public bool status { get; set; } - public string message { get; set; } - } - public class friendreplyobject { public string name; diff --git a/Core/bottypes/RLVbot.cs b/Core/bottypes/RLVbot.cs deleted file mode 100644 index 9b200a7..0000000 --- a/Core/bottypes/RLVbot.cs +++ /dev/null @@ -1,298 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using BetterSecondBotShared.Json; -using OpenMetaverse; -using BetterSecondBotShared.logs; - -namespace BetterSecondBot.bottypes -{ - public abstract class RLVbot : RLVbotHelper - { - // normal bot stuff - protected RLV.RLVcontrol RLVinterface; - public RLV.RLVcontrol GetRLVinterface { get { return RLVinterface; } } - - public override void Setup(JsonConfig config, string Version) - { - base.Setup(config, Version); - if (reconnect == false) - { - if (myconfig.Setting_AllowRLV == true) - { - Info("RLV: Enabled"); - RLVinterface = new RLV.RLVcontrol(this); - } - } - } - - protected override void ChatInputHandler(object sender, ChatEventArgs e) - { - base.ChatInputHandler(sender, e); - if (e.Type == ChatType.OwnerSay) - { - if (myconfig.Setting_AllowRLV == true) - { - if (e.Message.StartsWith("@") == true) - { - string message_text = e.Message.Substring(1); - bool permissive_allow = true; - if (permissive_allow == true) - { - string[] requested_commands = message_text.Split(','); - foreach (string R in requested_commands) - { - List args = new List(); - string command = ""; - string[] build = R.Split('='); - string[] build2 = build[0].Split(':'); - if (build2.Length == 2) - { - string[] build3 = build2[1].Split(';'); - foreach (string build_arg in build3) - { - args.Add(build_arg); - } - } - command = build2[0]; - if (build.Length == 2) - { - args.Add(build[1]); - } - if (blacklist_recvim.Contains(command) == false) - { - if (Notify.ContainsKey("#") == true) - { - foreach (int channel in Notify["#"]) - { - Client.Self.Chat("/" + message_text, channel, ChatType.Normal); - } - } - if (Notify.ContainsKey(command) == true) - { - foreach (int channel in Notify[command]) - { - Client.Self.Chat("/" + message_text, channel, ChatType.Normal); - } - } - RLVinterface.SetCallerDetails(e.SourceID, e.FromName); - RLVinterface.Call(command, args.ToArray()); - } - else - { - Debug("RLV API -> blacklisted [" + command + "]"); - } - } - } - } - } - } - } - } - - - public class RLVbotHelper : AwaitReplyEventBot - { - #region PermissiveMode - // permissive - protected bool permissive_mode = true; - protected UUID permissive_mode_set_by = UUID.Zero; - public UUID Getpermissive_mode_set_by { get { return permissive_mode_set_by; } } - - public void SetPermissiveMode(UUID caller) - { - SetPermissiveMode(caller, false); - } - public void SetPermissiveMode(UUID caller, bool status) - { - bool allow = true; - if((permissive_mode == false) && (caller != permissive_mode_set_by)) - { - allow = false; - } - if(allow == true) - { - permissive_mode = status; - if (status == false) - { - permissive_mode_set_by = UUID.Zero; - } - else - { - permissive_mode_set_by = caller; - } - } - } - #endregion - - #region blacklist - // Blacklist - protected List blacklist_sendim = new List(); - protected List blacklist_recvim = new List(); - public List Getblacklist_sendim { get { return blacklist_sendim; } } - public List Getblacklist_recvim { get { return blacklist_recvim; } } - #endregion - - #region UUID rules Exceptions - // UUID based rules / Exceptions - protected Dictionary> uuid_rules = new Dictionary>(); - protected Dictionary> uuid_exceptions = new Dictionary>(); - public Dictionary> Getuuid_rules { get { return uuid_rules; } } - public Dictionary> Getuuid_exceptions { get { return uuid_exceptions; } } - public bool Clearrule(bool as_exception, UUID soruce) - { - return RemoveRule(as_exception, null, soruce); - } - public bool UpdateRule(bool as_exception, string rule, string arg, UUID source) - { - if (as_exception == false) - { - lock (uuid_rules) - { - if (uuid_rules.ContainsKey(source) == false) - { - uuid_rules.Add(source, new Dictionary()); - } - if (uuid_rules[source].ContainsKey(rule) == true) - { - uuid_rules[source].Remove(rule); - } - uuid_rules[source].Add(rule, arg); - } - } - else - { - lock (uuid_exceptions) - { - if (uuid_exceptions.ContainsKey(source) == false) - { - uuid_exceptions.Add(source, new Dictionary()); - } - if (uuid_exceptions[source].ContainsKey(rule) == true) - { - uuid_exceptions[source].Remove(rule); - } - uuid_exceptions[source].Add(rule, arg); - } - } - return true; - } - public bool RemoveRule(bool as_exception, string rule, UUID source) - { - if (as_exception == false) - { - lock (uuid_rules) - { - if (uuid_rules.ContainsKey(source) == true) - { - if (rule != null) - { - if (uuid_rules[source].ContainsKey(rule) == true) - { - uuid_rules[source].Remove(rule); - } - if (uuid_rules[source].Count == 0) - { - uuid_rules.Remove(source); - } - } - else - { - uuid_rules.Remove(source); - } - } - } - } - else - { - lock (uuid_exceptions) - { - if (rule != null) - { - if (uuid_exceptions[source].ContainsKey(rule) == true) - { - uuid_exceptions[source].Remove(rule); - } - if (uuid_exceptions[source].Count == 0) - { - uuid_exceptions.Remove(source); - } - } - else - { - uuid_exceptions.Remove(source); - } - } - } - return true; - } - #endregion - - #region Flags - // Flags - protected bool recvchat_channel_zero_lock = true; - protected bool sendchannel_lock; - protected bool recvemote_lock; - protected bool sendim_lock; - public void SetLock(string name, bool status) - { - if (name == "sendim_lock") { sendim_lock = status; } - else if (name == "recvemote_lock") { recvemote_lock = status; } - else if (name == "sendchannel_lock") { sendchannel_lock = status; } - else if (name == "recvchat_channel_zero_lock") { recvchat_channel_zero_lock = status; } - } - #endregion - - #region Notify - // Notify - protected Dictionary> Notify = new Dictionary>(); - public Dictionary> Getnotify { get { return Notify; } } - - public void NotifyUpdate(bool Add, string word) - { - NotifyUpdate(Add, word, -1); - } - - public void NotifyUpdate(bool Add, string word,int channel) - { - lock (Notify) - { - if (Add == true) - { - if (Notify.ContainsKey(word) == false) - { - Notify.Add(word, new List()); - } - if (channel > -1) - { - if (Notify[word].Contains(channel) == false) - { - Notify[word].Add(channel); - } - } - } - else - { - if (Notify.ContainsKey(word) == true) - { - if (Notify[word].Contains(channel) == true) - { - Notify[word].Remove(channel); - if(Notify[word].Count == 0) - { - Notify.Remove(word); - } - } - if (channel == -1) - { - Notify.Remove(word); - } - - } - } - } - } - #endregion - - } -} diff --git a/Core/bottypes/chatrelay.cs b/Core/bottypes/chatrelay.cs index af7fd4a..3a3063b 100644 --- a/Core/bottypes/chatrelay.cs +++ b/Core/bottypes/chatrelay.cs @@ -6,7 +6,7 @@ using System.Linq; namespace BetterSecondBot.bottypes { - public abstract class ChatRelay : RLVbot + public abstract class ChatRelay : AwaitReplyEventBot { #region GroupIMs protected int localchatlimit = 20; diff --git a/Core/bottypes/loadorder.txt b/Core/bottypes/loadorder.txt index e820b70..4749b11 100644 --- a/Core/bottypes/loadorder.txt +++ b/Core/bottypes/loadorder.txt @@ -1,4 +1,3 @@ -SecondBot -> DialogsBot -> ChatRelay -> RLVbot -> RLVbotHelper -> -AwaitReplyEventBot -> CommandsBot -> AVstorageBot -> AttachableBot -> +SecondBot -> DialogsBot -> ChatRelay -> AwaitReplyEventBot -> CommandsBot -> AVstorageBot -> AttachableBot -> MessageSwitcherBot -> EventsBot -> VoidEventBot -> AnimationsBot -> VirtualsBot -> Log2FileBot -> ActionsAutoAcceptBot -> BasicBot \ No newline at end of file