Merge branch 'wip' into 1.9

This commit is contained in:
Master Kwoth
2017-11-10 13:38:10 +01:00
10 changed files with 165 additions and 20 deletions

View File

@ -9,5 +9,6 @@ namespace NadekoBot.Core.Services.Database.Repositories
long GetUserCurrency(ulong userId);
bool TryUpdateState(ulong userId, long change);
IEnumerable<Currency> GetTopRichest(int count, int skip);
void RemoveFromMany(List<long> ids);
}
}

View File

@ -33,6 +33,11 @@ namespace NadekoBot.Core.Services.Database.Repositories.Impl
public long GetUserCurrency(ulong userId) =>
GetOrCreate(userId).Amount;
public void RemoveFromMany(List<long> ids)
{
_set.RemoveRange(_set.Where(x => ids.Contains((long)x.UserId)));
}
public bool TryUpdateState(ulong userId, long change)
{
var cur = GetOrCreate(userId);

View File

@ -6,11 +6,14 @@ namespace NadekoBot.Core.Services.Impl
public class BotConfigProvider : IBotConfigProvider
{
private readonly DbService _db;
private readonly IDataCache _cache;
public BotConfig BotConfig { get; private set; }
public BotConfigProvider(DbService db, BotConfig bc)
public BotConfigProvider(DbService db, BotConfig bc, IDataCache cache)
{
_db = db;
_cache = cache;
BotConfig = bc;
}

View File

@ -129,7 +129,7 @@ namespace NadekoBot
{
AllGuildConfigs = uow.GuildConfigs.GetAllGuildConfigs(startingGuildIdList).ToImmutableArray();
IBotConfigProvider botConfigProvider = new BotConfigProvider(_db, _botConfig);
IBotConfigProvider botConfigProvider = new BotConfigProvider(_db, _botConfig, Cache);
//initialize Services
Services = new NServiceProvider()