Much better startup time on shared bot
This commit is contained in:
@@ -36,7 +36,7 @@ namespace NadekoBot.Modules.Administration
|
||||
{
|
||||
using (var uow = DbHandler.UnitOfWork())
|
||||
{
|
||||
var configs = uow.GuildConfigs.GetAll();
|
||||
var configs = NadekoBot.AllGuildConfigs;
|
||||
GuildMuteRoles = new ConcurrentDictionary<ulong, string>(configs
|
||||
.Where(c=>!string.IsNullOrWhiteSpace(c.MuteRoleName))
|
||||
.ToDictionary(c => c.GuildId, c => c.MuteRoleName));
|
||||
|
@@ -41,8 +41,7 @@ namespace NadekoBot.Modules.Administration
|
||||
|
||||
using (var uow = DbHandler.UnitOfWork())
|
||||
{
|
||||
GuildLogSettings = new ConcurrentDictionary<ulong, LogSetting>(uow.GuildConfigs
|
||||
.GetAll()
|
||||
GuildLogSettings = new ConcurrentDictionary<ulong, LogSetting>(NadekoBot.AllGuildConfigs
|
||||
.ToDictionary(g => g.GuildId, g => g.LogSetting));
|
||||
}
|
||||
|
||||
|
@@ -25,7 +25,7 @@ namespace NadekoBot.Modules.Administration
|
||||
{
|
||||
using (var uow = DbHandler.UnitOfWork())
|
||||
{
|
||||
voicePlusTextCache = new ConcurrentHashSet<ulong>(uow.GuildConfigs.GetAll().Where(g => g.VoicePlusTextEnabled).Select(g => g.GuildId));
|
||||
voicePlusTextCache = new ConcurrentHashSet<ulong>(NadekoBot.AllGuildConfigs.Where(g => g.VoicePlusTextEnabled).Select(g => g.GuildId));
|
||||
}
|
||||
NadekoBot.Client.UserVoiceStateUpdated += UserUpdatedEventHandler;
|
||||
}
|
||||
|
@@ -54,7 +54,7 @@ namespace NadekoBot.Modules.Games
|
||||
{
|
||||
var conf = uow.BotConfig.GetOrCreate();
|
||||
var x =
|
||||
generationChannels = new ConcurrentHashSet<ulong>(uow.GuildConfigs.GetAll()
|
||||
generationChannels = new ConcurrentHashSet<ulong>(NadekoBot.AllGuildConfigs
|
||||
.SelectMany(c => c.GenerateCurrencyChannelIds.Select(obj=>obj.ChannelId)));
|
||||
chance = conf.CurrencyGenerationChance;
|
||||
cooldown = conf.CurrencyGenerationCooldown;
|
||||
|
@@ -33,7 +33,7 @@ namespace NadekoBot.Modules.Permissions
|
||||
{
|
||||
using (var uow = DbHandler.UnitOfWork())
|
||||
{
|
||||
var configs = uow.GuildConfigs.GetAll();
|
||||
var configs = NadekoBot.AllGuildConfigs;
|
||||
commandCooldowns = new ConcurrentDictionary<ulong, ConcurrentHashSet<CommandCooldown>>(configs.ToDictionary(k => k.GuildId, v => new ConcurrentHashSet<CommandCooldown>(v.CommandCooldowns)));
|
||||
}
|
||||
}
|
||||
|
@@ -46,7 +46,7 @@ namespace NadekoBot.Modules.Permissions
|
||||
{
|
||||
using (var uow = DbHandler.UnitOfWork())
|
||||
{
|
||||
var guildConfigs = uow.GuildConfigs.GetAll();
|
||||
var guildConfigs = NadekoBot.AllGuildConfigs;
|
||||
|
||||
InviteFilteringServers = new ConcurrentHashSet<ulong>(guildConfigs.Where(gc => gc.FilterInvites).Select(gc => gc.GuildId));
|
||||
InviteFilteringChannels = new ConcurrentHashSet<ulong>(guildConfigs.SelectMany(gc => gc.FilterInvitesChannelIds.Select(fci => fci.ChannelId)));
|
||||
|
Reference in New Issue
Block a user