mirror of
https://github.com/barelyprofessional/KfChatDotNet.git
synced 2026-05-02 04:22:04 -04:00
New setting to control the initial state of the almanac shill
This commit is contained in:
@@ -245,6 +245,12 @@ public class BotServices
|
|||||||
private async Task BuildAlmanacShill()
|
private async Task BuildAlmanacShill()
|
||||||
{
|
{
|
||||||
AlmanacShill = new AlmanacShill(_chatBot);
|
AlmanacShill = new AlmanacShill(_chatBot);
|
||||||
|
var initialState = await Helpers.GetValue(BuiltIn.Keys.BotAlmanacInitialState);
|
||||||
|
if (!initialState.ToBoolean())
|
||||||
|
{
|
||||||
|
_logger.Info("Built the almanac service but not enabling as initial state is false");
|
||||||
|
return;
|
||||||
|
}
|
||||||
AlmanacShill.StartShillTask();
|
AlmanacShill.StartShillTask();
|
||||||
_logger.Info("Built the almanac shill task");
|
_logger.Info("Built the almanac shill task");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -910,6 +910,16 @@ public static class BuiltIn
|
|||||||
IsSecret = false,
|
IsSecret = false,
|
||||||
CacheDuration = TimeSpan.FromHours(1),
|
CacheDuration = TimeSpan.FromHours(1),
|
||||||
ValueType = SettingValueType.Text
|
ValueType = SettingValueType.Text
|
||||||
|
},
|
||||||
|
new BuiltInSettingsModel
|
||||||
|
{
|
||||||
|
Key = Keys.BotAlmanacInitialState,
|
||||||
|
Regex = "(true|false)",
|
||||||
|
Description = "Initial state of the Almanac reminder",
|
||||||
|
Default = "false",
|
||||||
|
IsSecret = false,
|
||||||
|
CacheDuration = TimeSpan.FromHours(1),
|
||||||
|
ValueType = SettingValueType.Boolean
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -986,5 +996,6 @@ public static class BuiltIn
|
|||||||
public static string ClashggBmjIds = "Clashgg.BmjIds";
|
public static string ClashggBmjIds = "Clashgg.BmjIds";
|
||||||
public static string BotAlmanacText = "Bot.Almanac.Text";
|
public static string BotAlmanacText = "Bot.Almanac.Text";
|
||||||
public static string BotAlmanacInterval = "Bot.Almanac.Interval";
|
public static string BotAlmanacInterval = "Bot.Almanac.Interval";
|
||||||
|
public static string BotAlmanacInitialState = "Bot.Almanac.InitialState";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user