bool InitBot(BuildServer server, string name, string token, string hub, LoggerFactory loggerFactory) { _name = name; _hub = hub; try { _logger.LogDebug( $"InitBot: Start initialize with \"{name}\", token: \"{token}\", hub: \"{hub}\""); InitBotAsync(token, loggerFactory).GetAwaiter().GetResult(); _resurrector = SetupResurrector(); } catch (Exception e) { _logger.LogError($"InitBot: exception: \"{e}\""); return(false); } _bot.When(_bot.State.BotUserId, conv => { OnMessage?.Invoke(conv.Text); return(null); }); Controller = new SlackServerController(_loggerFactory, this, server); View = new SlackServerView(_loggerFactory, this, server, _messageFormat); return(true); }