예제 #1
0
 public virtual Task <ScenarioResult> Init(UserManager userManager, INeighRepository repository, MessageTrail trail)
 {
     Users      = userManager;
     Repository = repository;
     Trail      = trail;
     return(Task.FromResult(ScenarioResult.ContinueCurrent));
 }
예제 #2
0
        public override async Task <ScenarioResult> Init(UserManager userManager, INeighRepository repository, MessageTrail trail)
        {
            await base.Init(userManager, repository, trail);

            await PrintMenu();

            return(ScenarioResult.ContinueCurrent);
        }
예제 #3
0
        public override async Task <ScenarioResult> Init(UserManager userManager, INeighRepository repository, MessageTrail trail)
        {
            await base.Init(userManager, repository, trail);

            await PrintMenu("Оставьте сообщение для разработчкиов:");

            return(ScenarioResult.ContinueCurrent);
        }
예제 #4
0
        public BotService(IOptions <WebProxySettings> webProxyOptions, IOptions <BotSettings> botOptions,
                          UserManager userManager, INeighRepository repository)
        {
            _webProxySettings = webProxyOptions.Value;
            _botSettings      = botOptions.Value;
            _userManager      = userManager;
            _repository       = repository;

            if (_webProxySettings.Enabled)
            {
                _webProxy = new WebProxy(_webProxySettings.Host, _webProxySettings.Port)
                {
                    UseDefaultCredentials = true
                };
                _botClient = new TelegramBotClient(_botSettings.Token, _webProxy);
            }
            else
            {
                _botClient = new TelegramBotClient(_botSettings.Token);
            }

            _botClient.OnMessage       += OnMessage;
            _botClient.OnCallbackQuery += OnCallbackQuery;
        }