private async Task InitAsync() { string apiToken = ConfigurationProvider.TestConfigurations.ApiToken; BotClient = new TelegramBotClient(apiToken); BotUser = await BotClient.GetMeAsync(CancellationToken); await BotClient.DeleteWebhookAsync(CancellationToken); SupergroupChat = await FindSupergroupTestChatAsync(); var allowedUserNames = await FindAllowedTesterUserNames(); UpdateReceiver = new UpdateReceiver(BotClient, allowedUserNames); await BotClient.SendTextMessageAsync( SupergroupChat.Id, "```\nTest execution is starting...\n```\n" + "#testers\n" + "These users are allowed to interact with the bot:\n\n" + UpdateReceiver.GetTesters(), ParseMode.Markdown, disableNotification : true, cancellationToken : CancellationToken ); #if DEBUG BotClient.MakingApiRequest += OnMakingApiRequest; BotClient.ApiResponseReceived += OnApiResponseReceived; #endif }
private async Task InitAsync() { string apiToken = ConfigurationProvider.TestConfigurations.ApiToken; var httpClientHandler = new RetryHttpMessageHandler(3, _diagnosticMessageSink); var httpClient = new HttpClient(httpClientHandler); BotClient = new TelegramBotClient(apiToken, httpClient); BotUser = await BotClient.GetMeAsync(CancellationToken); await BotClient.DeleteWebhookAsync(CancellationToken); SupergroupChat = await FindSupergroupTestChatAsync(); var allowedUserNames = await FindAllowedTesterUserNames(); UpdateReceiver = new UpdateReceiver(BotClient, allowedUserNames); await BotClient.SendTextMessageAsync( SupergroupChat.Id, "```\nTest execution is starting...\n```\n" + "#testers\n" + "These users are allowed to interact with the bot:\n\n" + UpdateReceiver.GetTesters(), ParseMode.Markdown, disableNotification : true, cancellationToken : CancellationToken ); }