From d4ef77782c54f53c8827be1c6d773f5277a91fd7 Mon Sep 17 00:00:00 2001 From: eternnoir Date: Fri, 26 Jun 2015 18:05:23 +0800 Subject: [PATCH] Update Readme. --- README.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/README.md b/README.md index 7327cf9..7449fc9 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,8 @@ Python Telegram bot api. ## Example +* Send Message + ```python import telebot @@ -12,3 +14,27 @@ tb = telebot.TeleBot(TOKEN) # tb.send_message(chatid,message) print tb.send_message(281281, 'gogo power ranger') ``` + +* Echo Bot + +```python +mport telebot +import time + +TOKEN = '' + + +def listener(*messages): + 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) +tb.polling(3) +while True: + time.sleep(20) +```