Пример #1
0
        public Result CanCommandBeExecuted(CommandContainer args)
        {
            IBotCommand command = _serviceProvider.GetCommand(args.CommandName);

            var    descriptor = command.GetBotCommandDescriptorAttribute();
            Result canExecute = command.CanExecute(args);

            return(canExecute.IsSuccess
                ? Result.Ok()
                : Result.Fail(
                       $"Command [{descriptor.CommandName}] cannot be executed: {canExecute}"));
        }