- Removed static color fields

- Removed unused code
- BanTemplate will get error color from bot config
This commit is contained in:
Kwoth
2021-07-12 21:10:39 +02:00
parent 0e81f2abf4
commit 71da4d11c0
5 changed files with 6 additions and 48 deletions

View File

@@ -35,11 +35,6 @@ namespace NadekoBot
public DiscordSocketClient Client { get; } public DiscordSocketClient Client { get; }
public ImmutableArray<GuildConfig> AllGuildConfigs { get; private set; } public ImmutableArray<GuildConfig> AllGuildConfigs { get; private set; }
// todo remove colors from here
public static Color OkColor { get; set; }
public static Color ErrorColor { get; set; }
public static Color PendingColor { get; set; }
private IServiceProvider Services { get; set; } private IServiceProvider Services { get; set; }
public string Mention { get; private set; } public string Mention { get; private set; }

View File

@@ -1,6 +1,5 @@
using Discord; using Discord;
// todo test guild colors
namespace NadekoBot namespace NadekoBot
{ {
public interface IEmbedBuilder public interface IEmbedBuilder

View File

@@ -25,13 +25,15 @@ namespace NadekoBot.Modules.Administration.Services
private readonly MuteService _mute; private readonly MuteService _mute;
private readonly DbService _db; private readonly DbService _db;
private readonly BlacklistService _blacklistService; private readonly BlacklistService _blacklistService;
private readonly BotConfigService _bcs;
private readonly Timer _warnExpiryTimer; private readonly Timer _warnExpiryTimer;
public UserPunishService(MuteService mute, DbService db, BlacklistService blacklistService) public UserPunishService(MuteService mute, DbService db, BlacklistService blacklistService, BotConfigService bcs)
{ {
_mute = mute; _mute = mute;
_db = db; _db = db;
_blacklistService = blacklistService; _blacklistService = blacklistService;
_bcs = bcs;
_warnExpiryTimer = new Timer(async _ => _warnExpiryTimer = new Timer(async _ =>
{ {
@@ -455,7 +457,7 @@ WHERE GuildId={guildId}
{ {
template = JsonConvert.SerializeObject(new template = JsonConvert.SerializeObject(new
{ {
color = Bot.ErrorColor.RawValue, color = _bcs.Data.Color.Error,
description = defaultMessage description = defaultMessage
}); });
} }
@@ -470,7 +472,7 @@ WHERE GuildId={guildId}
{ {
template = JsonConvert.SerializeObject(new template = JsonConvert.SerializeObject(new
{ {
color = Bot.ErrorColor.RawValue, color = _bcs.Data.Color.Error,
description = template description = template
}); });
} }

View File

@@ -36,10 +36,6 @@ namespace NadekoBot.Services
var ok = _data.Color.Ok; var ok = _data.Color.Ok;
var error = _data.Color.Error; var error = _data.Color.Error;
var pend = _data.Color.Pending; var pend = _data.Color.Pending;
// todo future remove these static props once cleanup is done
Bot.OkColor = new Color(ok.R, ok.G, ok.B);
Bot.ErrorColor = new Color(error.R, error.G, error.B);
Bot.PendingColor = new Color(pend.R, pend.G, pend.B);
} }
protected override void OnStateUpdate() protected override void OnStateUpdate()

View File

@@ -185,39 +185,5 @@ namespace NadekoBot.Extensions
public static Task WarningAsync(this ICommandContext ctx) public static Task WarningAsync(this ICommandContext ctx)
=> ctx.Message.AddReactionAsync(new Emoji("⚠️")); => ctx.Message.AddReactionAsync(new Emoji("⚠️"));
// todo fix extensions
// public static Task<IUserMessage> EditAsync(this IUserMessage message, SmartText text)
// {
// switch (text)
// {
// case SmartEmbedText set: return message.ModifyAsync(set.PlainText ?? "", set.GetEmbed());
// case SmartPlainText spt: return message.EditAsync(spt.Text);
// default:
// throw new ArgumentException(nameof(text));
// }
// }
//
// public static Task<IUserMessage> SendAsync(this IUser user, SmartText text)
// {
// switch (text)
// {
// case SmartEmbedText set: return user.SendAsync(set.PlainText ?? "", set.GetEmbed());
// case SmartPlainText spt: return user.SendAsync(spt.Text);
// default:
// throw new ArgumentException(nameof(text));
// }
// }
//
// public static Task<IUserMessage> SendAsync(this ITextChannel channel, SmartText text)
// {
// switch (text)
// {
// case SmartEmbedText set: return channel.SendAsync(set.PlainText ?? "", embed: set.GetEmbed());
// case SmartPlainText spt: return channel.SendAsync(spt.Text);
// default:
// throw new ArgumentException(nameof(text));
// }
// }
} }
} }