adds support to control ChatGptService via the commands service
This commit is contained in:
parent
28a743ebc0
commit
dff8897804
2 changed files with 30 additions and 4 deletions
|
|
@ -17,14 +17,17 @@ namespace SecondBotEvents.Commands
|
||||||
"EventsService<br/>" +
|
"EventsService<br/>" +
|
||||||
"DialogService<br/>" +
|
"DialogService<br/>" +
|
||||||
"TriggerOnEventService<br/>" +
|
"TriggerOnEventService<br/>" +
|
||||||
"RelayService")]
|
"RelayService<br/>" +
|
||||||
|
"ChatGptService")]
|
||||||
public class Services : CommandsAPI
|
public class Services : CommandsAPI
|
||||||
{
|
{
|
||||||
public Services(EventsSecondBot setmaster) : base(setmaster)
|
public Services(EventsSecondBot setmaster) : base(setmaster)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected List<string> controlable = new List<string> { "BotClientService","RLVService",
|
protected List<string> controlable = new List<string> {
|
||||||
|
"BotClientService",
|
||||||
|
"RLVService",
|
||||||
"HttpService",
|
"HttpService",
|
||||||
"DiscordService",
|
"DiscordService",
|
||||||
"InteractionService",
|
"InteractionService",
|
||||||
|
|
@ -32,7 +35,9 @@ namespace SecondBotEvents.Commands
|
||||||
"EventsService",
|
"EventsService",
|
||||||
"DialogService",
|
"DialogService",
|
||||||
"TriggerOnEventService",
|
"TriggerOnEventService",
|
||||||
"RelayService"};
|
"RelayService",
|
||||||
|
"ChatGptService"
|
||||||
|
};
|
||||||
|
|
||||||
[About("Marks a service as enabled and starts it")]
|
[About("Marks a service as enabled and starts it")]
|
||||||
[ReturnHints("ok")]
|
[ReturnHints("ok")]
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,7 @@ namespace SecondBotEvents.Services
|
||||||
}
|
}
|
||||||
if (myConfig.GetEnabled() == false)
|
if (myConfig.GetEnabled() == false)
|
||||||
{
|
{
|
||||||
|
Stop();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
chatHistorySize = inrange(3,10,myConfig.GetChatHistoryMessages());
|
chatHistorySize = inrange(3,10,myConfig.GetChatHistoryMessages());
|
||||||
|
|
@ -66,7 +67,27 @@ namespace SecondBotEvents.Services
|
||||||
|
|
||||||
public override void Stop()
|
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()
|
public override string Status()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue