diff --git a/BetterSecondBot.sln b/BetterSecondBot.sln index d3c0189..fcdd3f4 100644 --- a/BetterSecondBot.sln +++ b/BetterSecondBot.sln @@ -11,8 +11,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Project Items", "Project It .gitignore = .gitignore SecondBotEvents\Dockerfile = SecondBotEvents\Dockerfile NuGet.Config = NuGet.Config + oldDockerfile = oldDockerfile README.md = README.md - oldDockerfile. = oldDockerfile. + SecondBotEvents\settings.env = SecondBotEvents\settings.env EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SecondBotEvents", "SecondBotEvents\SecondBotEvents.csproj", "{571AB1AF-4C74-4C37-AC5B-9B63383AC791}" diff --git a/LibreMetaverse/NetworkManager.cs b/LibreMetaverse/NetworkManager.cs index c182693..502e915 100644 --- a/LibreMetaverse/NetworkManager.cs +++ b/LibreMetaverse/NetworkManager.cs @@ -892,9 +892,14 @@ namespace OpenMetaverse OnSimDisconnected(new SimDisconnectedEventArgs(CurrentSim, type)); } } - - _packetInbox.Writer.Complete(); - _packetOutbox.Writer.Complete(); + if (_packetInbox != null) + { + _packetInbox.Writer.Complete(); + } + if (_packetOutbox != null) + { + _packetOutbox.Writer.Complete(); + } _packetInbox = null; _packetOutbox = null; diff --git a/SecondBotEvents/Dockerfile b/SecondBotEvents/Dockerfile index 265a34e..46e7588 100644 --- a/SecondBotEvents/Dockerfile +++ b/SecondBotEvents/Dockerfile @@ -32,6 +32,7 @@ ENV basic_Username = 'SecondbotR5' \ commands_MastersCSV = 'Madpeter Zond' \ commands_EnforceTimeWindow = 'false' \ commands_TimeWindowSecs = 35 \ + commands_Enabled='true' \ datastore_AutoCleanAvatars = 'true' \ datastore_AvatarsCleanAfterMins = 10 \ datastore_LocalChatHistoryLimit = 120 \ @@ -72,13 +73,13 @@ ENV basic_Username = 'SecondbotR5' \ homebound_AtHomeAutoSitUuid = '00000000-0000-0000-0000-000000000000' \ http_Enabled = 'false' \ http_Port = 80 \ - Enabled = 'true' \ - AcceptTeleports = 'false' \ - AcceptGroupInvites = 'false' \ - AcceptInventory = 'false' \ - AcceptFriendRequests = 'false' \ - EnableJsonOutputEvents = 'false' \ - JsonOutputEventsTarget = 'none' + interaction_Enabled = 'true' \ + interaction_AcceptTeleports = 'false' \ + interaction_AcceptGroupInvites = 'false' \ + interaction_AcceptInventory = 'false' \ + interaction_AcceptFriendRequests = 'false' \ + interaction_EnableJsonOutputEvents = 'false' \ + interaction_JsonOutputEventsTarget = 'none' EXPOSE 80 ENV ASPNETCORE_URLS http://+:80 diff --git a/SecondBotEvents/Services/BotClientService.cs b/SecondBotEvents/Services/BotClientService.cs index 93a7f6e..ed8d140 100644 --- a/SecondBotEvents/Services/BotClientService.cs +++ b/SecondBotEvents/Services/BotClientService.cs @@ -45,9 +45,12 @@ namespace SecondBotEvents.Services } public override void Stop() { + if(running == true) + { + Console.WriteLine("Client service [Stopping]"); + } running = false; AutoRestartLoginTimer.Stop(); - Console.WriteLine("Client service [Stopping]"); ResetClient(); } diff --git a/SecondBotEvents/Services/CommandsService.cs b/SecondBotEvents/Services/CommandsService.cs index a202429..c452d7c 100644 --- a/SecondBotEvents/Services/CommandsService.cs +++ b/SecondBotEvents/Services/CommandsService.cs @@ -275,7 +275,7 @@ namespace SecondBotEvents.Services return new KeyValuePair(false, "Unknown command"); } C.command = commandnameLowerToReal[lowerName]; - if(master.CustomCommandsService.HasCommand(C.command) == false) + if(master.CustomCommandsService.HasCommand(C.command) == true) { if(inCustomCommand == true) { diff --git a/SecondBotEvents/Services/DataStoreService.cs b/SecondBotEvents/Services/DataStoreService.cs index 5b659c1..021b0f5 100644 --- a/SecondBotEvents/Services/DataStoreService.cs +++ b/SecondBotEvents/Services/DataStoreService.cs @@ -1050,6 +1050,10 @@ namespace SecondBotEvents.Services public override void Stop() { + if(running == true) + { + Console.WriteLine("DataStore Service [Stopping]"); + } running = false; Reset(); master.BotClientNoticeEvent -= BotClientRestart; @@ -1070,7 +1074,7 @@ namespace SecondBotEvents.Services GetClient().Estate.EstateBansReply -= EstateBans; } } - Console.WriteLine("DataStore Service [Stopping]"); + } } diff --git a/SecondBotEvents/Services/DiscordService.cs b/SecondBotEvents/Services/DiscordService.cs index 2996c9a..ff375f4 100644 --- a/SecondBotEvents/Services/DiscordService.cs +++ b/SecondBotEvents/Services/DiscordService.cs @@ -432,8 +432,12 @@ namespace SecondBotEvents.Services public override void Stop() { + if(running == true) + { + Console.WriteLine("Discord service [Stopping]"); + } running = false; - Console.WriteLine("Discord service [Stopping]"); + master.BotClientNoticeEvent -= BotClientRestart; master.SystemStatusMessagesEvent -= SystemStatusEvent; AcceptEventsFromSL = false; diff --git a/SecondBotEvents/Services/HomeboundService.cs b/SecondBotEvents/Services/HomeboundService.cs index 0702de8..d74fa5c 100644 --- a/SecondBotEvents/Services/HomeboundService.cs +++ b/SecondBotEvents/Services/HomeboundService.cs @@ -286,6 +286,10 @@ namespace SecondBotEvents.Services public override void Stop() { + if(running == true) + { + Console.WriteLine("Homebound Service [Stopping]"); + } running = false; master.BotClientNoticeEvent -= BotClientRestart; if (master.BotClient != null) @@ -297,7 +301,7 @@ namespace SecondBotEvents.Services GetClient().Network.SimChanged -= BotChangedSim; } } - Console.WriteLine("Homebound Service [Stopping]"); + } } diff --git a/SecondBotEvents/Services/HttpService.cs b/SecondBotEvents/Services/HttpService.cs index 6b8f35f..bc5c795 100644 --- a/SecondBotEvents/Services/HttpService.cs +++ b/SecondBotEvents/Services/HttpService.cs @@ -90,6 +90,10 @@ namespace SecondBotEvents.Services public override void Stop() { + if(running == true) + { + Console.WriteLine("HTTP service [Stopping]"); + } running = false; if (myConfig.GetEnabled() == false) { @@ -100,7 +104,7 @@ namespace SecondBotEvents.Services { HTTPendpoint.Dispose(); HTTPendpoint = null; - Console.WriteLine("HTTP service [Stopping]"); + } } diff --git a/SecondBotEvents/Services/InteractionService.cs b/SecondBotEvents/Services/InteractionService.cs index 437fab1..80faecd 100644 --- a/SecondBotEvents/Services/InteractionService.cs +++ b/SecondBotEvents/Services/InteractionService.cs @@ -197,6 +197,10 @@ namespace SecondBotEvents.Services public override void Stop() { + if(running == true) + { + Console.WriteLine("Interaction Service [Stopping]"); + } running = false; if (myConfig.GetEnabled() == false) { @@ -212,7 +216,7 @@ namespace SecondBotEvents.Services GetClient().Groups.GroupInvitation -= BotGroupInviteOffer; } } - Console.WriteLine("Interaction Service [Stopping]"); + } } diff --git a/SecondBotEvents/Services/RelayService.cs b/SecondBotEvents/Services/RelayService.cs index 0cfa83e..5dddf60 100644 --- a/SecondBotEvents/Services/RelayService.cs +++ b/SecondBotEvents/Services/RelayService.cs @@ -137,6 +137,10 @@ namespace SecondBotEvents.Services public override void Stop() { + if(running == true) + { + Console.WriteLine("Relay Service [Stopping]"); + } running = false; master.BotClientNoticeEvent -= BotClientRestart; if (master.BotClient != null) @@ -146,7 +150,7 @@ namespace SecondBotEvents.Services } } - Console.WriteLine("Relay Service [Stopping]"); + } }