728x90
첫 번째,
모듈 설치
!pip install python-telegram-bot
두 번째,
텔레그램의 @botfather 를 활용해 token 값을 얻고,
채팅방에 간단히 입력 후 update를 활용해 채팅방 id 값 얻기
import telegram
telegram_token = ''
telegram_id = ''
bot = telegram.Bot(token = telegram_token)
updates = bot.getUpdates()
telegram_id = updates[-1].message.chat_id
bot.sendMessage(telegram_id, '')
세 번째,
sendMessage를 활용하여 원하는 메시지 보내기.
카카오톡과 달리 bot이 있어서 비교적 편리하게 메시지를 보낼 수 있다.
728x90
반응형
'수입' 카테고리의 다른 글
[21.08.27] 대전 출장 (0) | 2021.08.27 |
---|---|
[21.08.25] 서울 출장 (0) | 2021.08.26 |
[21.08.16~20] 제주도 ~ (0) | 2021.08.20 |
[21.08.15] github, sourcetree 오류 해결 (0) | 2021.08.15 |
[21.08.10] 프로토 촬영 하러 구로 (0) | 2021.08.10 |
댓글