public nadeko stuff

This commit is contained in:
Master Kwoth
2017-10-31 09:52:46 +01:00
parent 0eab51cfea
commit e604bbca50
7 changed files with 78 additions and 17 deletions

View File

@ -1,4 +1,6 @@
using System;

#if !GLOBAL_NADEKO
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
@ -15,7 +17,6 @@ using NLog;
namespace NadekoBot.Modules.Administration.Services
{
#if !GLOBAL_NADEKO
public class LogCommandService : INService
{
@ -1023,5 +1024,6 @@ namespace NadekoBot.Modules.Administration.Services
}
}
}
#endif
}
#endif

View File

@ -10,6 +10,7 @@ using NadekoBot.Extensions;
using NadekoBot.Core.Services;
using NadekoBot.Core.Services.Impl;
using NLog;
using StackExchange.Redis;
namespace NadekoBot.Modules.Administration.Services
{
@ -17,7 +18,8 @@ namespace NadekoBot.Modules.Administration.Services
{
public bool ForwardDMs => _bc.BotConfig.ForwardMessages;
public bool ForwardDMsToAllOwners => _bc.BotConfig.ForwardToAllOwners;
private readonly ConnectionMultiplexer _redis;
private readonly NadekoBot _bot;
private readonly CommandHandler _cmdHandler;
private readonly DbService _db;
@ -28,10 +30,13 @@ namespace NadekoBot.Modules.Administration.Services
private readonly IBotCredentials _creds;
private ImmutableArray<AsyncLazy<IDMChannel>> ownerChannels = new ImmutableArray<AsyncLazy<IDMChannel>>();
private readonly IBotConfigProvider _bc;
private readonly IImagesService _imgs;
public SelfService(DiscordSocketClient client, NadekoBot bot, CommandHandler cmdHandler, DbService db,
IBotConfigProvider bc, ILocalization localization, NadekoStrings strings, IBotCredentials creds)
IBotConfigProvider bc, ILocalization localization, NadekoStrings strings, IBotCredentials creds,
IDataCache cache, IImagesService imgs)
{
_redis = cache.Redis;
_bot = bot;
_cmdHandler = cmdHandler;
_db = db;
@ -41,6 +46,11 @@ namespace NadekoBot.Modules.Administration.Services
_client = client;
_creds = creds;
_bc = bc;
_imgs = imgs;
var sub = _redis.GetSubscriber();
sub.Subscribe(_creds.RedisKey() + "_reload_images",
delegate { _imgs.Reload(); }, CommandFlags.FireAndForget);
Task.Run(async () =>
{