Example #1
0
        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);
        }
Example #2
0
        public void Stop()
        {
            if (_botService == null)
            {
                return;
            }

            _botService.OnMessage -= OnMessage;
            _botService?.Stop();
            _botService = null;
            _cancellationTokenSource.Cancel();
            _cancellationTokenSource.Dispose();
        }
Example #3
0
 public SubscriptionProcessor(ITgBotService telegramService, IFilterChecker filterChecker, IDbService dbService)
 {
     _telegramService = telegramService;
     _dbService       = dbService;
     _filterChecker   = filterChecker;
 }
 public TgUpdateService(ITgBotService botService,
                        UserContext context)
 {
     _botService = botService;
     _context    = context;
 }