public nadeko stuff
This commit is contained in:
		@@ -1,4 +1,6 @@
 | 
			
		||||
using Discord;
 | 
			
		||||
 | 
			
		||||
#if !GLOBAL_NADEKO
 | 
			
		||||
using Discord;
 | 
			
		||||
using Discord.Commands;
 | 
			
		||||
using NadekoBot.Extensions;
 | 
			
		||||
using NadekoBot.Core.Services;
 | 
			
		||||
@@ -14,7 +16,6 @@ using static NadekoBot.Modules.Administration.Services.LogCommandService;
 | 
			
		||||
 | 
			
		||||
namespace NadekoBot.Modules.Administration
 | 
			
		||||
{
 | 
			
		||||
#if !GLOBAL_NADEKO
 | 
			
		||||
    public partial class Administration
 | 
			
		||||
    {
 | 
			
		||||
        [Group]
 | 
			
		||||
@@ -181,5 +182,5 @@ namespace NadekoBot.Modules.Administration
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
@@ -482,9 +482,11 @@ namespace NadekoBot.Modules.Administration
 | 
			
		||||
            public async Task ReloadImages()
 | 
			
		||||
            {
 | 
			
		||||
                var sw = Stopwatch.StartNew();
 | 
			
		||||
                _images.Reload();
 | 
			
		||||
                sw.Stop();
 | 
			
		||||
                await ReplyConfirmLocalized("images_loaded", sw.Elapsed.TotalSeconds.ToString("F3")).ConfigureAwait(false);
 | 
			
		||||
                var sub = _cache.Redis.GetSubscriber();
 | 
			
		||||
                sub.Publish(_creds.RedisKey() + "_reload_images", 
 | 
			
		||||
                    "",
 | 
			
		||||
                    StackExchange.Redis.CommandFlags.FireAndForget);
 | 
			
		||||
                await ReplyConfirmLocalized("images_loaded", 0).ConfigureAwait(false);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            private static UserStatus SettableUserStatusToUserStatus(SettableUserStatus sus)
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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 () =>
 | 
			
		||||
            {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user