async Task InitTelegram() { if (TelegramConfig.UseProxy) { var httpProxy = new WebProxy(TelegramConfig.ProxyUrl) { Credentials = new NetworkCredential(TelegramConfig.ProxyLogin, TelegramConfig.ProxyPassword) }; TelegramBot = new TelegramBotClient(TelegramConfig.ApiKey, httpProxy); } else { TelegramBot = new TelegramBotClient(TelegramConfig.ApiKey); } Me = await TelegramBot.GetMeAsync(); Commands = new ChatCommandRouter(Me.Username, Log); Commands.Add(new CreateTopicCommand(Db), "createtopic"); Commands.Add(new DeleteTopicCommand(Db), "deletetopic"); Commands.Add(new SubscribeCommand(Db, TelegramBot), "subscribe", "sub"); Commands.Add(new UnsubscribeCommand(Db, TelegramBot), "unsubscribe", "unsub"); Commands.Add(new ListCommand(Db, TelegramBot), "list"); HeartbeatCancellation = new(); HeartbeatTask = CheckHeartbeats(HeartbeatCancellation.Token); TelegramBot.OnMessage += TelegramMessageReceived; TelegramBot.StartReceiving(); }