public override Task <PreconditionResult> CheckPermissionsAsync(ICommandContext context, CommandInfo command, IServiceProvider services) { ServerDatabase ServerDb = services.GetService <ServerDatabase>(); if (ServerDb.Servers.FirstOrDefault(x => x.ServerSnowflake == context.Guild.Id) == null) { return(Task.FromResult(PreconditionResult.FromError("A server admin needs to run `!server setup` first before this command can be used"))); } return(Task.FromResult(PreconditionResult.FromSuccess())); }
public override Task <PreconditionResult> CheckPermissionsAsync(ICommandContext context, CommandInfo command, IServiceProvider services) { ServerDatabase ServerDb = services.GetService <ServerDatabase>(); if (ServerDb.Servers.FirstOrDefault(x => x.ServerSnowflake == context.Guild.Id) != null) { return(Task.FromResult(PreconditionResult.FromError("This server is already setup!"))); } return(Task.FromResult(PreconditionResult.FromSuccess())); }
public ServerCommands(InteractProcessService IPS, ServerDatabase ServerDb) { InteractProcess = IPS; this.ServerDb = ServerDb; }