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); }
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."); }