fix
This commit is contained in:
		
							
								
								
									
										22
									
								
								src/NadekoBot/DataStructures/Shard0Precondition.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								src/NadekoBot/DataStructures/Shard0Precondition.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,22 @@
 | 
			
		||||
using Discord.Commands;
 | 
			
		||||
using Discord.WebSocket;
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
 | 
			
		||||
namespace NadekoBot.DataStructures
 | 
			
		||||
{
 | 
			
		||||
    public class Shard0Precondition : PreconditionAttribute
 | 
			
		||||
    {
 | 
			
		||||
        public override Task<PreconditionResult> CheckPermissions(ICommandContext context, CommandInfo command, IServiceProvider services)
 | 
			
		||||
        {
 | 
			
		||||
            var c = (DiscordSocketClient)context.Client;
 | 
			
		||||
            if (c.ShardId == 0)
 | 
			
		||||
                return Task.FromResult(PreconditionResult.FromSuccess());
 | 
			
		||||
            else
 | 
			
		||||
                return Task.FromResult(PreconditionResult.FromError("Must be ran from shard #0"));
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -224,7 +224,7 @@ namespace NadekoBot
 | 
			
		||||
                .Add<CurrencyService>(Currency)
 | 
			
		||||
                .Add<CommandHandler>(CommandHandler)
 | 
			
		||||
                .Add<DbService>(Db)
 | 
			
		||||
                //modules
 | 
			
		||||
                    //modules
 | 
			
		||||
                    .Add(commandMapService)
 | 
			
		||||
                    .Add(remindService)
 | 
			
		||||
                    .Add(repeaterService)
 | 
			
		||||
@@ -261,6 +261,7 @@ namespace NadekoBot
 | 
			
		||||
                    .Add(filterService)
 | 
			
		||||
                    .Add(globalPermsService)
 | 
			
		||||
                .Add<PokemonService>(pokemonService)
 | 
			
		||||
                .Add<NadekoBot>(this)
 | 
			
		||||
                .Build();
 | 
			
		||||
 | 
			
		||||
            CommandHandler.AddServices(Services);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user