Esempio n. 1
0
        public Bot()
        {
            var config = new Config();

            if (String.IsNullOrWhiteSpace(config.GetValue(_SecurityTokenKey)))
            {
                throw new InvalidOperationException("There is no security token in config file.");
            }

            _telegramUrl = config.GetValue(_ApiUrlKey);
               CreateListenerFromConfig(config);
        }
Esempio n. 2
0
        private IUpdateListener CreateListenerFromConfig(Config config)
        {
            var val = config.GetValue(_UpdateModeKey);
            switch(val)
            {
                case "" :
                case "poll" : return new PollUpdateListener();

                case "hook ": throw new NotImplementedException();
            }

            throw new FormatException("No or incorrect mode provided. Available mods: poll, hook.");
        }