1.Telegram Chatbot 설치
Telegram
텔레그램은 여러 플랫폼을 지원하면서 다양한 기기를 지원하는,
영리를 추구하지 않는 자유 클라우드 기반 인터넷 메신저이자 음성 인터넷 프로토콜이다.
설치 URL : https://desktop.telegram.org/
Telegram Desktop
Experience Telegram on your computer in a swift and seamless way.
desktop.telegram.org
2.Telegram 가입 후 로그인
3.BotFather 검색
BotFather : 텔레그램 챗봇의 기본적인 설정을 도와주는 텔레그램 봇
4./newbot 입력
newbot 이라고 채팅장에 입력하면 BotFather이 챗봇의 이름과 봇 검색 이름을 물어봅니다.
이름을 설정하고 나면 HTTP API token을 받을 수 있습니다.
확인 방법 : https://api.telegram.org/bot<제공받은API token>/getMe
예시) 내 토큰이 token "123123:sdfsdhf-sadh1jk231lk24" 이면
https://api.telegram.org/bot123123:sdfsdhf-sadh1jk231lk24/getMe
5.Python으로 봇 만들기
참고 사이트
1)Telegram bot Git 주소
: https://github.com/python-telegram-bot/python-telegram-bot
2)Telegram Bot Docs
: https://python-telegram-bot.readthedocs.io/en/stable/
3)Telegram 예제
: https://github.com/python-telegram-bot/python-telegram-bot/blob/master/examples/README.md
5-1.Telegram 봇 라이브러리 설치
pip install python-telegram-bot --upgrade
오류 발생할 경우
Cannot find reference 'ext' in '__init__.py' 오류 발생시
$ python -m telegram
$ pip install --upgrade ipython
Solution for those who receives "cannot import 'TelegramError'" while using IPython
https://github.com/python-telegram-bot/python-telegram-bot/issues/1139
Echo 예제 1) 챗봇 채팅에 글을 쓰면 챗봇이 보낸 글을 따라하는 예제
https://github.com/python-telegram-bot/python-telegram-bot/blob/master/examples/echobot2.py
python-telegram-bot/python-telegram-bot
We have made you a wrapper you can't refuse. Contribute to python-telegram-bot/python-telegram-bot development by creating an account on GitHub.
github.com
5-2.위 링크 소스 코드에서 TOKEN 부분만 수정!
"TOKEN" 부분에 자신의 토큰 입력
5-3.파이썬 실행 후 자신의 챗봇 채팅방에서 입력 테스트