add configurable command and broadcast command prefix for issue #149
This commit is contained in:
@ -66,6 +66,12 @@ namespace SharedLibraryCore.Configuration
|
||||
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_CUSTOM_LOCALE")]
|
||||
public string CustomLocale { get; set; }
|
||||
|
||||
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_COMMAND_PREFIX")]
|
||||
public string CommandPrefix { get; set; } = "!";
|
||||
|
||||
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_BROADCAST_COMMAND_PREFIX")]
|
||||
public string BroadcastCommandPrefix { get; set; } = "@";
|
||||
|
||||
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_DB_PROVIDER")]
|
||||
public string DatabaseProvider { get; set; } = "sqlite";
|
||||
[ConfigurationOptional]
|
||||
|
@ -1,6 +1,7 @@
|
||||
using SharedLibraryCore.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace SharedLibraryCore.Configuration
|
||||
{
|
||||
@ -14,6 +15,18 @@ namespace SharedLibraryCore.Configuration
|
||||
/// </summary>
|
||||
public Dictionary<string, CommandProperties> Commands { get; set; } = new Dictionary<string, CommandProperties>();
|
||||
|
||||
/// <summary>
|
||||
/// prefix indicated the chat message is a command
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public string CommandPrefix { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// prefix indicating that the chat message is a broadcast command
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public string BroadcastCommandPrefix { get; set; }
|
||||
|
||||
public IBaseConfiguration Generate()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
@ -64,13 +64,19 @@ namespace SharedLibraryCore.Configuration.Validation
|
||||
RuleFor(_app => _app.GlobalRules)
|
||||
.NotNull();
|
||||
|
||||
RuleForEach(_app => _app.Servers)
|
||||
.NotEmpty()
|
||||
.SetValidator(new ServerConfigurationValidator());
|
||||
|
||||
RuleFor(_app => _app.MasterUrl)
|
||||
.NotNull()
|
||||
.Must(_url => _url != null && _url.Scheme == Uri.UriSchemeHttp);
|
||||
|
||||
RuleFor(_app => _app.CommandPrefix)
|
||||
.NotEmpty();
|
||||
|
||||
RuleFor(_app => _app.BroadcastCommandPrefix)
|
||||
.NotEmpty();
|
||||
|
||||
RuleForEach(_app => _app.Servers)
|
||||
.NotEmpty()
|
||||
.SetValidator(new ServerConfigurationValidator());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user