SecondBot/SecondBotEvents/Config/DataStoreConfig.cs
Madpeter c00a11a99d Add inventory prefetching support
Introduces configuration options and logic for prefetching inventory folders on startup, including depth control. Updates Dockerfile and DataStoreConfig to support new settings, and modifies DataStoreService to handle inventory preloading asynchronously.
2025-10-02 11:22:19 +01:00

98 lines
No EOL
2.9 KiB
C#

using System;
using System.Collections.Generic;
using System.Text;
namespace SecondBotEvents.Config
{
public class DataStoreConfig(bool fromENV, string fromFolder = "") : Config(fromENV, fromFolder)
{
protected override void MakeSettings()
{
filename = "datastore";
settings.Add("AutoCleanAvatars");
settings.Add("AvatarsCleanAfterMins");
settings.Add("LocalChatHistoryLimit");
settings.Add("GroupChatHistoryLimitPerGroup");
settings.Add("ImChatHistoryLimit");
settings.Add("PrefetchGroupMembers");
settings.Add("PrefetchGroupRoles");
settings.Add("PrefetchEstateBanlist");
settings.Add("PrefetchAvatarDisplaynames");
settings.Add("PrefetchInventory");
settings.Add("PrefetchInventoryDepth");
settings.Add("AutoCleanKeyValueStore");
settings.Add("CleanKeyValueStoreAfterMins");
settings.Add("CommandHistoryLimit");
settings.Add("HideStatusOutput");
}
public int GetPrefetchInventoryDepth()
{
return ReadSettingAsInt("PrefetchInventoryDepth", 2);
}
public bool GetPrefetchInventory()
{
return ReadSettingAsBool("PrefetchInventory", false);
}
public bool GetPrefetchAvatarDisplaynames()
{
return ReadSettingAsBool("PrefetchAvatarDisplaynames", true);
}
public int GetCommandHistoryLimit()
{
return ReadSettingAsInt("CommandHistoryLimit", 30);
}
public bool GetAutoCleanKeyValueStore()
{
return ReadSettingAsBool("AutoCleanKeyValueStore", true);
}
public int GetCleanKeyValueStoreAfterMins()
{
return ReadSettingAsInt("CleanKeyValueStoreAfterMins", 10);
}
public bool GetPrefetchEstateBanlist()
{
return ReadSettingAsBool("PrefetchEstateBanlist", true);
}
public bool GetPrefetchGroupRoles()
{
return ReadSettingAsBool("PrefetchGroupRoles", false);
}
public bool GetPrefetchGroupMembers()
{
return ReadSettingAsBool("PrefetchGroupMembers", true);
}
public bool GetAutoCleanAvatars()
{
return ReadSettingAsBool("AutoCleanAvatars", true);
}
public int GetAvatarsCleanAfterMins()
{
return ReadSettingAsInt("AvatarsCleanAfterMins", 10);
}
public int GetLocalChatHistoryLimit()
{
return ReadSettingAsInt("LocalChatHistoryLimit", 150);
}
public int GetGroupChatHistoryLimitPerGroup()
{
return ReadSettingAsInt("GroupChatHistoryLimitPerGroup", 50);
}
public int GetImChatHistoryLimit()
{
return ReadSettingAsInt("ImChatHistoryLimit", 50);
}
}
}