You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -181,37 +181,31 @@ at the beginning of your script.
181
181
_`Learning by example`
182
182
----------------------
183
183
184
-
|We believe that the best way to learn & understand this simple package is by example. So here are some examples for you to review.
185
-
|Even if it's not your approach for learning, please take a look at ``echobot2`` (below), it is de facto the base for most of the bots out there.
184
+
We believe that the best way to learn and understand this simple package is by example. So here are some examples for you to review. Even if it's not your approach for learning, please take a look at ``echobot2`` (below), it is de facto the base for most of the bots out there. Best of all, the code for these examples are released to the public domain, so you can start by grabbing the code and building on top of it.
185
+
186
+
- `clibot <https://github.com/python-telegram-bot/python-telegram-bot/blob/master/examples/clibot.py>`_ has a command line interface.
186
187
187
188
- `echobot2 <https://github.com/python-telegram-bot/python-telegram-bot/blob/master/examples/echobot2.py>`_ replies back messages.
188
189
189
-
- `clibot<https://github.com/python-telegram-bot/python-telegram-bot/blob/master/examples/clibot.py>`_ has a command line interface.
190
+
- `inlinebot<https://github.com/python-telegram-bot/python-telegram-bot/blob/master/examples/inlinebot.py>`_ basic example of an `inline bot <https://core.telegram.org/bots/inline>`_
190
191
191
-
- `timerbot <https://github.com/python-telegram-bot/python-telegram-bot/blob/master/examples/timerbot.py>`_ uses the ``JobQueue`` to send timed messages.
192
+
- `state machine bot <https://github.com/python-telegram-bot/python-telegram-bot/blob/master/examples/state_machine_bot.py>`_ keeps the state for individual users, useful for multipart conversations
192
193
193
-
- `Welcome Bot <https://github.com/jh0ker/welcomebot>`_ greets everyone who joins a group chat.
194
+
- `timerbot <https://github.com/python-telegram-bot/python-telegram-bot/blob/master/examples/timerbot.py>`_ uses the ``JobQueue`` to send timed messages.
194
195
195
-
Legacy examples (pre-3.0):
196
+
Examples using only the API:
196
197
197
198
- `echobot <https://github.com/python-telegram-bot/python-telegram-bot/blob/master/examples/legacy/echobot.py>`_ replies back messages.
198
199
199
200
- `roboed <https://github.com/python-telegram-bot/python-telegram-bot/blob/master/examples/legacy/roboed.py>`_ talks to `Robô Ed <http://www.ed.conpet.gov.br/br/converse.php>`_.
200
201
201
-
- `Simple-Echo-Telegram-Bot <https://github.com/sooyhwang/Simple-Echo-Telegram-Bot>`_ simple Python Telegram bot that echoes your input with Flask microframework, setWebhook method, and Google App Engine (optional) - by @sooyhwang.
202
-
203
-
- `DevOps Reaction Bot <https://github.com/leandrotoledo/gae-devops-reaction-telegram-bot>`_ sends latest or random posts from `DevOps Reaction <http://devopsreactions.tumblr.com/>`_. Running on `Google App Engine <https://cloud.google.com/appengine>`_ (billing has to be enabled for fully Socket API support).
204
-
205
-
Other notable examples:
206
-
207
-
- `TwitterForwarderBot <https://github.com/franciscod/telegram-twitter-forwarder-bot>`_ forwards you tweets from people that you have subscribed to.
208
-
202
+
Look at the examples on the `wiki <https://github.com/python-telegram-bot/python-telegram-bot/wiki/Examples>`_ to see other bots the community has built.
209
203
210
204
------
211
205
_`API`
212
206
------
213
207
214
-
Note: Using the ``Bot`` class directly is the 'old' method, but almost all of this is still important information, even if you're using the ``telegram.ext`` submodule!
208
+
Note: Using the ``Bot`` class directly is the 'old' method, we have an easier way to make bots described in the next section. All of this is however still important information, even if you're using the ``telegram.ext`` submodule!
215
209
216
210
The API is exposed via the ``telegram.Bot`` class.
217
211
@@ -226,22 +220,22 @@ To create an instance of the ``telegram.Bot``::
Bots can't initiate conversations with users. A user must either add them to a group or send them a message first. People can use ``telegram.me/<bot_username>`` links or username search to find your bot.
233
227
234
228
To fetch text messages sent to your Bot::
235
229
236
230
>>> updates = bot.getUpdates()
237
-
>>> print[u.message.text for u in updates]
231
+
>>> print([u.message.text for u in updates])
238
232
239
233
To fetch images sent to your Bot::
240
234
241
235
>>> updates = bot.getUpdates()
242
-
>>> print[u.message.photo for u in updates if u.message.photo]
236
+
>>> print([u.message.photo for u in updates if u.message.photo])
243
237
244
-
To reply messages you'll always need the chat_id::
238
+
To reply messages you'll always need the ``chat_id``::
To download a file (you will need its ``file_id``)::
292
286
293
287
>>> file_id = message.voice.file_id
294
288
>>> newFile = bot.getFile(file_id)
@@ -421,22 +415,22 @@ If you want DEBUG logs instead::
421
415
_`Documentation`
422
416
================
423
417
424
-
``python-telegram-bot``'s documentation lives at `Read the Docs <http://python-telegram-bot.readthedocs.org/en/latest/>`_.
418
+
``python-telegram-bot``'s documentation lives at `Read the Docs <https://python-telegram-bot.readthedocs.org/en/latest/>`_.
425
419
426
420
==========
427
421
_`License`
428
422
==========
429
423
430
-
You may copy, distribute and modify the software provided that modifications are described and licensed for free under `LGPL-3 <http://www.gnu.org/licenses/lgpl-3.0.html>`_. Derivatives works (including modifications or anything statically linked to the library) can only be redistributed under `LGPL-3 <http://www.gnu.org/licenses/lgpl-3.0.html>`_, but applications that use the library don't have to be.
424
+
You may copy, distribute and modify the software provided that modifications are described and licensed for free under `LGPL-3 <https://www.gnu.org/licenses/lgpl-3.0.html>`_. Derivatives works (including modifications or anything statically linked to the library) can only be redistributed under `LGPL-3 <https://www.gnu.org/licenses/lgpl-3.0.html>`_, but applications that use the library don't have to be.
431
425
432
426
==========
433
427
_`Contact`
434
428
==========
435
429
436
430
Feel free to join to our `Telegram group <https://telegram.me/pythontelegrambotgroup>`_.
437
431
438
-
=======
439
-
_`TODO`
440
-
=======
432
+
===============
433
+
_`Contributing`
434
+
===============
441
435
442
-
Patches and bug reports are `welcome<https://github.com/python-telegram-bot/python-telegram-bot/issues/new>`_, just please keep the style consistent with the original source.
436
+
Contributions of all sizes are welcome. Please review our `contribution guidelines <https://github.com/python-telegram-bot/python-telegram-bot/blob/master/CONTRIBUTING.rst>`_ to get started. You can also help by `reporting bugs <https://github.com/python-telegram-bot/python-telegram-bot/issues/new>`_.
0 commit comments