This commit is contained in:
Master Kwoth 2017-06-21 15:14:08 +02:00
parent 0f37e48869
commit c709680413
2 changed files with 24 additions and 1 deletions

View 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"));
}
}
}

View File

@ -261,6 +261,7 @@ namespace NadekoBot
.Add(filterService)
.Add(globalPermsService)
.Add<PokemonService>(pokemonService)
.Add<NadekoBot>(this)
.Build();
CommandHandler.AddServices(Services);