mirror of
https://github.com/tribufu/ServerManagers
synced 2026-05-06 15:17:34 +00:00
Changed whitelist to its own type
This commit is contained in:
parent
8c1908310e
commit
a74bc2dc78
5 changed files with 12 additions and 5 deletions
|
|
@ -623,7 +623,7 @@ namespace ServerManagerTool
|
|||
};
|
||||
if (Config.Default.DiscordBotWhitelist != null)
|
||||
{
|
||||
config.DiscordBotWhitelists = Config.Default.DiscordBotWhitelist.Cast<string>();
|
||||
config.DiscordBotWhitelist.AddRange(Config.Default.DiscordBotWhitelist.Cast<string>());
|
||||
}
|
||||
|
||||
await ServerManagerBotFactory.GetServerManagerBot().RunAsync(config, DiscordBotHelper.HandleDiscordCommand, DiscordBotHelper.HandleTranslation, _tokenSourceDiscordBot.Token);
|
||||
|
|
|
|||
|
|
@ -612,7 +612,7 @@ namespace ServerManagerTool
|
|||
};
|
||||
if (Config.Default.DiscordBotWhitelist != null)
|
||||
{
|
||||
config.DiscordBotWhitelists = Config.Default.DiscordBotWhitelist.Cast<string>();
|
||||
config.DiscordBotWhitelist.AddRange(Config.Default.DiscordBotWhitelist.Cast<string>());
|
||||
}
|
||||
|
||||
await ServerManagerBotFactory.GetServerManagerBot().RunAsync(config, DiscordBotHelper.HandleDiscordCommand, DiscordBotHelper.HandleTranslation, _tokenSourceDiscordBot.Token);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using ServerManagerTool.DiscordBot.Enums;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ServerManagerTool.DiscordBot.Models
|
||||
{
|
||||
|
|
@ -19,6 +18,6 @@ namespace ServerManagerTool.DiscordBot.Models
|
|||
|
||||
public bool AllowAllBots { get; set; } = false;
|
||||
|
||||
public IEnumerable<string> DiscordBotWhitelists { get; set; } = new List<string>();
|
||||
public DiscordBotWhitelist DiscordBotWhitelist { get; set; } = new DiscordBotWhitelist();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
8
src/ServerManager.Discord/Models/DiscordBotWhitelist.cs
Normal file
8
src/ServerManager.Discord/Models/DiscordBotWhitelist.cs
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace ServerManagerTool.DiscordBot.Models
|
||||
{
|
||||
public class DiscordBotWhitelist : List<string>
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
@ -84,7 +84,7 @@ namespace ServerManagerTool.DiscordBot.Services
|
|||
if (LogLevelHelper.CheckLogLevel(LogLevel.Debug, _botConfig.LogLevel))
|
||||
await _logger?.OnLogAsync(new LogMessage(LogSeverity.Debug, MessageSource.System.ToString(), $"Message has come from another bot, checking if bot is in the whitelist."));
|
||||
|
||||
if (!_botConfig.DiscordBotWhitelists.Any(botId => botId.Equals(msg.Author.Id.ToString())))
|
||||
if (!_botConfig.DiscordBotWhitelist.Any(botId => botId.Equals(msg.Author.Id.ToString())))
|
||||
{
|
||||
if (LogLevelHelper.CheckLogLevel(LogLevel.Debug, _botConfig.LogLevel))
|
||||
await _logger?.OnLogAsync(new LogMessage(LogSeverity.Debug, MessageSource.System.ToString(), $"Message has come from another bot, bot is not in the whitelist, message will be ignored."));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue