Python
파이썬 텔레그램 보내게 하기 - Bot.send_message' was never awaited
SAFE
2023. 10. 7. 15:40
2년전에 하다가 다시 만들어보는데 Bot.send_message' was never awaited 라는 오류가나면서 보내지지 않았다.
버전이 바뀌었다고 함
import telegram
import asyncio
bot = telegram.Bot(token='<본인의 token>')
chat_id = <본인의 chat_id>
asyncio.run(bot.send_message(chat_id=chat_id, text="MESSAGE"))
출처 : https://wonderdayss.tistory.com/entry/python-telegram-bot-v200-%EC%97%90%EB%9F%AC-%EB%82%A0-%EB%95%8C-%ED%95%B4%EA%B2%B0%EB%B0%A9%EB%B2%95RuntimeWarning-coroutine-Botsendmessage-was-never-awaited