diff --git a/lib/small_sdk/telegram.ex b/lib/small_sdk/telegram.ex index ad4586c..6dcb760 100644 --- a/lib/small_sdk/telegram.ex +++ b/lib/small_sdk/telegram.ex @@ -6,7 +6,8 @@ defmodule SmallSdk.Telegram do plug(Tesla.Middleware.BaseUrl, "https://api.telegram.org") def download_file_content(file_path) when is_binary(file_path) do - url = "/file/bot#{Application.fetch_env!(:save_it, :telegram_bot_token)}/#{file_path}" + bot_token = get_env() + url = "/file/bot#{bot_token}/#{file_path}" case get(url) do {:ok, response} -> @@ -23,4 +24,10 @@ defmodule SmallSdk.Telegram do {:error, error} -> raise "Error: #{inspect(error)}" end end + + defp get_env() do + bot_token = Application.fetch_env!(:save_it, :telegram_bot_token) + + bot_token + end end