mirror of
https://github.com/eternnoir/pyTelegramBotAPI.git
synced 2023-08-10 21:12:57 +03:00
Upate readme.
This commit is contained in:
parent
8898e3b8cc
commit
e71dd24d46
27
README.md
27
README.md
@ -107,9 +107,32 @@ tb.send_location(chat_id, lat, lon)
|
||||
|
||||
```
|
||||
|
||||
## Message notifier
|
||||
|
||||
* Define listener function
|
||||
|
||||
```python
|
||||
def listener1(*messages):
|
||||
for m in messages:
|
||||
chatid = m.chat.id
|
||||
if m.content_type == 'text'
|
||||
text = m.text
|
||||
tb.send_message(chatid, text)
|
||||
```
|
||||
|
||||
* Use ***set_update_listener*** method to add listener function to telebot.
|
||||
* Start polling or call get_update(). If get new updates, telebot will call listener and pass messages to listener.
|
||||
* use Message's content_type attribute to check message type. Now Message support content_type:
|
||||
* text
|
||||
* audio
|
||||
* document
|
||||
* photo
|
||||
* sticker
|
||||
* video
|
||||
* location
|
||||
|
||||
## TODO
|
||||
|
||||
- [ ] Let message not only support text.
|
||||
- [x] getMe
|
||||
- [x] sendMessage
|
||||
- [x] forwardMessage
|
||||
@ -121,4 +144,4 @@ tb.send_location(chat_id, lat, lon)
|
||||
- [x] sendLocation
|
||||
- [ ] sendChatAction
|
||||
- [ ] getUserProfilePhotos
|
||||
- [ ] getUpdates (Only text message support now.)
|
||||
- [ ] getUpdates
|
||||
|
Loading…
Reference in New Issue
Block a user