mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-11 09:48:26 -04:00
Medusa System Added
Read about the medusa system [here](https://nadekobot.readthedocs.io/en/latest/medusa/creating-a-medusa/)
This commit is contained in:
43
src/NadekoBot/Common/Medusa/Config/MedusaConfigService.cs
Normal file
43
src/NadekoBot/Common/Medusa/Config/MedusaConfigService.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
using NadekoBot.Common.Configs;
|
||||
|
||||
namespace Nadeko.Medusa;
|
||||
|
||||
public sealed class MedusaConfigService : ConfigServiceBase<MedusaConfig>, IMedusaConfigService
|
||||
{
|
||||
private const string FILE_PATH = "data/medusae/medusa.yml";
|
||||
private static readonly TypedKey<MedusaConfig> _changeKey = new("config.medusa.updated");
|
||||
|
||||
public override string Name
|
||||
=> "medusa";
|
||||
|
||||
public MedusaConfigService(
|
||||
IConfigSeria serializer,
|
||||
IPubSub pubSub)
|
||||
: base(FILE_PATH, serializer, pubSub, _changeKey)
|
||||
{
|
||||
}
|
||||
|
||||
public IReadOnlyCollection<string> GetLoadedMedusae()
|
||||
=> Data.Loaded.ToList();
|
||||
|
||||
public void AddLoadedMedusa(string name)
|
||||
{
|
||||
name = name.Trim().ToLowerInvariant();
|
||||
|
||||
ModifyConfig(conf =>
|
||||
{
|
||||
if(!conf.Loaded.Contains(name))
|
||||
conf.Loaded.Add(name);
|
||||
});
|
||||
}
|
||||
|
||||
public void RemoveLoadedMedusa(string name)
|
||||
{
|
||||
name = name.Trim().ToLowerInvariant();
|
||||
|
||||
ModifyConfig(conf =>
|
||||
{
|
||||
conf.Loaded.Remove(name);
|
||||
});
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user