public void Start(ITgBotService botService, CancellationToken cancellationToken) { if (_botService != null) { throw new Exception("Service is already started."); } _botService = botService; _botService.OnMessage += OnMessage; _botService.Start(cancellationToken); }
public void Stop() { if (_botService == null) { return; } _botService.OnMessage -= OnMessage; _botService?.Stop(); _botService = null; _cancellationTokenSource.Cancel(); _cancellationTokenSource.Dispose(); }
public SubscriptionProcessor(ITgBotService telegramService, IFilterChecker filterChecker, IDbService dbService) { _telegramService = telegramService; _dbService = dbService; _filterChecker = filterChecker; }
public TgUpdateService(ITgBotService botService, UserContext context) { _botService = botService; _context = context; }