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"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -224,7 +224,7 @@ namespace NadekoBot
|
|||||||
.Add<CurrencyService>(Currency)
|
.Add<CurrencyService>(Currency)
|
||||||
.Add<CommandHandler>(CommandHandler)
|
.Add<CommandHandler>(CommandHandler)
|
||||||
.Add<DbService>(Db)
|
.Add<DbService>(Db)
|
||||||
//modules
|
//modules
|
||||||
.Add(commandMapService)
|
.Add(commandMapService)
|
||||||
.Add(remindService)
|
.Add(remindService)
|
||||||
.Add(repeaterService)
|
.Add(repeaterService)
|
||||||
@ -261,6 +261,7 @@ namespace NadekoBot
|
|||||||
.Add(filterService)
|
.Add(filterService)
|
||||||
.Add(globalPermsService)
|
.Add(globalPermsService)
|
||||||
.Add<PokemonService>(pokemonService)
|
.Add<PokemonService>(pokemonService)
|
||||||
|
.Add<NadekoBot>(this)
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
CommandHandler.AddServices(Services);
|
CommandHandler.AddServices(Services);
|
||||||
|
Loading…
Reference in New Issue
Block a user