Replace Newtonsoft.Json with System.Text.Json
Migrated all serialization and deserialization from Newtonsoft.Json to System.Text.Json across the codebase for improved performance and reduced dependencies. Updated package references and refactored helper method names for consistency (e.g., IsEmpty, NotEmpty, InRange). Also updated NuGet package versions in project files.
This commit is contained in:
parent
93dbde2818
commit
050ef3c133
32 changed files with 191 additions and 205 deletions
|
|
@ -29,12 +29,12 @@
|
||||||
<PackageReference Include="CoreJ2K.Skia" Version="1.1.2.50" />
|
<PackageReference Include="CoreJ2K.Skia" Version="1.1.2.50" />
|
||||||
<PackageReference Include="log4net" Version="3.2.0" />
|
<PackageReference Include="log4net" Version="3.2.0" />
|
||||||
<PackageReference Include="MessagePack" Version="3.1.4" />
|
<PackageReference Include="MessagePack" Version="3.1.4" />
|
||||||
<PackageReference Include="Microsoft.Extensions.ObjectPool" Version="9.0.8" />
|
<PackageReference Include="Microsoft.Extensions.ObjectPool" Version="9.0.9" />
|
||||||
<PackageReference Include="OggVorbisEncoder" Version="1.2.2" />
|
<PackageReference Include="OggVorbisEncoder" Version="1.2.2" />
|
||||||
<PackageReference Include="Pfim" Version="0.11.3" />
|
<PackageReference Include="Pfim" Version="0.11.3" />
|
||||||
<PackageReference Include="System.Net.Http" Version="4.3.4" />
|
<PackageReference Include="System.Net.Http" Version="4.3.4" />
|
||||||
<PackageReference Include="System.Net.NameResolution" Version="4.3.0" />
|
<PackageReference Include="System.Net.NameResolution" Version="4.3.0" />
|
||||||
<PackageReference Include="System.Threading.Channels" Version="9.0.8" />
|
<PackageReference Include="System.Threading.Channels" Version="9.0.9" />
|
||||||
<PackageReference Include="XmlRpcCore" Version="3.1.3" />
|
<PackageReference Include="XmlRpcCore" Version="3.1.3" />
|
||||||
<PackageReference Include="zlib.net-mutliplatform" Version="1.0.8" />
|
<PackageReference Include="zlib.net-mutliplatform" Version="1.0.8" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,8 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using Newtonsoft.Json;
|
using System.Text.Json;
|
||||||
using SecondBotEvents.Services;
|
using SecondBotEvents.Services;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace SecondBotEvents.Commands
|
namespace SecondBotEvents.Commands
|
||||||
{
|
{
|
||||||
|
|
@ -16,7 +14,7 @@ namespace SecondBotEvents.Commands
|
||||||
[ReturnHintsFailure("Invaild avatar uuid")]
|
[ReturnHintsFailure("Invaild avatar uuid")]
|
||||||
[ReturnHintsFailure("Unknown store type")]
|
[ReturnHintsFailure("Unknown store type")]
|
||||||
[ReturnHintsFailure("Unable to process request store")]
|
[ReturnHintsFailure("Unable to process request store")]
|
||||||
[ArgHints("store", "What type of request to accept", "Text", "GroupInvite", new string[] { "FriendRequest", "InventoryOffer", "GroupInvite", "Teleport" })]
|
[ArgHints("store", "What type of request to accept", "Text", "GroupInvite", ["FriendRequest", "InventoryOffer", "GroupInvite", "Teleport"])]
|
||||||
[ArgHints("avatar", "Who to accept the request from", "AVATAR")]
|
[ArgHints("avatar", "Who to accept the request from", "AVATAR")]
|
||||||
[ArgHints("remove", "Should this remove the entry", "BOOL")]
|
[ArgHints("remove", "Should this remove the entry", "BOOL")]
|
||||||
[CmdTypeDo()]
|
[CmdTypeDo()]
|
||||||
|
|
@ -47,7 +45,7 @@ namespace SecondBotEvents.Commands
|
||||||
[ReturnHints("false")]
|
[ReturnHints("false")]
|
||||||
[ReturnHintsFailure("Invaild avatar uuid")]
|
[ReturnHintsFailure("Invaild avatar uuid")]
|
||||||
[ReturnHintsFailure("Unknown store type")]
|
[ReturnHintsFailure("Unknown store type")]
|
||||||
[ArgHints("store", "What type of request to accept", "Text", "GroupInvite", new string[] { "FriendRequest", "InventoryOffer", "GroupInvite", "Teleport" })]
|
[ArgHints("store", "What type of request to accept", "Text", "GroupInvite", ["FriendRequest", "InventoryOffer", "GroupInvite", "Teleport"])]
|
||||||
[ArgHints("avatar", "Who to accept the request from", "AVATAR")]
|
[ArgHints("avatar", "Who to accept the request from", "AVATAR")]
|
||||||
[CmdTypeDo()]
|
[CmdTypeDo()]
|
||||||
public Object IsOnAcceptNext(string store, string avatar)
|
public Object IsOnAcceptNext(string store, string avatar)
|
||||||
|
|
@ -97,7 +95,7 @@ namespace SecondBotEvents.Commands
|
||||||
BetterNearMe.Add(details);
|
BetterNearMe.Add(details);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return BasicReply(JsonConvert.SerializeObject(BetterNearMe));
|
return BasicReply(JsonSerializer.Serialize(BetterNearMe));
|
||||||
}
|
}
|
||||||
|
|
||||||
[About("Requests the given avatars profile image")]
|
[About("Requests the given avatars profile image")]
|
||||||
|
|
@ -230,7 +228,7 @@ namespace SecondBotEvents.Commands
|
||||||
NearMe.Add(av.ID, av.Name);
|
NearMe.Add(av.ID, av.Name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return BasicReply(JsonConvert.SerializeObject(NearMe));
|
return BasicReply(JsonSerializer.Serialize(NearMe));
|
||||||
}
|
}
|
||||||
|
|
||||||
[About("searchs the AV database if not found triggers a lookup")]
|
[About("searchs the AV database if not found triggers a lookup")]
|
||||||
|
|
@ -241,12 +239,11 @@ namespace SecondBotEvents.Commands
|
||||||
[CmdTypeDo()]
|
[CmdTypeDo()]
|
||||||
public object Key2Name(string uuid)
|
public object Key2Name(string uuid)
|
||||||
{
|
{
|
||||||
UUID avUUID = UUID.Zero;
|
if (UUID.TryParse(uuid, out _) == false)
|
||||||
if (UUID.TryParse(uuid, out avUUID) == false)
|
|
||||||
{
|
{
|
||||||
return Failure("Not a vaild UUID");
|
return Failure("Not a vaild UUID");
|
||||||
}
|
}
|
||||||
return BasicReply(master.DataStoreService.GetAvatarName(avUUID));
|
return BasicReply(master.DataStoreService.GetAvatarName(UUID.Zero));
|
||||||
}
|
}
|
||||||
|
|
||||||
[About("searchs the AV database if not found triggers a lookup")]
|
[About("searchs the AV database if not found triggers a lookup")]
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
using Newtonsoft.Json;
|
using System.Text.Json;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using SecondBotEvents.Services;
|
using SecondBotEvents.Services;
|
||||||
|
|
||||||
|
|
@ -12,7 +12,7 @@ namespace SecondBotEvents.Commands
|
||||||
[CmdTypeGet()]
|
[CmdTypeGet()]
|
||||||
public object LocalChatHistory()
|
public object LocalChatHistory()
|
||||||
{
|
{
|
||||||
return BasicReply(JsonConvert.SerializeObject(master.DataStoreService.GetLocalChat()));
|
return BasicReply(JsonSerializer.Serialize(master.DataStoreService.GetLocalChat()));
|
||||||
}
|
}
|
||||||
|
|
||||||
[About("sends a message to localchat (Normal chat)")]
|
[About("sends a message to localchat (Normal chat)")]
|
||||||
|
|
@ -23,7 +23,7 @@ namespace SecondBotEvents.Commands
|
||||||
[CmdTypeDo()]
|
[CmdTypeDo()]
|
||||||
public object Say(string channel, string message)
|
public object Say(string channel, string message)
|
||||||
{
|
{
|
||||||
if (SecondbotHelpers.isempty(message) == true)
|
if (SecondbotHelpers.IsEmpty(message) == true)
|
||||||
{
|
{
|
||||||
return Failure("Message empty", [channel, message]);
|
return Failure("Message empty", [channel, message]);
|
||||||
}
|
}
|
||||||
|
|
@ -44,7 +44,7 @@ namespace SecondBotEvents.Commands
|
||||||
[CmdTypeDo()]
|
[CmdTypeDo()]
|
||||||
public object Shout(string channel, string message)
|
public object Shout(string channel, string message)
|
||||||
{
|
{
|
||||||
if (SecondbotHelpers.isempty(message) == true)
|
if (SecondbotHelpers.IsEmpty(message) == true)
|
||||||
{
|
{
|
||||||
return Failure("Message empty", [channel, message]);
|
return Failure("Message empty", [channel, message]);
|
||||||
}
|
}
|
||||||
|
|
@ -65,7 +65,7 @@ namespace SecondBotEvents.Commands
|
||||||
[CmdTypeDo()]
|
[CmdTypeDo()]
|
||||||
public object Whisper(string channel, string message)
|
public object Whisper(string channel, string message)
|
||||||
{
|
{
|
||||||
if (SecondbotHelpers.isempty(message) == true)
|
if (SecondbotHelpers.IsEmpty(message) == true)
|
||||||
{
|
{
|
||||||
return Failure("Message empty", [channel, message]);
|
return Failure("Message empty", [channel, message]);
|
||||||
}
|
}
|
||||||
|
|
@ -94,7 +94,7 @@ namespace SecondBotEvents.Commands
|
||||||
{
|
{
|
||||||
return Failure("avatar lookup", [avatar, message]);
|
return Failure("avatar lookup", [avatar, message]);
|
||||||
}
|
}
|
||||||
if (SecondbotHelpers.isempty(message) == true)
|
if (SecondbotHelpers.IsEmpty(message) == true)
|
||||||
{
|
{
|
||||||
return Failure("Message empty", [avatar, message]);
|
return Failure("Message empty", [avatar, message]);
|
||||||
}
|
}
|
||||||
|
|
@ -108,7 +108,7 @@ namespace SecondBotEvents.Commands
|
||||||
[CmdTypeGet()]
|
[CmdTypeGet()]
|
||||||
public object chatwindows()
|
public object chatwindows()
|
||||||
{
|
{
|
||||||
return BasicReply(JsonConvert.SerializeObject(master.DataStoreService.GetAvatarImWindows()));
|
return BasicReply(JsonSerializer.Serialize(master.DataStoreService.GetAvatarImWindows()));
|
||||||
}
|
}
|
||||||
|
|
||||||
[About("gets a list of chat windows from avatars with unread messages")]
|
[About("gets a list of chat windows from avatars with unread messages")]
|
||||||
|
|
@ -116,7 +116,7 @@ namespace SecondBotEvents.Commands
|
||||||
[CmdTypeGet()]
|
[CmdTypeGet()]
|
||||||
public object listwithunread()
|
public object listwithunread()
|
||||||
{
|
{
|
||||||
return BasicReply(JsonConvert.SerializeObject(master.DataStoreService.GetAvatarImWindowsUnread()));
|
return BasicReply(JsonSerializer.Serialize(master.DataStoreService.GetAvatarImWindowsUnread()));
|
||||||
}
|
}
|
||||||
|
|
||||||
[About("gets if there are any unread im messages from avatars at all")]
|
[About("gets if there are any unread im messages from avatars at all")]
|
||||||
|
|
@ -139,7 +139,7 @@ namespace SecondBotEvents.Commands
|
||||||
{
|
{
|
||||||
return Failure("avatar UUID invaild");
|
return Failure("avatar UUID invaild");
|
||||||
}
|
}
|
||||||
return BasicReply(JsonConvert.SerializeObject(master.DataStoreService.GetAvatarImWindow(avatarUUID)));
|
return BasicReply(JsonSerializer.Serialize(master.DataStoreService.GetAvatarImWindow(avatarUUID)));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
using Newtonsoft.Json;
|
using System.Text.Json;
|
||||||
using SecondBotEvents.Services;
|
using SecondBotEvents.Services;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
@ -38,7 +38,7 @@ namespace SecondBotEvents.Commands
|
||||||
{
|
{
|
||||||
return Failure("Discord client not ready");
|
return Failure("Discord client not ready");
|
||||||
}
|
}
|
||||||
if (SecondbotHelpers.notempty(why) == false)
|
if (SecondbotHelpers.NotEmpty(why) == false)
|
||||||
{
|
{
|
||||||
return Failure("Why empty", [serverid, memberid, why]);
|
return Failure("Why empty", [serverid, memberid, why]);
|
||||||
}
|
}
|
||||||
|
|
@ -63,7 +63,7 @@ namespace SecondBotEvents.Commands
|
||||||
{
|
{
|
||||||
return Failure(reply.Value.First());
|
return Failure(reply.Value.First());
|
||||||
}
|
}
|
||||||
return BasicReply(JsonConvert.SerializeObject(reply.Value));
|
return BasicReply(JsonSerializer.Serialize(reply.Value));
|
||||||
}
|
}
|
||||||
|
|
||||||
[About("Clears messages on the server sent by the member in the last 13 days, 22hours 59mins")]
|
[About("Clears messages on the server sent by the member in the last 13 days, 22hours 59mins")]
|
||||||
|
|
@ -128,7 +128,7 @@ namespace SecondBotEvents.Commands
|
||||||
{
|
{
|
||||||
return Failure("Discord client not ready");
|
return Failure("Discord client not ready");
|
||||||
}
|
}
|
||||||
if (SecondbotHelpers.notempty(message) == false)
|
if (SecondbotHelpers.NotEmpty(message) == false)
|
||||||
{
|
{
|
||||||
return Failure("message empty", [serverid, channelid, tts, message]);
|
return Failure("message empty", [serverid, channelid, tts, message]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
using EmbedIO;
|
using EmbedIO;
|
||||||
using Newtonsoft.Json;
|
using System.Text.Json;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenMetaverse.Assets;
|
using OpenMetaverse.Assets;
|
||||||
using OpenMetaverse.StructuredData;
|
using OpenMetaverse.StructuredData;
|
||||||
|
|
@ -372,7 +372,7 @@ namespace SecondBotEvents.Commands
|
||||||
}
|
}
|
||||||
string covenantText = covenantAssetRead.Value;
|
string covenantText = covenantAssetRead.Value;
|
||||||
// Return the result as a JSON object, including the text
|
// Return the result as a JSON object, including the text
|
||||||
return BasicReply(JsonConvert.SerializeObject(new
|
return BasicReply(JsonSerializer.Serialize(new
|
||||||
{
|
{
|
||||||
Fetched = covenantAssetRead.Key,
|
Fetched = covenantAssetRead.Key,
|
||||||
CovenantID = result.CovenantID.ToString(),
|
CovenantID = result.CovenantID.ToString(),
|
||||||
|
|
@ -580,7 +580,7 @@ namespace SecondBotEvents.Commands
|
||||||
[CmdTypeDo()]
|
[CmdTypeDo()]
|
||||||
public object SimMessage(string message)
|
public object SimMessage(string message)
|
||||||
{
|
{
|
||||||
if (SecondbotHelpers.notempty(message) == false)
|
if (SecondbotHelpers.NotEmpty(message) == false)
|
||||||
{
|
{
|
||||||
return Failure("Message empty", [message]);
|
return Failure("Message empty", [message]);
|
||||||
}
|
}
|
||||||
|
|
@ -638,7 +638,7 @@ namespace SecondBotEvents.Commands
|
||||||
{ "X", region.X.ToString() },
|
{ "X", region.X.ToString() },
|
||||||
{ "Y", region.Y.ToString() }
|
{ "Y", region.Y.ToString() }
|
||||||
};
|
};
|
||||||
return BasicReply(JsonConvert.SerializeObject(reply));
|
return BasicReply(JsonSerializer.Serialize(reply));
|
||||||
}
|
}
|
||||||
|
|
||||||
[About("Requests the estate banlist")]
|
[About("Requests the estate banlist")]
|
||||||
|
|
@ -646,7 +646,7 @@ namespace SecondBotEvents.Commands
|
||||||
[CmdTypeGet()]
|
[CmdTypeGet()]
|
||||||
public object GetEstateBanList()
|
public object GetEstateBanList()
|
||||||
{
|
{
|
||||||
return BasicReply(JsonConvert.SerializeObject(master.DataStoreService.GetEstateBans()));
|
return BasicReply(JsonSerializer.Serialize(master.DataStoreService.GetEstateBans()));
|
||||||
}
|
}
|
||||||
|
|
||||||
[About("Attempts to add/remove the avatar to/from the Estate banlist")]
|
[About("Attempts to add/remove the avatar to/from the Estate banlist")]
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using SecondBotEvents.Services;
|
using SecondBotEvents.Services;
|
||||||
using Newtonsoft.Json;
|
using System.Text.Json;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
|
|
@ -34,7 +34,7 @@ namespace SecondBotEvents.Commands
|
||||||
{
|
{
|
||||||
return Failure("no map access or updating", [avatar]);
|
return Failure("no map access or updating", [avatar]);
|
||||||
}
|
}
|
||||||
return BasicReply(JsonConvert.SerializeObject(loc), [avatar]);
|
return BasicReply(JsonSerializer.Serialize(loc), [avatar]);
|
||||||
}
|
}
|
||||||
|
|
||||||
[About("Gets the friendslist")]
|
[About("Gets the friendslist")]
|
||||||
|
|
@ -56,7 +56,7 @@ namespace SecondBotEvents.Commands
|
||||||
CleanedFriendsList.Add(entry);
|
CleanedFriendsList.Add(entry);
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
return BasicReply(JsonConvert.SerializeObject(CleanedFriendsList));
|
return BasicReply(JsonSerializer.Serialize(CleanedFriendsList));
|
||||||
}
|
}
|
||||||
|
|
||||||
[About("Updates the friend perms for avatar avatar to State \n if true grants (Online/Map/Modify) perms")]
|
[About("Updates the friend perms for avatar avatar to State \n if true grants (Online/Map/Modify) perms")]
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ namespace SecondBotEvents.Commands
|
||||||
{
|
{
|
||||||
return Failure("Amount out of range", [objectuuid, primname, amount]);
|
return Failure("Amount out of range", [objectuuid, primname, amount]);
|
||||||
}
|
}
|
||||||
if(SecondbotHelpers.notempty(primname) == false)
|
if(SecondbotHelpers.NotEmpty(primname) == false)
|
||||||
{
|
{
|
||||||
return Failure("Primname is empty", [objectuuid, primname, amount]);
|
return Failure("Primname is empty", [objectuuid, primname, amount]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
using Newtonsoft.Json;
|
using System.Text.Json;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using SecondBotEvents.Services;
|
using SecondBotEvents.Services;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
@ -41,7 +41,7 @@ namespace SecondBotEvents.Commands
|
||||||
{
|
{
|
||||||
return Failure("Invaild group UUID", [group]);
|
return Failure("Invaild group UUID", [group]);
|
||||||
}
|
}
|
||||||
return BasicReply(JsonConvert.SerializeObject(master.DataStoreService.GetGroupMembers(groupuuid)));
|
return BasicReply(JsonSerializer.Serialize(master.DataStoreService.GetGroupMembers(groupuuid)));
|
||||||
}
|
}
|
||||||
|
|
||||||
[About("Attempts to ban/unban a given avatar from a group")]
|
[About("Attempts to ban/unban a given avatar from a group")]
|
||||||
|
|
@ -212,11 +212,11 @@ namespace SecondBotEvents.Commands
|
||||||
{
|
{
|
||||||
return Failure("Unknown group", [group, title, message]);
|
return Failure("Unknown group", [group, title, message]);
|
||||||
}
|
}
|
||||||
if (SecondbotHelpers.notempty(title) == false)
|
if (SecondbotHelpers.NotEmpty(title) == false)
|
||||||
{
|
{
|
||||||
return Failure("Title empty", [group, title, message]);
|
return Failure("Title empty", [group, title, message]);
|
||||||
}
|
}
|
||||||
if (SecondbotHelpers.notempty(message) == false)
|
if (SecondbotHelpers.NotEmpty(message) == false)
|
||||||
{
|
{
|
||||||
return Failure("Message empty", [group, title, message]);
|
return Failure("Message empty", [group, title, message]);
|
||||||
}
|
}
|
||||||
|
|
@ -303,11 +303,11 @@ namespace SecondBotEvents.Commands
|
||||||
{
|
{
|
||||||
return Failure("Unknown group", [group, title, message, attachment]);
|
return Failure("Unknown group", [group, title, message, attachment]);
|
||||||
}
|
}
|
||||||
if (SecondbotHelpers.notempty(title) == false)
|
if (SecondbotHelpers.NotEmpty(title) == false)
|
||||||
{
|
{
|
||||||
return Failure("Title empty", [group, title, message, attachment]);
|
return Failure("Title empty", [group, title, message, attachment]);
|
||||||
}
|
}
|
||||||
if (SecondbotHelpers.notempty(message) == false)
|
if (SecondbotHelpers.NotEmpty(message) == false)
|
||||||
{
|
{
|
||||||
return Failure("Message empty", [group, title, message, attachment]);
|
return Failure("Message empty", [group, title, message, attachment]);
|
||||||
}
|
}
|
||||||
|
|
@ -328,7 +328,7 @@ namespace SecondBotEvents.Commands
|
||||||
[CmdTypeGet()]
|
[CmdTypeGet()]
|
||||||
public object GetGroupList()
|
public object GetGroupList()
|
||||||
{
|
{
|
||||||
return BasicReply(JsonConvert.SerializeObject(master.DataStoreService.GetGroups()));
|
return BasicReply(JsonSerializer.Serialize(master.DataStoreService.GetGroups()));
|
||||||
}
|
}
|
||||||
|
|
||||||
[About("Forces the bot to reload the groups list")]
|
[About("Forces the bot to reload the groups list")]
|
||||||
|
|
@ -357,7 +357,7 @@ namespace SecondBotEvents.Commands
|
||||||
{
|
{
|
||||||
return Failure("Unknown group", [group]);
|
return Failure("Unknown group", [group]);
|
||||||
}
|
}
|
||||||
return BasicReply(JsonConvert.SerializeObject(master.DataStoreService.GetGroupRoles(groupuuid)));
|
return BasicReply(JsonSerializer.Serialize(master.DataStoreService.GetGroupRoles(groupuuid)));
|
||||||
}
|
}
|
||||||
|
|
||||||
[About("fetchs a list of all groups with unread messages")]
|
[About("fetchs a list of all groups with unread messages")]
|
||||||
|
|
@ -365,7 +365,7 @@ namespace SecondBotEvents.Commands
|
||||||
[CmdTypeGet()]
|
[CmdTypeGet()]
|
||||||
public object GroupchatListAllUnreadGroups()
|
public object GroupchatListAllUnreadGroups()
|
||||||
{
|
{
|
||||||
return BasicReply(JsonConvert.SerializeObject(master.DataStoreService.GetAllGroupsChatWithUnread()));
|
return BasicReply(JsonSerializer.Serialize(master.DataStoreService.GetAllGroupsChatWithUnread()));
|
||||||
}
|
}
|
||||||
|
|
||||||
[About("checks if a given group has any unread messages")]
|
[About("checks if a given group has any unread messages")]
|
||||||
|
|
@ -416,7 +416,7 @@ namespace SecondBotEvents.Commands
|
||||||
{
|
{
|
||||||
return Failure("Group UUID invaild", [group]);
|
return Failure("Group UUID invaild", [group]);
|
||||||
}
|
}
|
||||||
return BasicReply(JsonConvert.SerializeObject(master.DataStoreService.GetGroupChatHistory(groupUUID)));
|
return BasicReply(JsonSerializer.Serialize(master.DataStoreService.GetGroupChatHistory(groupUUID)));
|
||||||
}
|
}
|
||||||
|
|
||||||
[About("sends a message to the groupchat")]
|
[About("sends a message to the groupchat")]
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
using Newtonsoft.Json;
|
using System.Text.Json;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using SecondBotEvents.Services;
|
using SecondBotEvents.Services;
|
||||||
using System;
|
using System;
|
||||||
|
|
@ -82,7 +82,7 @@ namespace SecondBotEvents.Commands
|
||||||
{
|
{
|
||||||
return Failure("No objects found");
|
return Failure("No objects found");
|
||||||
}
|
}
|
||||||
return BasicReply(JsonConvert.SerializeObject(reply));
|
return BasicReply(JsonSerializer.Serialize(reply));
|
||||||
}
|
}
|
||||||
|
|
||||||
[About("Fetchs the current bot")]
|
[About("Fetchs the current bot")]
|
||||||
|
|
@ -158,7 +158,7 @@ namespace SecondBotEvents.Commands
|
||||||
{ "y", (int)Math.Round(GetClient().Self.SimPosition.Y) },
|
{ "y", (int)Math.Round(GetClient().Self.SimPosition.Y) },
|
||||||
{ "z", (int)Math.Round(GetClient().Self.SimPosition.Z) }
|
{ "z", (int)Math.Round(GetClient().Self.SimPosition.Z) }
|
||||||
};
|
};
|
||||||
return BasicReply(JsonConvert.SerializeObject(pos));
|
return BasicReply(JsonSerializer.Serialize(pos));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
using BetterSecondBot.Static;
|
using BetterSecondBot.Static;
|
||||||
using Newtonsoft.Json;
|
using System.Text.Json;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenMetaverse.Assets;
|
using OpenMetaverse.Assets;
|
||||||
using Org.BouncyCastle.Tls;
|
using Org.BouncyCastle.Tls;
|
||||||
|
|
@ -804,11 +804,11 @@ namespace SecondBotEvents.Commands
|
||||||
{
|
{
|
||||||
return Failure("Invaild item uuid", [itemuuid, itemname, itemtype, avatar]);
|
return Failure("Invaild item uuid", [itemuuid, itemname, itemtype, avatar]);
|
||||||
}
|
}
|
||||||
if(SecondbotHelpers.isempty(itemname) == true)
|
if(SecondbotHelpers.IsEmpty(itemname) == true)
|
||||||
{
|
{
|
||||||
return Failure("Invaild item name", [itemuuid, itemname, itemtype, avatar]);
|
return Failure("Invaild item name", [itemuuid, itemname, itemtype, avatar]);
|
||||||
}
|
}
|
||||||
if (SecondbotHelpers.isempty(itemtype) == true)
|
if (SecondbotHelpers.IsEmpty(itemtype) == true)
|
||||||
{
|
{
|
||||||
return Failure("Invaild item name", [itemuuid, itemname, itemtype, avatar]);
|
return Failure("Invaild item name", [itemuuid, itemname, itemtype, avatar]);
|
||||||
}
|
}
|
||||||
|
|
@ -1112,7 +1112,7 @@ namespace SecondBotEvents.Commands
|
||||||
public object InventoryContentsCatched()
|
public object InventoryContentsCatched()
|
||||||
{
|
{
|
||||||
InventoryNodeEntry root = LoadInventoryNode(GetClient().Inventory.Store.RootFolder.UUID,"My Inventory");
|
InventoryNodeEntry root = LoadInventoryNode(GetClient().Inventory.Store.RootFolder.UUID,"My Inventory");
|
||||||
return BasicReply(JsonConvert.SerializeObject(root));
|
return BasicReply(JsonSerializer.Serialize(root));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected InventoryNodeEntry LoadInventoryNode(UUID folder, string name="")
|
protected InventoryNodeEntry LoadInventoryNode(UUID folder, string name="")
|
||||||
|
|
@ -1284,7 +1284,7 @@ namespace SecondBotEvents.Commands
|
||||||
}
|
}
|
||||||
public string ToJson()
|
public string ToJson()
|
||||||
{
|
{
|
||||||
return JsonConvert.SerializeObject(this);
|
return JsonSerializer.Serialize(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ namespace SecondBotEvents.Commands
|
||||||
{
|
{
|
||||||
return Failure("Convert to float has failed", [height]);
|
return Failure("Convert to float has failed", [height]);
|
||||||
}
|
}
|
||||||
if (SecondbotHelpers.inrange(level, -2.0, 2.0) == false)
|
if (SecondbotHelpers.InRange(level, -2.0, 2.0) == false)
|
||||||
{
|
{
|
||||||
return Failure("height value out of range(-2.0 to 2.0)", [height]);
|
return Failure("height value out of range(-2.0 to 2.0)", [height]);
|
||||||
}
|
}
|
||||||
|
|
@ -45,15 +45,15 @@ namespace SecondBotEvents.Commands
|
||||||
{
|
{
|
||||||
return Failure("Convert to vector has failed", [x, y, z]);
|
return Failure("Convert to vector has failed", [x, y, z]);
|
||||||
}
|
}
|
||||||
if (SecondbotHelpers.inrange(pos.X, 0, 255) == false)
|
if (SecondbotHelpers.InRange(pos.X, 0, 255) == false)
|
||||||
{
|
{
|
||||||
return Failure("x value out of range 0-255", [x, y, z]);
|
return Failure("x value out of range 0-255", [x, y, z]);
|
||||||
}
|
}
|
||||||
if (SecondbotHelpers.inrange(pos.Y, 0, 255) == false)
|
if (SecondbotHelpers.InRange(pos.Y, 0, 255) == false)
|
||||||
{
|
{
|
||||||
return Failure("y value out of range 0-255", [x, y, z]);
|
return Failure("y value out of range 0-255", [x, y, z]);
|
||||||
}
|
}
|
||||||
if (SecondbotHelpers.inrange(pos.Z, 0, 5000) == false)
|
if (SecondbotHelpers.InRange(pos.Z, 0, 5000) == false)
|
||||||
{
|
{
|
||||||
return Failure("z value out of range 0-5000", [x, y, z]);
|
return Failure("z value out of range 0-5000", [x, y, z]);
|
||||||
}
|
}
|
||||||
|
|
@ -135,15 +135,15 @@ namespace SecondBotEvents.Commands
|
||||||
{
|
{
|
||||||
return Failure("Invaild vector", [vector]);
|
return Failure("Invaild vector", [vector]);
|
||||||
}
|
}
|
||||||
if (SecondbotHelpers.inrange(pos.X, 0, 255) == false)
|
if (SecondbotHelpers.InRange(pos.X, 0, 255) == false)
|
||||||
{
|
{
|
||||||
return Failure("Vector x value is out of range 0-255", [vector]);
|
return Failure("Vector x value is out of range 0-255", [vector]);
|
||||||
}
|
}
|
||||||
if (SecondbotHelpers.inrange(pos.Y, 0, 255) == false)
|
if (SecondbotHelpers.InRange(pos.Y, 0, 255) == false)
|
||||||
{
|
{
|
||||||
return Failure("Vector y value is out of range 0-255", [vector]);
|
return Failure("Vector y value is out of range 0-255", [vector]);
|
||||||
}
|
}
|
||||||
if (SecondbotHelpers.inrange(pos.Z, 0, 5000) == false)
|
if (SecondbotHelpers.InRange(pos.Z, 0, 5000) == false)
|
||||||
{
|
{
|
||||||
return Failure("Vector z value is out of range 0-5000", [vector]);
|
return Failure("Vector z value is out of range 0-5000", [vector]);
|
||||||
}
|
}
|
||||||
|
|
@ -233,7 +233,7 @@ namespace SecondBotEvents.Commands
|
||||||
[CmdTypeDo()]
|
[CmdTypeDo()]
|
||||||
public object TeleportSLURL(string slurl)
|
public object TeleportSLURL(string slurl)
|
||||||
{
|
{
|
||||||
if (SecondbotHelpers.notempty(slurl) == false)
|
if (SecondbotHelpers.NotEmpty(slurl) == false)
|
||||||
{
|
{
|
||||||
return Failure("slurl is empty", [slurl]);
|
return Failure("slurl is empty", [slurl]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
using Newtonsoft.Json;
|
using System.Text.Json;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenMetaverse.Assets;
|
using OpenMetaverse.Assets;
|
||||||
using SecondBotEvents.Services;
|
using SecondBotEvents.Services;
|
||||||
|
|
@ -20,7 +20,7 @@ namespace SecondBotEvents.Commands
|
||||||
[CmdTypeGet()]
|
[CmdTypeGet()]
|
||||||
public object NotecardRead(string notecardInventoryUUID, string replytarget)
|
public object NotecardRead(string notecardInventoryUUID, string replytarget)
|
||||||
{
|
{
|
||||||
if(SecondbotHelpers.isempty(replytarget) == true)
|
if(SecondbotHelpers.IsEmpty(replytarget) == true)
|
||||||
{
|
{
|
||||||
return Failure("replytarget not set");
|
return Failure("replytarget not set");
|
||||||
}
|
}
|
||||||
|
|
@ -33,20 +33,20 @@ namespace SecondBotEvents.Commands
|
||||||
};
|
};
|
||||||
if (UUID.TryParse(notecardInventoryUUID, out var uuid) == false)
|
if (UUID.TryParse(notecardInventoryUUID, out var uuid) == false)
|
||||||
{
|
{
|
||||||
master.CommandsService.SmartCommandReply(replytarget, JsonConvert.SerializeObject(reply), "NotecardRead");
|
master.CommandsService.SmartCommandReply(replytarget, JsonSerializer.Serialize(reply), "NotecardRead");
|
||||||
return Failure(reply.content, [notecardInventoryUUID]);
|
return Failure(reply.content, [notecardInventoryUUID]);
|
||||||
}
|
}
|
||||||
reply.content = "Unable to find inventory item";
|
reply.content = "Unable to find inventory item";
|
||||||
InventoryItem item = GetClient().Inventory.FetchItem(uuid, GetClient().Self.AgentID, new System.TimeSpan(0, 1, 30));
|
InventoryItem item = GetClient().Inventory.FetchItem(uuid, GetClient().Self.AgentID, new System.TimeSpan(0, 1, 30));
|
||||||
if (item == null)
|
if (item == null)
|
||||||
{
|
{
|
||||||
master.CommandsService.SmartCommandReply(replytarget, JsonConvert.SerializeObject(reply), "NotecardRead");
|
master.CommandsService.SmartCommandReply(replytarget, JsonSerializer.Serialize(reply), "NotecardRead");
|
||||||
return Failure(reply.content, [notecardInventoryUUID]);
|
return Failure(reply.content, [notecardInventoryUUID]);
|
||||||
}
|
}
|
||||||
reply.content = "Inventory item is not a notecard";
|
reply.content = "Inventory item is not a notecard";
|
||||||
if (item.InventoryType != InventoryType.Notecard)
|
if (item.InventoryType != InventoryType.Notecard)
|
||||||
{
|
{
|
||||||
master.CommandsService.SmartCommandReply(replytarget, JsonConvert.SerializeObject(reply), "NotecardRead");
|
master.CommandsService.SmartCommandReply(replytarget, JsonSerializer.Serialize(reply), "NotecardRead");
|
||||||
return Failure(reply.content, [notecardInventoryUUID]); ;
|
return Failure(reply.content, [notecardInventoryUUID]); ;
|
||||||
}
|
}
|
||||||
InventoryNotecard notecard = (InventoryNotecard)item;
|
InventoryNotecard notecard = (InventoryNotecard)item;
|
||||||
|
|
@ -55,7 +55,7 @@ namespace SecondBotEvents.Commands
|
||||||
if (transfer.Success == false)
|
if (transfer.Success == false)
|
||||||
{
|
{
|
||||||
reply.content = "!ERROR! - unable to read notecard";
|
reply.content = "!ERROR! - unable to read notecard";
|
||||||
master.CommandsService.SmartCommandReply(replytarget, JsonConvert.SerializeObject(reply), "NotecardRead");
|
master.CommandsService.SmartCommandReply(replytarget, JsonSerializer.Serialize(reply), "NotecardRead");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -77,7 +77,7 @@ namespace SecondBotEvents.Commands
|
||||||
reply.content = contents;
|
reply.content = contents;
|
||||||
reply.name = notecard.Name;
|
reply.name = notecard.Name;
|
||||||
reply.status = true;
|
reply.status = true;
|
||||||
master.CommandsService.SmartCommandReply(replytarget, JsonConvert.SerializeObject(reply), "NotecardRead");
|
master.CommandsService.SmartCommandReply(replytarget, JsonSerializer.Serialize(reply), "NotecardRead");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
@ -93,11 +93,11 @@ namespace SecondBotEvents.Commands
|
||||||
[CmdTypeSet()]
|
[CmdTypeSet()]
|
||||||
public object NotecardAdd(string collection, string content)
|
public object NotecardAdd(string collection, string content)
|
||||||
{
|
{
|
||||||
if (SecondbotHelpers.notempty(collection) == false)
|
if (SecondbotHelpers.NotEmpty(collection) == false)
|
||||||
{
|
{
|
||||||
return Failure("Collection value is empty", [collection, content]);
|
return Failure("Collection value is empty", [collection, content]);
|
||||||
}
|
}
|
||||||
if (SecondbotHelpers.notempty(content) == false)
|
if (SecondbotHelpers.NotEmpty(content) == false)
|
||||||
{
|
{
|
||||||
return Failure("Content value is empty", [collection, content]);
|
return Failure("Content value is empty", [collection, content]);
|
||||||
}
|
}
|
||||||
|
|
@ -112,7 +112,7 @@ namespace SecondBotEvents.Commands
|
||||||
[CmdTypeSet()]
|
[CmdTypeSet()]
|
||||||
public object NotecardClear(string collection)
|
public object NotecardClear(string collection)
|
||||||
{
|
{
|
||||||
if (SecondbotHelpers.notempty(collection) == false)
|
if (SecondbotHelpers.NotEmpty(collection) == false)
|
||||||
{
|
{
|
||||||
return Failure("Collection value is empty", [collection]);
|
return Failure("Collection value is empty", [collection]);
|
||||||
}
|
}
|
||||||
|
|
@ -132,11 +132,11 @@ namespace SecondBotEvents.Commands
|
||||||
[CmdTypeDo()]
|
[CmdTypeDo()]
|
||||||
public object NotecardSend(string avatar, string collection, string notecardname)
|
public object NotecardSend(string avatar, string collection, string notecardname)
|
||||||
{
|
{
|
||||||
if (SecondbotHelpers.notempty(collection) == false)
|
if (SecondbotHelpers.NotEmpty(collection) == false)
|
||||||
{
|
{
|
||||||
return Failure("Collection value is empty", [avatar, collection, notecardname]);
|
return Failure("Collection value is empty", [avatar, collection, notecardname]);
|
||||||
}
|
}
|
||||||
if (SecondbotHelpers.notempty(notecardname) == false)
|
if (SecondbotHelpers.NotEmpty(notecardname) == false)
|
||||||
{
|
{
|
||||||
return Failure("Notecardname value is empty", [avatar, collection, notecardname]);
|
return Failure("Notecardname value is empty", [avatar, collection, notecardname]);
|
||||||
}
|
}
|
||||||
|
|
@ -170,11 +170,11 @@ namespace SecondBotEvents.Commands
|
||||||
[CmdTypeDo()]
|
[CmdTypeDo()]
|
||||||
public object NotecardDirectSend(string avatar, string content, string notecardname)
|
public object NotecardDirectSend(string avatar, string content, string notecardname)
|
||||||
{
|
{
|
||||||
if (SecondbotHelpers.notempty(notecardname) == false)
|
if (SecondbotHelpers.NotEmpty(notecardname) == false)
|
||||||
{
|
{
|
||||||
return Failure("notecardname value is empty", [avatar, content, notecardname]);
|
return Failure("notecardname value is empty", [avatar, content, notecardname]);
|
||||||
}
|
}
|
||||||
if (SecondbotHelpers.notempty(content) == false)
|
if (SecondbotHelpers.NotEmpty(content) == false)
|
||||||
{
|
{
|
||||||
return Failure("content value is empty", [avatar, content, notecardname]);
|
return Failure("content value is empty", [avatar, content, notecardname]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
using Newtonsoft.Json;
|
using System.Text.Json;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenMetaverse.ImportExport.Collada14;
|
using OpenMetaverse.ImportExport.Collada14;
|
||||||
using SecondBotEvents.Services;
|
using SecondBotEvents.Services;
|
||||||
|
|
@ -106,7 +106,7 @@ namespace SecondBotEvents.Commands
|
||||||
{
|
{
|
||||||
reply.Add(A.Name, A.SnapshotID.ToString());
|
reply.Add(A.Name, A.SnapshotID.ToString());
|
||||||
}
|
}
|
||||||
return BasicReply(JsonConvert.SerializeObject(reply));
|
return BasicReply(JsonSerializer.Serialize(reply));
|
||||||
}
|
}
|
||||||
|
|
||||||
[About("Requests the current parcel size")]
|
[About("Requests the current parcel size")]
|
||||||
|
|
@ -245,7 +245,7 @@ namespace SecondBotEvents.Commands
|
||||||
};
|
};
|
||||||
reply.parcels.Add(R);
|
reply.parcels.Add(R);
|
||||||
}
|
}
|
||||||
return BasicReply(JsonConvert.SerializeObject(reply));
|
return BasicReply(JsonSerializer.Serialize(reply));
|
||||||
}
|
}
|
||||||
|
|
||||||
[About("Cancels the current parcel the bot is in sale")]
|
[About("Cancels the current parcel the bot is in sale")]
|
||||||
|
|
@ -341,7 +341,7 @@ namespace SecondBotEvents.Commands
|
||||||
collection.Add("ForSale", targetparcel.Flags.HasFlag(ParcelFlags.ForSale).ToString());
|
collection.Add("ForSale", targetparcel.Flags.HasFlag(ParcelFlags.ForSale).ToString());
|
||||||
collection.Add("Cost", targetparcel.SalePrice.ToString());
|
collection.Add("Cost", targetparcel.SalePrice.ToString());
|
||||||
collection.Add("SaleTarget", targetparcel.AuthBuyerID.ToString());
|
collection.Add("SaleTarget", targetparcel.AuthBuyerID.ToString());
|
||||||
return BasicReply(JsonConvert.SerializeObject(collection));
|
return BasicReply(JsonSerializer.Serialize(collection));
|
||||||
}
|
}
|
||||||
|
|
||||||
[About("Make a request to the landsale directory")]
|
[About("Make a request to the landsale directory")]
|
||||||
|
|
@ -407,7 +407,7 @@ namespace SecondBotEvents.Commands
|
||||||
int counter = (100 * GetpageNum);
|
int counter = (100 * GetpageNum);
|
||||||
foreach(DirectoryParcel parcel in e.DirParcels)
|
foreach(DirectoryParcel parcel in e.DirParcels)
|
||||||
{
|
{
|
||||||
collection.Add(JsonConvert.SerializeObject(parcel));
|
collection.Add(JsonSerializer.Serialize(parcel));
|
||||||
counter++;
|
counter++;
|
||||||
}
|
}
|
||||||
landresultsTimeout.Set();
|
landresultsTimeout.Set();
|
||||||
|
|
@ -422,7 +422,7 @@ namespace SecondBotEvents.Commands
|
||||||
return Failure("Timed out while doing land search");
|
return Failure("Timed out while doing land search");
|
||||||
}
|
}
|
||||||
GetClient().Directory.DirLandReply -= LandSearchResultsReply;
|
GetClient().Directory.DirLandReply -= LandSearchResultsReply;
|
||||||
string reply = JsonConvert.SerializeObject(collection);
|
string reply = JsonSerializer.Serialize(collection);
|
||||||
|
|
||||||
return BasicReply(reply, [filterRegion, filterPrice, filterArea, pageNum, timeout]);
|
return BasicReply(reply, [filterRegion, filterPrice, filterArea, pageNum, timeout]);
|
||||||
}
|
}
|
||||||
|
|
@ -477,7 +477,7 @@ namespace SecondBotEvents.Commands
|
||||||
{
|
{
|
||||||
return Failure(tests.Value, [name]);
|
return Failure(tests.Value, [name]);
|
||||||
}
|
}
|
||||||
if (SecondbotHelpers.notempty(name) == false)
|
if (SecondbotHelpers.NotEmpty(name) == false)
|
||||||
{
|
{
|
||||||
return Failure("Parcel name is empty", [name]);
|
return Failure("Parcel name is empty", [name]);
|
||||||
}
|
}
|
||||||
|
|
@ -537,7 +537,7 @@ namespace SecondBotEvents.Commands
|
||||||
{
|
{
|
||||||
collection.Add(cfg.ToString(), targetparcel.Flags.HasFlag(cfg).ToString());
|
collection.Add(cfg.ToString(), targetparcel.Flags.HasFlag(cfg).ToString());
|
||||||
}
|
}
|
||||||
return BasicReply(JsonConvert.SerializeObject(collection));
|
return BasicReply(JsonSerializer.Serialize(collection));
|
||||||
}
|
}
|
||||||
|
|
||||||
[About("Ejects an avatar")]
|
[About("Ejects an avatar")]
|
||||||
|
|
@ -785,7 +785,7 @@ namespace SecondBotEvents.Commands
|
||||||
collection.Add("OtherPrims", targetparcel.OtherPrims.ToString());
|
collection.Add("OtherPrims", targetparcel.OtherPrims.ToString());
|
||||||
collection.Add("MaxPrims", targetparcel.MaxPrims.ToString());
|
collection.Add("MaxPrims", targetparcel.MaxPrims.ToString());
|
||||||
collection.Add("ParcelPrimBonus", targetparcel.ParcelPrimBonus.ToString());
|
collection.Add("ParcelPrimBonus", targetparcel.ParcelPrimBonus.ToString());
|
||||||
return BasicReply(JsonConvert.SerializeObject(collection));
|
return BasicReply(JsonSerializer.Serialize(collection));
|
||||||
}
|
}
|
||||||
[About("Controls who can trigger audio on this parcel\n if everyone is set to true then grouponly will switch to false")]
|
[About("Controls who can trigger audio on this parcel\n if everyone is set to true then grouponly will switch to false")]
|
||||||
[ReturnHints("ok")]
|
[ReturnHints("ok")]
|
||||||
|
|
@ -1064,7 +1064,7 @@ namespace SecondBotEvents.Commands
|
||||||
reply.delay = delays * 1000;
|
reply.delay = delays * 1000;
|
||||||
reply.parcelName = targetparcel.Name;
|
reply.parcelName = targetparcel.Name;
|
||||||
reply.regionName = GetClient().Network.CurrentSim.Name;
|
reply.regionName = GetClient().Network.CurrentSim.Name;
|
||||||
return BasicReply(JsonConvert.SerializeObject(reply));
|
return BasicReply(JsonSerializer.Serialize(reply));
|
||||||
}
|
}
|
||||||
|
|
||||||
[About("Returns a rezzed object")]
|
[About("Returns a rezzed object")]
|
||||||
|
|
@ -1131,7 +1131,7 @@ namespace SecondBotEvents.Commands
|
||||||
{
|
{
|
||||||
return Failure("No objects found in the parcel");
|
return Failure("No objects found in the parcel");
|
||||||
}
|
}
|
||||||
return BasicReply(JsonConvert.SerializeObject(objects));
|
return BasicReply(JsonSerializer.Serialize(objects));
|
||||||
}
|
}
|
||||||
|
|
||||||
[About("Updates the current parcels media settings \n" +
|
[About("Updates the current parcels media settings \n" +
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
using Newtonsoft.Json;
|
using System.Text.Json;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using SecondBotEvents.Services;
|
using SecondBotEvents.Services;
|
||||||
using System;
|
using System;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
using Newtonsoft.Json;
|
using System.Text.Json;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenMetaverse.ImportExport.Collada14;
|
using OpenMetaverse.ImportExport.Collada14;
|
||||||
using SecondBotEvents.Services;
|
using SecondBotEvents.Services;
|
||||||
|
|
@ -22,14 +22,14 @@ namespace SecondBotEvents.Commands
|
||||||
[CmdTypeDo()]
|
[CmdTypeDo()]
|
||||||
public object SendEmail(string to, string subject, string body)
|
public object SendEmail(string to, string subject, string body)
|
||||||
{
|
{
|
||||||
if (SecondbotHelpers.isempty(to) == true) {
|
if (SecondbotHelpers.IsEmpty(to) == true) {
|
||||||
return Failure("to is empty");
|
return Failure("to is empty");
|
||||||
}
|
}
|
||||||
else if (SecondbotHelpers.isempty(subject) == true)
|
else if (SecondbotHelpers.IsEmpty(subject) == true)
|
||||||
{
|
{
|
||||||
return Failure("subject is empty", [to]);
|
return Failure("subject is empty", [to]);
|
||||||
}
|
}
|
||||||
else if (SecondbotHelpers.isempty(body) == true)
|
else if (SecondbotHelpers.IsEmpty(body) == true)
|
||||||
{
|
{
|
||||||
return Failure("body is empty", [to, subject]);
|
return Failure("body is empty", [to, subject]);
|
||||||
}
|
}
|
||||||
|
|
@ -90,11 +90,11 @@ namespace SecondBotEvents.Commands
|
||||||
[CmdTypeSet()]
|
[CmdTypeSet()]
|
||||||
public object SetKeyValue(string Key, string Value)
|
public object SetKeyValue(string Key, string Value)
|
||||||
{
|
{
|
||||||
if (SecondbotHelpers.isempty(Key) == false)
|
if (SecondbotHelpers.IsEmpty(Key) == false)
|
||||||
{
|
{
|
||||||
return Failure("Key is empty", [Key, Value]);
|
return Failure("Key is empty", [Key, Value]);
|
||||||
}
|
}
|
||||||
if (SecondbotHelpers.isempty(Value) == false)
|
if (SecondbotHelpers.IsEmpty(Value) == false)
|
||||||
{
|
{
|
||||||
return Failure("Value is empty", [Key, Value]);
|
return Failure("Value is empty", [Key, Value]);
|
||||||
}
|
}
|
||||||
|
|
@ -109,7 +109,7 @@ namespace SecondBotEvents.Commands
|
||||||
[CmdTypeSet()]
|
[CmdTypeSet()]
|
||||||
public object ClearKeyValue(string Key)
|
public object ClearKeyValue(string Key)
|
||||||
{
|
{
|
||||||
if (SecondbotHelpers.isempty(Key) == false)
|
if (SecondbotHelpers.IsEmpty(Key) == false)
|
||||||
{
|
{
|
||||||
return Failure("Key is empty", [Key]);
|
return Failure("Key is empty", [Key]);
|
||||||
}
|
}
|
||||||
|
|
@ -218,7 +218,7 @@ namespace SecondBotEvents.Commands
|
||||||
List<string> reply = [];
|
List<string> reply = [];
|
||||||
foreach (CommandHistory A in master.DataStoreService.GetCommandHistory())
|
foreach (CommandHistory A in master.DataStoreService.GetCommandHistory())
|
||||||
{
|
{
|
||||||
reply.Add(JsonConvert.SerializeObject(A));
|
reply.Add(JsonSerializer.Serialize(A));
|
||||||
if (reply.Count >= 5)
|
if (reply.Count >= 5)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
using Newtonsoft.Json;
|
using System.Text.Json;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using SecondBotEvents.Services;
|
using SecondBotEvents.Services;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
using Newtonsoft.Json;
|
using System.Text.Json;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using RestSharp;
|
using RestSharp;
|
||||||
using SecondBotEvents.Services;
|
using SecondBotEvents.Services;
|
||||||
|
|
@ -22,11 +22,11 @@ namespace SecondBotEvents.Commands
|
||||||
[CmdTypeGet()]
|
[CmdTypeGet()]
|
||||||
public object FetchNextNotecard(string endpoint, string endpointcode)
|
public object FetchNextNotecard(string endpoint, string endpointcode)
|
||||||
{
|
{
|
||||||
if (SecondbotHelpers.notempty(endpoint) == false)
|
if (SecondbotHelpers.NotEmpty(endpoint) == false)
|
||||||
{
|
{
|
||||||
return Failure("Endpoint is empty", [endpoint, endpointcode]);
|
return Failure("Endpoint is empty", [endpoint, endpointcode]);
|
||||||
}
|
}
|
||||||
if (SecondbotHelpers.notempty(endpointcode) == false)
|
if (SecondbotHelpers.NotEmpty(endpointcode) == false)
|
||||||
{
|
{
|
||||||
return Failure("Endpointcode is empty", [endpoint, endpointcode]);
|
return Failure("Endpointcode is empty", [endpoint, endpointcode]);
|
||||||
}
|
}
|
||||||
|
|
@ -48,7 +48,7 @@ namespace SecondBotEvents.Commands
|
||||||
}
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
NotecardEndpoint server_reply = JsonConvert.DeserializeObject<NotecardEndpoint>(endpoint_checks.Content);
|
NotecardEndpoint server_reply = JsonSerializer.Deserialize<NotecardEndpoint>(endpoint_checks.Content);
|
||||||
if (server_reply.status == false)
|
if (server_reply.status == false)
|
||||||
{
|
{
|
||||||
return Failure("Bad reply: " + server_reply.message, [endpoint, endpointcode]);
|
return Failure("Bad reply: " + server_reply.message, [endpoint, endpointcode]);
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
using Newtonsoft.Json;
|
using System.Text.Json;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
@ -76,7 +76,7 @@ namespace SecondBotEvents.Config
|
||||||
SimpleIO IO = new();
|
SimpleIO IO = new();
|
||||||
IO.ChangeRoot(fromFolder);
|
IO.ChangeRoot(fromFolder);
|
||||||
string writeFile = filename + ".json";
|
string writeFile = filename + ".json";
|
||||||
IO.WriteFile(writeFile, JsonConvert.SerializeObject(saveMe));
|
IO.WriteFile(writeFile, JsonSerializer.Serialize(saveMe));
|
||||||
|
|
||||||
}
|
}
|
||||||
protected void LoadSettingsFromFile(string fromFolder)
|
protected void LoadSettingsFromFile(string fromFolder)
|
||||||
|
|
@ -96,7 +96,7 @@ namespace SecondBotEvents.Config
|
||||||
{
|
{
|
||||||
settings.Add(x.Key);
|
settings.Add(x.Key);
|
||||||
string value = x.Value.ToString();
|
string value = x.Value.ToString();
|
||||||
if (SecondbotHelpers.notempty(value) == false)
|
if (SecondbotHelpers.NotEmpty(value) == false)
|
||||||
{
|
{
|
||||||
mysettings.Add(x.Key, "");
|
mysettings.Add(x.Key, "");
|
||||||
continue;
|
continue;
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ namespace SecondBotEvents
|
||||||
protected bool exitNow = false;
|
protected bool exitNow = false;
|
||||||
public EventsSecondBot(string[] args)
|
public EventsSecondBot(string[] args)
|
||||||
{
|
{
|
||||||
if (SecondbotHelpers.notempty(Environment.GetEnvironmentVariable("basic_Username")) == true)
|
if (SecondbotHelpers.NotEmpty(Environment.GetEnvironmentVariable("basic_Username")) == true)
|
||||||
{
|
{
|
||||||
fromEnv = true;
|
fromEnv = true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,17 +13,16 @@
|
||||||
<None Remove="Services\template.html" />
|
<None Remove="Services\template.html" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Betalgo.Ranul.OpenAI" Version="9.0.1" />
|
<PackageReference Include="Betalgo.Ranul.OpenAI" Version="9.1.0" />
|
||||||
<PackageReference Include="Discord.Net" Version="3.17.1" />
|
<PackageReference Include="Discord.Net" Version="3.18.0" />
|
||||||
<PackageReference Include="Discord.Net.WebSocket" Version="3.17.1" />
|
<PackageReference Include="Discord.Net.WebSocket" Version="3.18.0" />
|
||||||
<PackageReference Include="EmbedIO" Version="3.4.3" />
|
<PackageReference Include="EmbedIO" Version="3.4.3" />
|
||||||
<PackageReference Include="MailKit" Version="4.10.0" />
|
<PackageReference Include="MailKit" Version="4.14.0" />
|
||||||
<PackageReference Include="MSBuildGitHash" Version="2.0.2">
|
<PackageReference Include="MSBuildGitHash" Version="2.0.2">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
<PackageReference Include="NRedisStack" Version="1.1.1" />
|
||||||
<PackageReference Include="NRedisStack" Version="0.13.1" />
|
|
||||||
<PackageReference Include="RabbitMQ.Client" Version="7.1.2" />
|
<PackageReference Include="RabbitMQ.Client" Version="7.1.2" />
|
||||||
<PackageReference Include="RestSharp" Version="112.1.0" />
|
<PackageReference Include="RestSharp" Version="112.1.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
using Newtonsoft.Json;
|
using System.Text.Json;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using SecondBotEvents.Config;
|
using SecondBotEvents.Config;
|
||||||
using System;
|
using System;
|
||||||
|
|
@ -62,15 +62,15 @@ namespace SecondBotEvents.Services
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
chatHistorySize = inrange(3,10,myConfig.GetChatHistoryMessages());
|
chatHistorySize = InRange(3,10,myConfig.GetChatHistoryMessages());
|
||||||
localchatRateLimit = inrange(1, 10, myConfig.GetLocalchatRateLimiter());
|
localchatRateLimit = InRange(1, 10, myConfig.GetLocalchatRateLimiter());
|
||||||
groupchatRateLimit = inrange(1, 10, myConfig.GetGroupReplyRateLimiter());
|
groupchatRateLimit = InRange(1, 10, myConfig.GetGroupReplyRateLimiter());
|
||||||
imchatRateLimit = inrange(1, 10, myConfig.GetImReplyRateLimiter());
|
imchatRateLimit = InRange(1, 10, myConfig.GetImReplyRateLimiter());
|
||||||
running = true;
|
running = true;
|
||||||
master.BotClientNoticeEvent += BotClientRestart;
|
master.BotClientNoticeEvent += BotClientRestart;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int inrange(int value, int min, int max)
|
protected static int InRange(int value, int min, int max)
|
||||||
{
|
{
|
||||||
if (value < min) return min;
|
if (value < min) return min;
|
||||||
else if(value > max) return max;
|
else if(value > max) return max;
|
||||||
|
|
@ -113,9 +113,9 @@ namespace SecondBotEvents.Services
|
||||||
return "Disabled";
|
return "Disabled";
|
||||||
}
|
}
|
||||||
upkeep();
|
upkeep();
|
||||||
if (chatHistoryAI.Count() > 0)
|
if (chatHistoryAI.Count > 0)
|
||||||
{
|
{
|
||||||
return "Enabled running: " + chatHistoryAI.Count().ToString() + " chat windows";
|
return "Enabled running: " + chatHistoryAI.Count.ToString() + " chat windows";
|
||||||
}
|
}
|
||||||
return "Enabled No chat history";
|
return "Enabled No chat history";
|
||||||
}
|
}
|
||||||
|
|
@ -220,9 +220,9 @@ namespace SecondBotEvents.Services
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Dictionary<UUID, List<KeyValuePair<string, string>>> chatHistoryAI = [];
|
protected Dictionary<UUID, List<KeyValuePair<string, string>>> chatHistoryAI = [];
|
||||||
Dictionary<UUID, long> ChatHistoryLastAccessed = [];
|
protected Dictionary<UUID, long> ChatHistoryLastAccessed = [];
|
||||||
Dictionary<UUID, long> ChatRateLimiter = [];
|
protected Dictionary<UUID, long> ChatRateLimiter = [];
|
||||||
|
|
||||||
protected long lastUpkeep = 0;
|
protected long lastUpkeep = 0;
|
||||||
protected void upkeep()
|
protected void upkeep()
|
||||||
|
|
@ -247,22 +247,13 @@ namespace SecondBotEvents.Services
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach(UUID a in needcleaning)
|
foreach(UUID a in needcleaning)
|
||||||
{
|
|
||||||
if(chatHistoryAI.ContainsKey(a))
|
|
||||||
{
|
{
|
||||||
chatHistoryAI.Remove(a);
|
chatHistoryAI.Remove(a);
|
||||||
}
|
|
||||||
if(ChatHistoryLastAccessed.ContainsKey(a))
|
|
||||||
{
|
|
||||||
ChatHistoryLastAccessed.Remove(a);
|
ChatHistoryLastAccessed.Remove(a);
|
||||||
}
|
|
||||||
if (ChatRateLimiter.ContainsKey(a))
|
|
||||||
{
|
|
||||||
ChatRateLimiter.Remove(a);
|
ChatRateLimiter.Remove(a);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
protected bool RedisLive()
|
protected bool RedisLive()
|
||||||
{
|
{
|
||||||
|
|
@ -328,7 +319,7 @@ namespace SecondBotEvents.Services
|
||||||
return chatHistoryAI[store]; // nothing in memory use the default store
|
return chatHistoryAI[store]; // nothing in memory use the default store
|
||||||
}
|
}
|
||||||
redisDb.KeyExpire(readkey, TimeSpan.FromMinutes(myConfig.GetRedisMaxageMins())); // update the expire value
|
redisDb.KeyExpire(readkey, TimeSpan.FromMinutes(myConfig.GetRedisMaxageMins())); // update the expire value
|
||||||
return JsonConvert.DeserializeObject<List<KeyValuePair<string, string>>>(rawstring);
|
return JsonSerializer.Deserialize<List<KeyValuePair<string, string>>>(rawstring);
|
||||||
}
|
}
|
||||||
return NoRedisStoreFound(store);
|
return NoRedisStoreFound(store);
|
||||||
}
|
}
|
||||||
|
|
@ -423,24 +414,24 @@ namespace SecondBotEvents.Services
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
int maxsize = inrange(1, 9999, myConfig.GetRedisCountLocal());
|
int maxsize = InRange(1, 9999, myConfig.GetRedisCountLocal());
|
||||||
if(avatarchat == true)
|
if(avatarchat == true)
|
||||||
{
|
{
|
||||||
maxsize = inrange(1, 9999, myConfig.GetRedisCountIm());
|
maxsize = InRange(1, 9999, myConfig.GetRedisCountIm());
|
||||||
}
|
}
|
||||||
else if(groupchat == true)
|
else if(groupchat == true)
|
||||||
{
|
{
|
||||||
maxsize = inrange(1, 9999, myConfig.GetRedisCountGroup());
|
maxsize = InRange(1, 9999, myConfig.GetRedisCountGroup());
|
||||||
}
|
}
|
||||||
// trim the history using targeted max values
|
// trim the history using targeted max values
|
||||||
while (history.Count() > maxsize + 1)
|
while (history.Count > maxsize + 1)
|
||||||
{
|
{
|
||||||
history.RemoveAt(1);
|
history.RemoveAt(1);
|
||||||
}
|
}
|
||||||
RedisKey writekey = new(myConfig.GetRedisPrefix() + store.Guid.ToString());
|
RedisKey writekey = new(myConfig.GetRedisPrefix() + store.Guid.ToString());
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string savestring = JsonConvert.SerializeObject(history);
|
string savestring = JsonSerializer.Serialize(history);
|
||||||
if (savestring == null)
|
if (savestring == null)
|
||||||
{
|
{
|
||||||
LogFormater.Warn("Redis failed to convert history into savable format");
|
LogFormater.Warn("Redis failed to convert history into savable format");
|
||||||
|
|
@ -475,7 +466,7 @@ namespace SecondBotEvents.Services
|
||||||
protected List<KeyValuePair<string, string>> BasicSaveHistory(UUID store, List<KeyValuePair<string, string>> history)
|
protected List<KeyValuePair<string, string>> BasicSaveHistory(UUID store, List<KeyValuePair<string, string>> history)
|
||||||
{
|
{
|
||||||
// trim the history using basic config
|
// trim the history using basic config
|
||||||
while (history.Count() > chatHistorySize + 1)
|
while (history.Count > chatHistorySize + 1)
|
||||||
{
|
{
|
||||||
history.RemoveAt(1);
|
history.RemoveAt(1);
|
||||||
}
|
}
|
||||||
|
|
@ -519,11 +510,7 @@ namespace SecondBotEvents.Services
|
||||||
{
|
{
|
||||||
throw new ArgumentException("Invalid role provided in history. Role must be 'system', 'user', or 'assistant'.");
|
throw new ArgumentException("Invalid role provided in history. Role must be 'system', 'user', or 'assistant'.");
|
||||||
}
|
}
|
||||||
string thismessage = entry.Value;
|
string thismessage = entry.Value ?? throw new ArgumentException("Message can not be empty");
|
||||||
if(thismessage == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentException("Message can not be empty");
|
|
||||||
}
|
|
||||||
if (role == "system") messages.Add(ChatMessage.FromSystem(thismessage));
|
if (role == "system") messages.Add(ChatMessage.FromSystem(thismessage));
|
||||||
else if (role == "user") messages.Add(ChatMessage.FromUser(thismessage));
|
else if (role == "user") messages.Add(ChatMessage.FromUser(thismessage));
|
||||||
else if (role == "assistant") messages.Add(ChatMessage.FromAssistant(thismessage));
|
else if (role == "assistant") messages.Add(ChatMessage.FromAssistant(thismessage));
|
||||||
|
|
@ -538,7 +525,7 @@ namespace SecondBotEvents.Services
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(messages.Count() == 0)
|
if(messages.Count == 0)
|
||||||
{
|
{
|
||||||
LogFormater.Warn("No messages given");
|
LogFormater.Warn("No messages given");
|
||||||
return;
|
return;
|
||||||
|
|
@ -581,7 +568,7 @@ namespace SecondBotEvents.Services
|
||||||
completionResult = await openAiService.ChatCompletion.CreateCompletion(new ChatCompletionCreateRequest
|
completionResult = await openAiService.ChatCompletion.CreateCompletion(new ChatCompletionCreateRequest
|
||||||
{
|
{
|
||||||
Messages = messages,
|
Messages = messages,
|
||||||
Model = openAI_Models.GetModel(myConfig.GetUseModel())
|
Model = OpenAIModels.GetModel(myConfig.GetUseModel())
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -705,7 +692,7 @@ namespace SecondBotEvents.Services
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class openAI_Models
|
public class OpenAIModels
|
||||||
{
|
{
|
||||||
public static string GetModel(string input)
|
public static string GetModel(string input)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
using Newtonsoft.Json;
|
using System.Text.Json;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using SecondBotEvents.Config;
|
using SecondBotEvents.Config;
|
||||||
|
|
@ -245,7 +245,10 @@ namespace SecondBotEvents.Services
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mode = "IM";
|
mode = "IM";
|
||||||
UUID.TryParse(UUIDfetch, out target_avatar);
|
if(UUID.TryParse(UUIDfetch, out target_avatar) == false)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (new EmailAddressAttribute().IsValid(target) == true)
|
else if (new EmailAddressAttribute().IsValid(target) == true)
|
||||||
{
|
{
|
||||||
|
|
@ -322,7 +325,7 @@ namespace SecondBotEvents.Services
|
||||||
reply = "Error";
|
reply = "Error";
|
||||||
if (processed != null)
|
if (processed != null)
|
||||||
{
|
{
|
||||||
reply = JsonConvert.SerializeObject(processed);
|
reply = JsonSerializer.Serialize(processed);
|
||||||
}
|
}
|
||||||
CommandNotice(C.command, source, String.Join("@@@", C.args), true, reply);
|
CommandNotice(C.command, source, String.Join("@@@", C.args), true, reply);
|
||||||
return new KeyValuePair<bool, string>(status, reply);
|
return new KeyValuePair<bool, string>(status, reply);
|
||||||
|
|
@ -450,7 +453,7 @@ namespace SecondBotEvents.Services
|
||||||
{
|
{
|
||||||
e.results = e.results.Substring(0, 100) + "...";
|
e.results = e.results.Substring(0, 100) + "...";
|
||||||
}
|
}
|
||||||
LogFormater.Info("Command log:" + JsonConvert.SerializeObject(e));
|
LogFormater.Info("Command log:" + JsonSerializer.Serialize(e));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -606,7 +609,7 @@ namespace SecondBotEvents.Services
|
||||||
{
|
{
|
||||||
dynamic ret = jToken[key];
|
dynamic ret = jToken[key];
|
||||||
if (ret == null) return defaultValue;
|
if (ret == null) return defaultValue;
|
||||||
if (ret is JObject) return JsonConvert.DeserializeObject<T>(ret.ToString());
|
if (ret is JObject) return JsonSerializer.Deserialize<T>(ret.ToString());
|
||||||
return (T)ret;
|
return (T)ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
using Newtonsoft.Json;
|
using System.Text.Json;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using SecondBotEvents.Config;
|
using SecondBotEvents.Config;
|
||||||
using System;
|
using System;
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using Newtonsoft.Json;
|
using System.Text.Json;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Swan;
|
using Swan;
|
||||||
using SecondBotEvents.Commands;
|
using SecondBotEvents.Commands;
|
||||||
|
|
@ -190,7 +190,7 @@ namespace SecondBotEvents.Services
|
||||||
objectname = e.ObjectName,
|
objectname = e.ObjectName,
|
||||||
expires = expiresAt
|
expires = expiresAt
|
||||||
};
|
};
|
||||||
string eventMessage = JsonConvert.SerializeObject(window);
|
string eventMessage = JsonSerializer.Serialize(window);
|
||||||
foreach(int a in DialogRelayChannels)
|
foreach(int a in DialogRelayChannels)
|
||||||
{
|
{
|
||||||
if(a >= 0)
|
if(a >= 0)
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using Newtonsoft.Json;
|
using System.Text.Json;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Swan;
|
using Swan;
|
||||||
using RestSharp;
|
using RestSharp;
|
||||||
|
|
@ -33,7 +33,7 @@ namespace SecondBotEvents.Services
|
||||||
{
|
{
|
||||||
foreach(string A in InventoryEvents[detail["itemtype"]])
|
foreach(string A in InventoryEvents[detail["itemtype"]])
|
||||||
{
|
{
|
||||||
string output = JsonConvert.SerializeObject(detail);
|
string output = JsonSerializer.Serialize(detail);
|
||||||
if(UUID.TryParse(A, out UUID OutputAvatar) == true)
|
if(UUID.TryParse(A, out UUID OutputAvatar) == true)
|
||||||
{
|
{
|
||||||
if (OutputAvatar != UUID.Zero)
|
if (OutputAvatar != UUID.Zero)
|
||||||
|
|
@ -259,7 +259,7 @@ namespace SecondBotEvents.Services
|
||||||
args,
|
args,
|
||||||
myConfig.GetOutputSecret()
|
myConfig.GetOutputSecret()
|
||||||
);
|
);
|
||||||
string output = JsonConvert.SerializeObject(e);
|
string output = JsonSerializer.Serialize(e);
|
||||||
if(myConfig.GetOutputChannel() >= 0)
|
if(myConfig.GetOutputChannel() >= 0)
|
||||||
{
|
{
|
||||||
GetClient().Self.Chat(output, myConfig.GetOutputChannel(), ChatType.Normal);
|
GetClient().Self.Chat(output, myConfig.GetOutputChannel(), ChatType.Normal);
|
||||||
|
|
@ -268,7 +268,7 @@ namespace SecondBotEvents.Services
|
||||||
{
|
{
|
||||||
GetClient().Self.InstantMessage(OutputAvatar, output);
|
GetClient().Self.InstantMessage(OutputAvatar, output);
|
||||||
}
|
}
|
||||||
if(SecondbotHelpers.isempty(myConfig.GetOutputHttpURL()) == false)
|
if(SecondbotHelpers.IsEmpty(myConfig.GetOutputHttpURL()) == false)
|
||||||
{
|
{
|
||||||
if(myConfig.GetOutputHttpURL().StartsWith("http") == false)
|
if(myConfig.GetOutputHttpURL().StartsWith("http") == false)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,6 @@ using System.Text.Json;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Newtonsoft.Json;
|
|
||||||
using Org.BouncyCastle.Utilities;
|
using Org.BouncyCastle.Utilities;
|
||||||
using Swan;
|
using Swan;
|
||||||
|
|
||||||
|
|
@ -160,7 +159,7 @@ namespace SecondBotEvents.Services
|
||||||
{
|
{
|
||||||
return "Command request rejected";
|
return "Command request rejected";
|
||||||
}
|
}
|
||||||
return JsonConvert.SerializeObject(master.CommandsService.RunCommand("HTTP", C));
|
return JsonSerializer.Serialize(master.CommandsService.RunCommand("HTTP", C));
|
||||||
}
|
}
|
||||||
public static async Task SerializationCallback(IHttpContext context, object? data)
|
public static async Task SerializationCallback(IHttpContext context, object? data)
|
||||||
{
|
{
|
||||||
|
|
@ -223,7 +222,7 @@ namespace SecondBotEvents.Services
|
||||||
|
|
||||||
protected object BasicReply(string input)
|
protected object BasicReply(string input)
|
||||||
{
|
{
|
||||||
return BasicReply(input, Array.Empty<string>(), GetCallingCommand());
|
return BasicReply(input, [], GetCallingCommand());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected object BasicReply(string input, string[] args)
|
protected object BasicReply(string input, string[] args)
|
||||||
|
|
@ -250,12 +249,12 @@ namespace SecondBotEvents.Services
|
||||||
|
|
||||||
protected object Failure(string input)
|
protected object Failure(string input)
|
||||||
{
|
{
|
||||||
return Failure(input, GetCallingCommand(), Array.Empty<string>(), null);
|
return Failure(input, GetCallingCommand(), [], null);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static string GetCallingCommand()
|
protected static string GetCallingCommand()
|
||||||
{
|
{
|
||||||
string commandName = "Unable to get";
|
string commandName;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
int index = 2;
|
int index = 2;
|
||||||
|
|
@ -343,7 +342,7 @@ namespace SecondBotEvents.Services
|
||||||
public string about = about;
|
public string about = about;
|
||||||
public string defaultValueType = defaultValueType ?? string.Empty; // Default to empty string if not provided
|
public string defaultValueType = defaultValueType ?? string.Empty; // Default to empty string if not provided
|
||||||
public string exampleValue = exampleValue ?? string.Empty; // Default to empty string if not provided
|
public string exampleValue = exampleValue ?? string.Empty; // Default to empty string if not provided
|
||||||
public string[] acceptedValues = acceptedValues ?? Array.Empty<string>(); // Default to empty array if not provided
|
public string[] acceptedValues = acceptedValues ?? []; // Default to empty array if not provided
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SecondbotWebApi(EventsSecondBot setmaster) : WebApiController
|
public class SecondbotWebApi(EventsSecondBot setmaster) : WebApiController
|
||||||
|
|
@ -364,7 +363,7 @@ namespace SecondBotEvents.Services
|
||||||
|
|
||||||
public string Run([FormField] string commandName, [FormField] string args, [FormField] string signing, [FormField] string unixtime)
|
public string Run([FormField] string commandName, [FormField] string args, [FormField] string signing, [FormField] string unixtime)
|
||||||
{
|
{
|
||||||
string[] myArgs = Array.Empty<string>();
|
string[] myArgs = [];
|
||||||
if(args != null)
|
if(args != null)
|
||||||
{
|
{
|
||||||
myArgs = args.Split("~#~", StringSplitOptions.RemoveEmptyEntries);
|
myArgs = args.Split("~#~", StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
|
@ -385,7 +384,7 @@ namespace SecondBotEvents.Services
|
||||||
{
|
{
|
||||||
return "Command request rejected";
|
return "Command request rejected";
|
||||||
}
|
}
|
||||||
return JsonConvert.SerializeObject(master.CommandsService.RunCommand("HTTP",C));
|
return JsonSerializer.Serialize(master.CommandsService.RunCommand("HTTP",C));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
using Newtonsoft.Json;
|
using System.Text.Json;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using SecondBotEvents.Config;
|
using SecondBotEvents.Config;
|
||||||
using System;
|
using System;
|
||||||
|
|
@ -145,7 +145,7 @@ namespace SecondBotEvents.Services
|
||||||
{
|
{
|
||||||
if(myConfig.GetEnableDebug() == true)
|
if(myConfig.GetEnableDebug() == true)
|
||||||
{
|
{
|
||||||
LogFormater.Warn("Interaction debug:" + JsonConvert.SerializeObject(new InteractionEvent(from, eventype, status, why, setMisc)));
|
LogFormater.Warn("Interaction debug:" + JsonSerializer.Serialize(new InteractionEvent(from, eventype, status, why, setMisc)));
|
||||||
}
|
}
|
||||||
if (myConfig.GetEnableJsonOutputEvents() == false)
|
if (myConfig.GetEnableJsonOutputEvents() == false)
|
||||||
{
|
{
|
||||||
|
|
@ -153,7 +153,7 @@ namespace SecondBotEvents.Services
|
||||||
}
|
}
|
||||||
master.CommandsService.SmartCommandReply(
|
master.CommandsService.SmartCommandReply(
|
||||||
myConfig.GetJsonOutputEventsTarget(),
|
myConfig.GetJsonOutputEventsTarget(),
|
||||||
JsonConvert.SerializeObject(new InteractionEvent(from, eventype, status, why, setMisc)),
|
JsonSerializer.Serialize(new InteractionEvent(from, eventype, status, why, setMisc)),
|
||||||
"interactions"
|
"interactions"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -171,7 +171,7 @@ namespace SecondBotEvents.Services
|
||||||
{
|
{
|
||||||
if (myConfig.GetEnableDebug() == true)
|
if (myConfig.GetEnableDebug() == true)
|
||||||
{
|
{
|
||||||
LogFormater.Warn("Interaction debug:" + JsonConvert.SerializeObject(misc));
|
LogFormater.Warn("Interaction debug:" + JsonSerializer.Serialize(misc));
|
||||||
}
|
}
|
||||||
if (myConfig.GetEnableJsonOutputEvents() == false)
|
if (myConfig.GetEnableJsonOutputEvents() == false)
|
||||||
{
|
{
|
||||||
|
|
@ -180,7 +180,7 @@ namespace SecondBotEvents.Services
|
||||||
misc.Add("eventsource", source);
|
misc.Add("eventsource", source);
|
||||||
master.CommandsService.SmartCommandReply(
|
master.CommandsService.SmartCommandReply(
|
||||||
myConfig.GetJsonOutputEventsTarget(),
|
myConfig.GetJsonOutputEventsTarget(),
|
||||||
JsonConvert.SerializeObject(misc),
|
JsonSerializer.Serialize(misc),
|
||||||
"interactions"
|
"interactions"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using SecondBotEvents.Config;
|
using SecondBotEvents.Config;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Newtonsoft.Json;
|
using System.Text.Json;
|
||||||
using RestSharp;
|
using RestSharp;
|
||||||
using OpenMetaverse.StructuredData;
|
using OpenMetaverse.StructuredData;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ using System.Threading.Tasks;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using RabbitMQ.Client.Events;
|
using RabbitMQ.Client.Events;
|
||||||
using Newtonsoft.Json;
|
using System.Text.Json;
|
||||||
using Swan;
|
using Swan;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using Microsoft.Extensions.Logging.Abstractions;
|
using Microsoft.Extensions.Logging.Abstractions;
|
||||||
|
|
@ -19,7 +19,7 @@ namespace SecondBotEvents.Services
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
JsonCommandFormat result = JsonConvert.DeserializeObject<JsonCommandFormat>(Encoding.UTF8.GetString(e.Body.ToArray()));
|
JsonCommandFormat result = JsonSerializer.Deserialize<JsonCommandFormat>(Encoding.UTF8.GetString(e.Body.ToArray()));
|
||||||
if (result == null || string.IsNullOrEmpty(result.CommandName))
|
if (result == null || string.IsNullOrEmpty(result.CommandName))
|
||||||
{
|
{
|
||||||
if (myConfig.GetLogDebug() == true)
|
if (myConfig.GetLogDebug() == true)
|
||||||
|
|
@ -45,7 +45,7 @@ namespace SecondBotEvents.Services
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
JsonNotecardFormat result = JsonConvert.DeserializeObject<JsonNotecardFormat>(Encoding.UTF8.GetString(e.Body.ToArray()));
|
JsonNotecardFormat result = JsonSerializer.Deserialize<JsonNotecardFormat>(Encoding.UTF8.GetString(e.Body.ToArray()));
|
||||||
if (
|
if (
|
||||||
result == null ||
|
result == null ||
|
||||||
string.IsNullOrEmpty(result.Name) ||
|
string.IsNullOrEmpty(result.Name) ||
|
||||||
|
|
@ -82,7 +82,7 @@ namespace SecondBotEvents.Services
|
||||||
Console.WriteLine("Message received: " + Encoding.UTF8.GetString(e.Body.ToArray()));
|
Console.WriteLine("Message received: " + Encoding.UTF8.GetString(e.Body.ToArray()));
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
JsonMessageFormat result = JsonConvert.DeserializeObject<JsonMessageFormat>(Encoding.UTF8.GetString(e.Body.ToArray()));
|
JsonMessageFormat result = JsonSerializer.Deserialize<JsonMessageFormat>(Encoding.UTF8.GetString(e.Body.ToArray()));
|
||||||
if (result == null || string.IsNullOrEmpty(result.UUID) || string.IsNullOrEmpty(result.Message))
|
if (result == null || string.IsNullOrEmpty(result.UUID) || string.IsNullOrEmpty(result.Message))
|
||||||
{
|
{
|
||||||
if (myConfig.GetLogDebug() == true)
|
if (myConfig.GetLogDebug() == true)
|
||||||
|
|
@ -113,7 +113,7 @@ namespace SecondBotEvents.Services
|
||||||
Console.WriteLine("Message received: " + Encoding.UTF8.GetString(e.Body.ToArray()));
|
Console.WriteLine("Message received: " + Encoding.UTF8.GetString(e.Body.ToArray()));
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
JsonMessageFormat result = JsonConvert.DeserializeObject<JsonMessageFormat>(Encoding.UTF8.GetString(e.Body.ToArray()));
|
JsonMessageFormat result = JsonSerializer.Deserialize<JsonMessageFormat>(Encoding.UTF8.GetString(e.Body.ToArray()));
|
||||||
if (result == null || string.IsNullOrEmpty(result.UUID) || string.IsNullOrEmpty(result.Message))
|
if (result == null || string.IsNullOrEmpty(result.UUID) || string.IsNullOrEmpty(result.Message))
|
||||||
{
|
{
|
||||||
if (myConfig.GetLogDebug() == true)
|
if (myConfig.GetLogDebug() == true)
|
||||||
|
|
@ -151,9 +151,8 @@ namespace SecondBotEvents.Services
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ConnectionFactory factory;
|
protected IConnection connection;
|
||||||
IConnection connection;
|
protected Dictionary<string, IChannel> channels = [];
|
||||||
Dictionary<string, IChannel> channels = new Dictionary<string, IChannel>();
|
|
||||||
public override void Start(bool updateEnabled = false, bool setEnabledTo = false)
|
public override void Start(bool updateEnabled = false, bool setEnabledTo = false)
|
||||||
{
|
{
|
||||||
if (updateEnabled == true)
|
if (updateEnabled == true)
|
||||||
|
|
@ -209,7 +208,7 @@ namespace SecondBotEvents.Services
|
||||||
return new KeyValuePair<bool, string>(true, "Message sent to queue " + Qname);
|
return new KeyValuePair<bool, string>(true, "Message sent to queue " + Qname);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void connectService()
|
protected void ConnectService()
|
||||||
{
|
{
|
||||||
if (connection != null && connection.IsOpen == true)
|
if (connection != null && connection.IsOpen == true)
|
||||||
{
|
{
|
||||||
|
|
@ -219,9 +218,11 @@ namespace SecondBotEvents.Services
|
||||||
var endpoints = new System.Collections.Generic.List<AmqpTcpEndpoint> {
|
var endpoints = new System.Collections.Generic.List<AmqpTcpEndpoint> {
|
||||||
new AmqpTcpEndpoint(myConfig.GetHostIP(),myConfig.GetHostPort()),
|
new AmqpTcpEndpoint(myConfig.GetHostIP(),myConfig.GetHostPort()),
|
||||||
};
|
};
|
||||||
ConnectionFactory factory = new ConnectionFactory();
|
ConnectionFactory factory = new ConnectionFactory
|
||||||
factory.UserName = myConfig.GetHostUsername();
|
{
|
||||||
factory.Password = myConfig.GetHostPassword();
|
UserName = myConfig.GetHostUsername(),
|
||||||
|
Password = myConfig.GetHostPassword()
|
||||||
|
};
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
connection = factory.CreateConnectionAsync(endpoints).Await();
|
connection = factory.CreateConnectionAsync(endpoints).Await();
|
||||||
|
|
@ -232,10 +233,10 @@ namespace SecondBotEvents.Services
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
createChannelWorker(myConfig.GetNotecardQueue(), "NotecardMessageEvent");
|
CreateChannelWorker(myConfig.GetNotecardQueue(), "NotecardMessageEvent");
|
||||||
createChannelWorker(myConfig.GetCommandQueue(), "CommandMessageEvent");
|
CreateChannelWorker(myConfig.GetCommandQueue(), "CommandMessageEvent");
|
||||||
createChannelWorker(myConfig.GetImQueue(), "ImMessageEvent");
|
CreateChannelWorker(myConfig.GetImQueue(), "ImMessageEvent");
|
||||||
createChannelWorker(myConfig.GetGroupImQueue(), "GroupMessageEvent");
|
CreateChannelWorker(myConfig.GetGroupImQueue(), "GroupMessageEvent");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
@ -250,7 +251,7 @@ namespace SecondBotEvents.Services
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async void createChannelWorker(string queueName, string functionpointer)
|
protected async void CreateChannelWorker(string queueName, string functionpointer)
|
||||||
{
|
{
|
||||||
IChannel channel = connection.CreateChannelAsync().Await();
|
IChannel channel = connection.CreateChannelAsync().Await();
|
||||||
channels.Add(queueName, channel);
|
channels.Add(queueName, channel);
|
||||||
|
|
@ -299,7 +300,7 @@ namespace SecondBotEvents.Services
|
||||||
}
|
}
|
||||||
LogFormater.Info("Rabbit service [Attached to new client]");
|
LogFormater.Info("Rabbit service [Attached to new client]");
|
||||||
hasSecondbot = true;
|
hasSecondbot = true;
|
||||||
connectService();
|
ConnectService();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Stop()
|
public override void Stop()
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
using Newtonsoft.Json;
|
using System.Text.Json;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using SecondBotEvents.Config;
|
using SecondBotEvents.Config;
|
||||||
using System;
|
using System;
|
||||||
|
|
@ -218,7 +218,7 @@ namespace SecondBotEvents.Services
|
||||||
sourcetype = source,
|
sourcetype = source,
|
||||||
sourceoption = filter
|
sourceoption = filter
|
||||||
};
|
};
|
||||||
string eventMessage = JsonConvert.SerializeObject(a);
|
string eventMessage = JsonSerializer.Serialize(a);
|
||||||
relayEventExtended relayEventExtended = new()
|
relayEventExtended relayEventExtended = new()
|
||||||
{
|
{
|
||||||
source = source,
|
source = source,
|
||||||
|
|
@ -230,7 +230,7 @@ namespace SecondBotEvents.Services
|
||||||
message = message,
|
message = message,
|
||||||
unixtime = SecondbotHelpers.UnixTimeNow().ToString()
|
unixtime = SecondbotHelpers.UnixTimeNow().ToString()
|
||||||
};
|
};
|
||||||
string eventMessageExtended = JsonConvert.SerializeObject(relayEventExtended);
|
string eventMessageExtended = JsonSerializer.Serialize(relayEventExtended);
|
||||||
|
|
||||||
while (loop <= myConfig.GetRelayCount())
|
while (loop <= myConfig.GetRelayCount())
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ namespace SecondBotEvents
|
||||||
return e.Message;
|
return e.Message;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static bool inrange(float current,float min,float max)
|
public static bool InRange(float current,float min,float max)
|
||||||
{
|
{
|
||||||
if(current <= max)
|
if(current <= max)
|
||||||
{
|
{
|
||||||
|
|
@ -81,7 +81,7 @@ namespace SecondBotEvents
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
public static bool inrange(double current, double min, double max)
|
public static bool InRange(double current, double min, double max)
|
||||||
{
|
{
|
||||||
if (current <= max)
|
if (current <= max)
|
||||||
{
|
{
|
||||||
|
|
@ -92,11 +92,11 @@ namespace SecondBotEvents
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
public static bool inbox(float expected, float current, float drift)
|
public static bool Inbox(float expected, float current, float drift)
|
||||||
{
|
{
|
||||||
return distance_check(expected, current, drift, true);
|
return DistanceCheck(expected, current, drift, true);
|
||||||
}
|
}
|
||||||
public static bool distance_check(float expected, float current, float drift, bool current_value)
|
public static bool DistanceCheck(float expected, float current, float drift, bool current_value)
|
||||||
{
|
{
|
||||||
if (current > (expected + drift))
|
if (current > (expected + drift))
|
||||||
{
|
{
|
||||||
|
|
@ -148,7 +148,7 @@ namespace SecondBotEvents
|
||||||
var timeSpan = (DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0));
|
var timeSpan = (DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0));
|
||||||
return (long)timeSpan.TotalSeconds;
|
return (long)timeSpan.TotalSeconds;
|
||||||
}
|
}
|
||||||
public static bool notempty(string V)
|
public static bool NotEmpty(string V)
|
||||||
{
|
{
|
||||||
if (V != null)
|
if (V != null)
|
||||||
{
|
{
|
||||||
|
|
@ -160,7 +160,7 @@ namespace SecondBotEvents
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool isempty(string V)
|
public static bool IsEmpty(string V)
|
||||||
{
|
{
|
||||||
if (V != null)
|
if (V != null)
|
||||||
{
|
{
|
||||||
|
|
@ -172,7 +172,7 @@ namespace SecondBotEvents
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool notempty(string[] V)
|
public static bool NotEmpty(string[] V)
|
||||||
{
|
{
|
||||||
if (V != null)
|
if (V != null)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
using Newtonsoft.Json;
|
using System.Text.Json;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenMetaverse.ImportExport.Collada14;
|
using OpenMetaverse.ImportExport.Collada14;
|
||||||
using System;
|
using System;
|
||||||
|
|
@ -146,7 +146,7 @@ namespace BetterSecondBot.Static
|
||||||
}
|
}
|
||||||
public static string MapFolderInventoryJson(GridClient bot,UUID folder)
|
public static string MapFolderInventoryJson(GridClient bot,UUID folder)
|
||||||
{
|
{
|
||||||
return JsonConvert.SerializeObject(getfolderinventory(bot, folder));
|
return JsonSerializer.Serialize(getfolderinventory(bot, folder));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static KeyValuePair<string,string> MapFolderInventoryHumanReadable(GridClient bot, UUID folder)
|
public static KeyValuePair<string,string> MapFolderInventoryHumanReadable(GridClient bot, UUID folder)
|
||||||
|
|
@ -192,7 +192,7 @@ namespace BetterSecondBot.Static
|
||||||
}
|
}
|
||||||
if (topLevel != null)
|
if (topLevel != null)
|
||||||
{
|
{
|
||||||
return JsonConvert.SerializeObject(DoMapFolderJson(bot, topLevel, subfolders));
|
return JsonSerializer.Serialize(DoMapFolderJson(bot, topLevel, subfolders));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue