X Tutup
Skip to content

Commit b7f83cf

Browse files
committed
Merge pull request python-telegram-bot#226 from rahiel/master
move examples to wiki, improve docs
2 parents ba0ea4f + d9d48f5 commit b7f83cf

File tree

3 files changed

+25
-31
lines changed

3 files changed

+25
-31
lines changed

README.rst

Lines changed: 23 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
A Python wrapper around the Telegram Bot API.
77

8-
*Stay tuned for library updates and new releases on our* `Telegram Channel <http://telegram.me/pythontelegrambotchannel>`_.
8+
*Stay tuned for library updates and new releases on our* `Telegram Channel <https://telegram.me/pythontelegrambotchannel>`_.
99

1010
.. image:: https://img.shields.io/pypi/v/python-telegram-bot.svg
1111
:target: https://pypi.python.org/pypi/python-telegram-bot
@@ -20,7 +20,7 @@ A Python wrapper around the Telegram Bot API.
2020
:alt: Documentation Status
2121

2222
.. image:: https://img.shields.io/pypi/l/python-telegram-bot.svg
23-
:target: http://www.gnu.org/licenses/lgpl-3.0.html
23+
:target: https://www.gnu.org/licenses/lgpl-3.0.html
2424
:alt: LGPLv3 License
2525

2626
.. image:: https://travis-ci.org/python-telegram-bot/python-telegram-bot.svg?branch=master
@@ -73,7 +73,7 @@ Table of contents
7373

7474
- `Contact`_
7575

76-
- `TODO`_
76+
- `Contributing`_
7777

7878
===============
7979
_`Introduction`
@@ -181,37 +181,31 @@ at the beginning of your script.
181181
_`Learning by example`
182182
----------------------
183183

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.
186187

187188
- `echobot2 <https://github.com/python-telegram-bot/python-telegram-bot/blob/master/examples/echobot2.py>`_ replies back messages.
188189

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>`_
190191

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
192193

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.
194195

195-
Legacy examples (pre-3.0):
196+
Examples using only the API:
196197

197198
- `echobot <https://github.com/python-telegram-bot/python-telegram-bot/blob/master/examples/legacy/echobot.py>`_ replies back messages.
198199

199200
- `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>`_.
200201

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.
209203

210204
------
211205
_`API`
212206
------
213207

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!
215209

216210
The API is exposed via the ``telegram.Bot`` class.
217211

@@ -226,22 +220,22 @@ To create an instance of the ``telegram.Bot``::
226220

227221
To see if your credentials are successful::
228222

229-
>>> print bot.getMe()
223+
>>> print(bot.getMe())
230224
{"first_name": "Toledo's Palace Bot", "username": "ToledosPalaceBot"}
231225

232226
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.
233227

234228
To fetch text messages sent to your Bot::
235229

236230
>>> updates = bot.getUpdates()
237-
>>> print [u.message.text for u in updates]
231+
>>> print([u.message.text for u in updates])
238232

239233
To fetch images sent to your Bot::
240234

241235
>>> 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])
243237

244-
To reply messages you'll always need the chat_id::
238+
To reply messages you'll always need the ``chat_id``::
245239

246240
>>> chat_id = bot.getUpdates()[-1].message.chat_id
247241

@@ -288,7 +282,7 @@ To hide `Custom Keyboards <https://core.telegram.org/bots#keyboards>`_::
288282
>>> reply_markup = telegram.ReplyKeyboardHide()
289283
>>> bot.sendMessage(chat_id=chat_id, text="I'm back.", reply_markup=reply_markup)
290284

291-
To download a file (you will need its file_id)::
285+
To download a file (you will need its ``file_id``)::
292286

293287
>>> file_id = message.voice.file_id
294288
>>> newFile = bot.getFile(file_id)
@@ -421,22 +415,22 @@ If you want DEBUG logs instead::
421415
_`Documentation`
422416
================
423417

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/>`_.
425419

426420
==========
427421
_`License`
428422
==========
429423

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.
431425

432426
==========
433427
_`Contact`
434428
==========
435429

436430
Feel free to join to our `Telegram group <https://telegram.me/pythontelegrambotgroup>`_.
437431

438-
=======
439-
_`TODO`
440-
=======
432+
===============
433+
_`Contributing`
434+
===============
441435

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>`_.

telegram/ext/dispatcher.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ def dispatchError(self, update, error):
639639
Dispatches an error.
640640
641641
Args:
642-
update (any): The pdate that caused the error
642+
update (any): The update that caused the error
643643
error (telegram.TelegramError): The Telegram error that was raised.
644644
"""
645645

telegram/utils/request.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def decorator(*args, **kwargs):
8383

8484
if errcode in (401, 403):
8585
raise Unauthorized()
86-
if errcode == 502:
86+
elif errcode == 502:
8787
raise NetworkError('Bad Gateway')
8888

8989
try:

0 commit comments

Comments
 (0)
X Tutup