1. python-telegram-bot 설치 (pip install python-telegram-bot --upgrade)
2. BotFather 와 userinfobot 을 통해서 telegram token 생성
3. 다음 코드 실행

import telegram 
telgm_token = '텔레그램 토큰' 
bot = telegram.Bot(token = telgm_token) 
updates = bot.getUpdates() 
print(updates) 
bot.sendMessage(chat_id = '대화방 ID', text="메시지 내용")

4. updates 를 통해 각 대화방 ID를 알 수 있음

반응형

+ Recent posts