fixed public bot compilation issue for good

This commit is contained in:
Master Kwoth 2017-06-29 06:10:56 +02:00
parent 3709f4b066
commit db1581f67d

View File

@ -26,6 +26,8 @@ using NadekoBot.Services.Help;
using System.IO;
using NadekoBot.Services.Pokemon;
using NadekoBot.DataStructures.ShardCom;
using NadekoBot.DataStructures;
using NadekoBot.Extensions;
namespace NadekoBot
{
@ -346,6 +348,10 @@ namespace NadekoBot
var _ = await CommandService.AddModulesAsync(this.GetType().GetTypeInfo().Assembly);
bool isPublicNadeko = false;
#if GLOBAL_NADEKO
isPublicNadeko = true;
#endif
//Console.WriteLine(string.Join(", ", CommandService.Commands
// .Distinct(x => x.Name + x.Module.Name)
// .SelectMany(x => x.Aliases)
@ -353,14 +359,14 @@ namespace NadekoBot
// .Where(x => x.Count() > 1)
// .Select(x => x.Key + $"({x.Count()})")));
//unload modules which are not available on the public bot
#if GLOBAL_NADEKO
CommandService
.Modules
.ToArray()
.Where(x => x.Preconditions.Any(y => y.GetType() == typeof(NoPublicBot)))
.ForEach(x => CommandService.RemoveModuleAsync(x));
#endif
//unload modules which are not available on the public bot
if(isPublicNadeko)
CommandService
.Modules
.ToArray()
.Where(x => x.Preconditions.Any(y => y.GetType() == typeof(NoPublicBot)))
.ForEach(x => CommandService.RemoveModuleAsync(x));
Ready = true;
_log.Info($"Shard {ShardId} ready.");