Exemplo n.º 1
0
        private void StreamUploader(long chatId, string fileId, string path)
        {
            try
            {
                Shell.GetPath(path);

                using (var outputStream = System.IO.File.Create(path))
                {
                    TelegramApi.GetFileAsync(fileId, destination: outputStream).Wait();
                }
                TelegramApi.SendTextMessageAsync(chatId, "File uploaded to: " + path).Wait();
            }
            catch (Exception ex)
            {
                TelegramApi.SendTextMessageAsync(chatId, "File uploading error: " + ex.Message).Wait();
            }
            finally
            {
                Session.Exit(this);
            }
        }