메뉴 여닫기
개인 메뉴 토글
로그인하지 않음
만약 지금 편집한다면 당신의 IP 주소가 공개될 수 있습니다.

Python telegram: 두 판 사이의 차이

데브카페
새 문서: https://vmpo.tistory.com/m/85 == 텔레그램에서 봇 생성 == # botfather 검색 # @BotFahter 로 되어있는 채팅방을 클릭 # /start 입력 # /newbot 입력 # 봇 이름 입력 (xxxx_bot) # Done! Congratulations on your new bot 메시지가 나오면 정상적으로 생성이 완료된 것 # 성공 메시지 중에서 토큰 값을 따로 저장해줍니다. # 생성한 봇 채팅방으로 입장 == 파이썬 텔레그램 라이브러리 설치 == <source lang=...
 
잔글 개발노트 양식 일괄 적용
 
1번째 줄: 1번째 줄:
{{개발노트
|요약=botfather 검색
|핵심=
|분야=Python
|작성일=2024-10-04
}}
https://vmpo.tistory.com/m/85
https://vmpo.tistory.com/m/85



2026년 11월 12일 (목) 12:44 기준 최신판

DEVCAFE NOTE
Python
botfather 검색
KEY POINTS · 핵심 정리
작성일2024년 10월 4일

https://vmpo.tistory.com/m/85

텔레그램에서 봇 생성

  1. botfather 검색
  2. @BotFahter 로 되어있는 채팅방을 클릭
  3. /start 입력
  4. /newbot 입력
  5. 봇 이름 입력 (xxxx_bot)
  6. Done! Congratulations on your new bot 메시지가 나오면 정상적으로 생성이 완료된 것
  7. 성공 메시지 중에서 토큰 값을 따로 저장해줍니다.
  8. 생성한 봇 채팅방으로 입장


파이썬 텔레그램 라이브러리 설치

pip install python-telegram-bot


텔레그램 봇 테스트

  • 본인의 챗ID를 확인 (최초로 받은 토큰번호는 진짜ID가 아님)
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'

채팅방 메시지

import telegram

telgm_token = '1538331966:AAHPXJ6rKatzxXu0DyEwJkB-m2RO0Gbp0ZQ'

bot = telegram.Bot(token = telgm_token)

#updates = bot.getUpdates()

bot.sendMessage(chat_id = '676149244', text="안녕하세요  채봇입니다.")