Go to file
eternnoir 8df80e40ad Add setup.py. 2015-06-26 22:44:15 +08:00
telebot Forward message method done. 2015-06-26 22:35:52 +08:00
tests Add Group Message deJson test. 2015-06-26 22:22:18 +08:00
.gitignore First Init. 2015-06-26 14:55:13 +08:00
.travis.yml Add CI Script. 2015-06-26 22:26:10 +08:00
LICENSE Initial commit 2015-06-26 14:56:25 +08:00
README.md Forward message method done. 2015-06-26 22:35:52 +08:00
requirements.txt Add requirements. 2015-06-26 18:14:51 +08:00
setup.py Add setup.py. 2015-06-26 22:44:15 +08:00

README.md

pyTelegramBotAPI

Python Telegram bot api.

Example

  • Send Message
import telebot

TOKEN = '<token string>'

tb = telebot.TeleBot(TOKEN)
# tb.send_message(chatid,message)
print tb.send_message(281281, 'gogo power ranger')
  • Echo Bot
import telebot
import time

TOKEN = '<token_string>'


def listener(*messages):
    """
    When new message get will call this function.
    :param messages:
    :return:
    """
    for m in messages:
        chatid = m.chat.id
        text = m.text
        tb.send_message(chatid, text)


tb = telebot.TeleBot(TOKEN)
tb.get_update()  # cache exist message
tb.set_update_listener(listener) #register listener
tb.polling(3)
while True:
    time.sleep(20)

TODO

  • getMe
  • sendMessage
  • forwardMessage
  • sendPhoto
  • sendAudio
  • sendDocument
  • sendSticker
  • sendVideo
  • sendLocation
  • sendChatAction
  • getUserProfilePhotos
  • getUpdates