fix
This commit is contained in:
parent
0f37e48869
commit
c709680413
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"));
|
||||
}
|
||||
}
|
||||
}
|
@ -261,6 +261,7 @@ namespace NadekoBot
|
||||
.Add(filterService)
|
||||
.Add(globalPermsService)
|
||||
.Add<PokemonService>(pokemonService)
|
||||
.Add<NadekoBot>(this)
|
||||
.Build();
|
||||
|
||||
CommandHandler.AddServices(Services);
|
||||
|
Loading…
Reference in New Issue
Block a user