Exemple #1
0
        public static void Main(string[] args)
        {
            var builder = new ConfigurationBuilder()
                          .SetBasePath(Directory.GetCurrentDirectory())
                          .AddJsonFile("appsettings.json");

            var configuration = builder.Build();

            Settings = new CustomSettings {
                TelegramKey   = configuration["CustomSettings:TelegramKey"],
                SocksProxy    = configuration["CustomSettings:SocksProxy"],
                ProxyPort     = Int32.Parse(configuration["CustomSettings:ProxyPort"]),
                YouTrackToken = configuration["CustomSettings:YouTrackToken"],
                YouTrackUrl   = configuration["CustomSettings:YouTrackUrl"]
            };

            Bot = new TelegramBotClient(Settings.TelegramKey, new HttpToSocks5Proxy(Settings.SocksProxy, Settings.ProxyPort));
            var me = Bot.GetMeAsync().Result;

            Console.Title = me.Username;

            Bot.OnInlineQuery        += BotOnInlineQueryReceived;
            Bot.OnInlineResultChosen += BotOnChosenInlineResultReceived;
            Bot.OnReceiveError       += BotOnReceiveError;

            Bot.StartReceiving(Array.Empty <UpdateType>());
            Console.WriteLine($"Start listening for @{me.Username}");
            Console.ReadLine();
            Bot.StopReceiving();
        }
Exemple #2
0
 public YouTrackPoster(CustomSettings settings)
 {
     Settings   = settings;
     Connection = new BearerTokenConnection(Settings.YouTrackUrl, Settings.YouTrackToken);
 }
Exemple #3
0
 public CommandParser(CustomSettings settings)
 {
     youTrackPoster = new YouTrackPoster(settings);
     Projects       = Task.Run(async() => await youTrackPoster.GetProjects()).Result;
 }