Cleanup, .clparew can now be ran everyone, modules load appropriate guild configs, IEnumerable<GuildConfig> replaces with NadekoBot.AllGuildConfigs
This commit is contained in:
@ -28,11 +28,11 @@ namespace NadekoBot.Services.Impl
|
||||
}
|
||||
|
||||
private Localization() { }
|
||||
public Localization(IBotConfigProvider bcp, IEnumerable<GuildConfig> gcs, DbService db)
|
||||
public Localization(IBotConfigProvider bcp, NadekoBot bot, DbService db)
|
||||
{
|
||||
_log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
var cultureInfoNames = gcs.ToDictionary(x => x.GuildId, x => x.Locale);
|
||||
var cultureInfoNames = bot.AllGuildConfigs.ToDictionary(x => x.GuildId, x => x.Locale);
|
||||
var defaultCulture = bcp.BotConfig.Locale;
|
||||
|
||||
_db = db;
|
||||
@ -123,8 +123,7 @@ namespace NadekoBot.Services.Impl
|
||||
{
|
||||
if (guildId == null)
|
||||
return DefaultCultureInfo;
|
||||
CultureInfo info = null;
|
||||
GuildCultureInfos.TryGetValue(guildId.Value, out info);
|
||||
GuildCultureInfos.TryGetValue(guildId.Value, out CultureInfo info);
|
||||
return info ?? DefaultCultureInfo;
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,6 @@ namespace NadekoBot.Services.Impl
|
||||
|
||||
private readonly Timer _carbonitexTimer;
|
||||
private readonly Timer _dataTimer;
|
||||
private readonly ShardsCoordinator _sc;
|
||||
private readonly ConnectionMultiplexer _redis;
|
||||
|
||||
public StatsService(DiscordSocketClient client, CommandHandler cmdHandler,
|
||||
@ -51,7 +50,6 @@ namespace NadekoBot.Services.Impl
|
||||
{
|
||||
_client = client;
|
||||
_creds = creds;
|
||||
_sc = nadeko.ShardCoord;
|
||||
_redis = cache.Redis;
|
||||
|
||||
_started = DateTime.UtcNow;
|
||||
@ -134,7 +132,7 @@ namespace NadekoBot.Services.Impl
|
||||
return Task.CompletedTask;
|
||||
};
|
||||
|
||||
if (_sc != null)
|
||||
if (_client.ShardId == 0)
|
||||
{
|
||||
_carbonitexTimer = new Timer(async (state) =>
|
||||
{
|
||||
|
Reference in New Issue
Block a user