문서 편집 권한이 없습니다. 다음 이유를 확인해주세요:
요청한 명령은 다음 권한을 가진 사용자에게 제한됩니다: 사용자.
https://vmpo.tistory.com/m/85 == 텔레그램에서 봇 생성 == # botfather 검색 # @BotFahter 로 되어있는 채팅방을 클릭 # /start 입력 # /newbot 입력 # 봇 이름 입력 (xxxx_bot) # Done! Congratulations on your new bot 메시지가 나오면 정상적으로 생성이 완료된 것 # 성공 메시지 중에서 토큰 값을 따로 저장해줍니다. # 생성한 봇 채팅방으로 입장 == 파이썬 텔레그램 라이브러리 설치 == <source lang=python> pip install python-telegram-bot </source> === 텔레그램 봇 테스트 === * 본인의 챗ID를 확인 (최초로 받은 토큰번호는 진짜ID가 아님) <source lang=python> import telegram telgm_token = '1538331966:AAHPXJ6rKatzxXu0DyEwJkB-m2RO0Gbp0ZQ' bot = telegram.Bot(token = telgm_token) updates = bot.getUpdates() print(updates) for i in updates: print(i) print('start telegram chat bot') # 본인의 챗ID를 확인 #'676149244' </source> === 채팅방 메시지 === <source lang=python> import telegram telgm_token = '1538331966:AAHPXJ6rKatzxXu0DyEwJkB-m2RO0Gbp0ZQ' bot = telegram.Bot(token = telgm_token) #updates = bot.getUpdates() bot.sendMessage(chat_id = '676149244', text="안녕하세요 채봇입니다.") </source> [[Category:python]]
문서 저장 미리 보기 차이 보기 취소