import aiohttp import asyncio async def send_message_to_telegram(token, chat_id, message): url = f"https://api.telegram.org/bot{token}/sendMessage" async with aiohttp.ClientSession() as session: params = { 'chat_id': chat_id, 'text': message } async with session.get(url, params=params) as response: if response.status == 200: print("Message sent successfully") else: print(f"Failed to send message: {response.status}") # مثال لاستخدام الدالة async def main(): token = '7865424971:AAF_Oe6lu8ZYAl5XIF1M6qU_8MK6GHWEll8' chat_id = '227321236' message = 'Hello, this is a test message from Hugging Face Space!' await send_message_to_telegram(token, chat_id, message) # تشغيل الدالة asyncio.run(main())