diff --git a/SecondBotEvents/Commands/Services.cs b/SecondBotEvents/Commands/Services.cs
index 7429e3c..884b3fe 100644
--- a/SecondBotEvents/Commands/Services.cs
+++ b/SecondBotEvents/Commands/Services.cs
@@ -17,14 +17,17 @@ namespace SecondBotEvents.Commands
"EventsService
" +
"DialogService
" +
"TriggerOnEventService
" +
- "RelayService")]
+ "RelayService
" +
+ "ChatGptService")]
public class Services : CommandsAPI
{
public Services(EventsSecondBot setmaster) : base(setmaster)
{
}
- protected List controlable = new List { "BotClientService","RLVService",
+ protected List controlable = new List {
+ "BotClientService",
+ "RLVService",
"HttpService",
"DiscordService",
"InteractionService",
@@ -32,7 +35,9 @@ namespace SecondBotEvents.Commands
"EventsService",
"DialogService",
"TriggerOnEventService",
- "RelayService"};
+ "RelayService",
+ "ChatGptService"
+ };
[About("Marks a service as enabled and starts it")]
[ReturnHints("ok")]
diff --git a/SecondBotEvents/Services/ChatGptService.cs b/SecondBotEvents/Services/ChatGptService.cs
index 1a25c07..36cd5c8 100644
--- a/SecondBotEvents/Services/ChatGptService.cs
+++ b/SecondBotEvents/Services/ChatGptService.cs
@@ -47,6 +47,7 @@ namespace SecondBotEvents.Services
}
if (myConfig.GetEnabled() == false)
{
+ Stop();
return;
}
chatHistorySize = inrange(3,10,myConfig.GetChatHistoryMessages());
@@ -66,7 +67,27 @@ namespace SecondBotEvents.Services
public override void Stop()
{
- running = false;
+ if (running == true)
+ {
+ running = false;
+ LogFormater.Info("ChatGpt [Stopping]");
+ if (master != null)
+ {
+ master.BotClientNoticeEvent -= BotClientRestart;
+ }
+ if (GetClient() != null)
+ {
+ if (GetClient().Network != null)
+ {
+ GetClient().Network.SimConnected -= BotLoggedIn;
+ }
+ if (GetClient().Self != null)
+ {
+ GetClient().Self.IM -= BotImMessage;
+ GetClient().Self.ChatFromSimulator -= BotLocalchat;
+ }
+ }
+ }
}
public override string Status()