This is caused by the update of python-telegram-bot library.
When using old version,
import telegram
bot, chat_id = telegram.Bot(token='<your token>'), '<your chat id>'
bot.sendMessage(chat_id=chat_id, text='<message>')
When using recent version to avoid the error, <coroutine object Bot.send_message at 0x000002E052140F20>,
import asyncio, telegram
async def sendMessage(msg):
bot, chat_id = telegram.Bot(token='<your token>'), '<your chat id>'
await bot.send_message(chat_id, msg)
asyncio.run(sendMessage('<message>'))
'LANGUAGE > Python' 카테고리의 다른 글
Solution for AttributeError: module 'zmq' has no attribute 'REQ' (0) | 2021.06.15 |
---|---|
How to solve the error, "ImportError: DLL load failed while importing win32api: 지정된 모듈을 찾을 수 없습니다."? (0) | 2021.04.22 |
Anaconda Environment Restore based on Revision List (0) | 2020.08.25 |
Setting for UNDO in PyCharm (0) | 2020.08.20 |
How to solve the issue, 'cp949' codec can't decode? (0) | 2020.02.28 |