Python

发布于 更新于

AI总结: import telegram import asyncio """ pip install python-telegram-bot """ key = "" chat_id = "" text ...
import telegram
import asyncio

"""
pip install python-telegram-bot
"""

key = ""
chat_id = ""
text = ""

async def sendMsg(text):
    bot = telegram.Bot(token=key)
    async with bot:
        print(await bot.send_message(chat_id=chat_id, text = text))

# loop = asyncio.get_event_loop()
# loop.create_task(sendMsg(text))
asyncio.run(sendMsg(text))

telegram-bot文档