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