Python:
import telebot
import requests
TOKEN = 'YOUR_TELEGRAM_BOT_TOKEN'
bot = telebot.TeleBot(TOKEN)
@bot.message_handler(func=lambda message: True)
def handle_message(message):
try:
amount = float(message.text)
except ValueError:
bot.reply_to(message, "Lütfen geçerli bir miktar girin.")
return
try:
response = requests.get(f"https://api.exchangerate-api.com/v4/latest/TRY")
data = response.json()
exchange_rate = data['rates']['TRY']
converted_amount = amount * exchange_rate
bot.reply_to(message, f"{amount} TRY, {converted_amount} TL ediyor.")
except Exception as e:
bot.reply_to(message, "Dönüştürme sırasında bir hata oluştu. Lütfen daha sonra tekrar deneyin.")
bot.polling()