mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-10 17:28:27 -04:00
- Bot now sends dm help text ONLY if the message contains one of the keywords specified - If no keywords are specified, bot will reply to every DM (like before) - Fixed several commands which used error color for success confirmation messages
43 lines
1.5 KiB
C#
43 lines
1.5 KiB
C#
using NadekoBot.Common;
|
|
using NadekoBot.Common.Configs;
|
|
using NadekoBot.Services;
|
|
|
|
namespace NadekoBot.Modules.Xp.Services
|
|
{
|
|
public sealed class XpConfigService : ConfigServiceBase<XpConfig>
|
|
{
|
|
public override string Name { get; } = "xp";
|
|
private const string FilePath = "data/xp.yml";
|
|
private static TypedKey<XpConfig> changeKey = new TypedKey<XpConfig>("config.xp.updated");
|
|
|
|
public XpConfigService(IConfigSeria serializer, IPubSub pubSub)
|
|
: base(FilePath, serializer, pubSub, changeKey)
|
|
{
|
|
AddParsedProp("txt.cooldown", conf => conf.MessageXpCooldown, int.TryParse,
|
|
ConfigPrinters.ToString, x => x > 0);
|
|
AddParsedProp("txt.per_msg", conf => conf.XpPerMessage, int.TryParse,
|
|
ConfigPrinters.ToString, x => x >= 0);
|
|
AddParsedProp("txt.per_image", conf => conf.XpFromImage, int.TryParse,
|
|
ConfigPrinters.ToString, x => x > 0);
|
|
|
|
AddParsedProp("voice.per_minute", conf => conf.VoiceXpPerMinute, double.TryParse,
|
|
ConfigPrinters.ToString, x => x >= 0);
|
|
AddParsedProp("voice.max_minutes", conf => conf.VoiceMaxMinutes, int.TryParse,
|
|
ConfigPrinters.ToString, x => x > 0);
|
|
|
|
Migrate();
|
|
}
|
|
|
|
private void Migrate()
|
|
{
|
|
if (_data.Version < 2)
|
|
{
|
|
ModifyConfig(c =>
|
|
{
|
|
c.Version = 2;
|
|
c.XpFromImage = 0;
|
|
});
|
|
}
|
|
}
|
|
}
|
|
} |