mirror of
https://github.com/eternnoir/pyTelegramBotAPI.git
synced 2023-08-10 21:12:57 +03:00
Update Readme.
This commit is contained in:
parent
77948dd027
commit
d4ef77782c
26
README.md
26
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 = '<tonke_string>'
|
||||
|
||||
|
||||
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)
|
||||
```
|
||||
|
Loading…
Reference in New Issue
Block a user