mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2026-06-27 11:44:40 +00:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| dc27ff41ef | |||
| 68ec73afb6 | |||
| 0ace0aa016 | |||
| f5847be8ca | |||
| ba26a8ba5d |
@@ -1,3 +1,9 @@
|
||||
**2016-05-22**
|
||||
|
||||
*Released 4.1.2*
|
||||
|
||||
- Fix ``MessageEntity`` decoding with Bot API 2.1 changes
|
||||
|
||||
**2016-05-16**
|
||||
|
||||
*Released 4.1.1*
|
||||
|
||||
+2
-36
@@ -49,8 +49,6 @@ Table of contents
|
||||
|
||||
- `Installing`_
|
||||
|
||||
- `Getting the code`_
|
||||
|
||||
- `Getting started`_
|
||||
|
||||
#. `Learning by example`_
|
||||
@@ -118,37 +116,6 @@ You can install or upgrade python-telegram-bot with:
|
||||
|
||||
$ pip install python-telegram-bot --upgrade
|
||||
|
||||
===================
|
||||
_`Getting the code`
|
||||
===================
|
||||
|
||||
The code is hosted at https://github.com/python-telegram-bot/python-telegram-bot
|
||||
|
||||
Check out the latest development version anonymously with:
|
||||
|
||||
.. code:: shell
|
||||
|
||||
$ git clone https://github.com/python-telegram-bot/python-telegram-bot
|
||||
$ cd python-telegram-bot
|
||||
|
||||
Install dependencies:
|
||||
|
||||
.. code:: shell
|
||||
|
||||
$ pip install -r requirements.txt -r requirements-dev.txt
|
||||
|
||||
Run tests:
|
||||
|
||||
.. code:: shell
|
||||
|
||||
$ make test
|
||||
|
||||
To see other available options, run:
|
||||
|
||||
.. code:: shell
|
||||
|
||||
$ make help
|
||||
|
||||
==================
|
||||
_`Getting started`
|
||||
==================
|
||||
@@ -398,15 +365,14 @@ To enable our bot to respond to inline queries, we can add the following (you wi
|
||||
>>> inline_caps_handler = InlineQueryHandler(inline_caps)
|
||||
>>> dispatcher.add_handler(inline_caps_handler)
|
||||
|
||||
People might try to send commands to the bot that it doesn't understand, so we can use a ``RegexHandler`` to recognize all commands that were not recognized by the previous handlers. **Note:** This handler has to be added last, else it will be triggered before the ``CommandHandlers`` had a chance to look at the update:
|
||||
People might try to send commands to the bot that it doesn't understand, so we can use a ``MessageHandler`` with a ``command`` filter to recognize all commands that were not recognized by the previous handlers. **Note:** This handler has to be added last, else it will be triggered before the ``CommandHandlers`` had a chance to look at the update:
|
||||
|
||||
.. code:: python
|
||||
|
||||
>>> def unknown(bot, update):
|
||||
... bot.sendMessage(chat_id=update.message.chat_id, text="Sorry, I didn't understand that command.")
|
||||
...
|
||||
>>> from telegram.ext import RegexHandler
|
||||
>>> unknown_handler = RegexHandler(r'/.*', unknown)
|
||||
>>> unknown_handler = MessageHandler([Filters.command], unknown)
|
||||
>>> dispatcher.add_handler(unknown_handler)
|
||||
|
||||
If you're done playing around, stop the bot with this:
|
||||
|
||||
+1
-1
@@ -60,7 +60,7 @@ author = u'Leandro Toledo'
|
||||
# The short X.Y version.
|
||||
version = '4.1'
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = '4.1.1'
|
||||
release = '4.1.2'
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
|
||||
@@ -24,7 +24,7 @@ def requirements():
|
||||
|
||||
|
||||
setup(name='python-telegram-bot',
|
||||
version='4.1.1',
|
||||
version='4.1.2',
|
||||
author='Leandro Toledo',
|
||||
author_email='devs@python-telegram-bot.org',
|
||||
license='LGPLv3',
|
||||
|
||||
@@ -81,7 +81,7 @@ from .update import Update
|
||||
from .bot import Bot
|
||||
|
||||
__author__ = 'devs@python-telegram-bot.org'
|
||||
__version__ = '4.1.1'
|
||||
__version__ = '4.1.2'
|
||||
__all__ = ['Audio', 'Bot', 'Chat', 'ChatAction', 'ChosenInlineResult', 'CallbackQuery', 'Contact',
|
||||
'Document', 'Emoji', 'File', 'ForceReply', 'InlineKeyboardButton',
|
||||
'InlineKeyboardMarkup', 'InlineQuery', 'InlineQueryResult', 'InlineQueryResult',
|
||||
|
||||
@@ -33,13 +33,13 @@ class MessageEntity(TelegramObject):
|
||||
url (Optional[str]):
|
||||
"""
|
||||
|
||||
def __init__(self, type, offset, length, url=None):
|
||||
def __init__(self, type, offset, length, **kwargs):
|
||||
# Required
|
||||
self.type = type
|
||||
self.offset = offset
|
||||
self.length = length
|
||||
# Optionals
|
||||
self.url = url
|
||||
self.url = kwargs.get('url')
|
||||
|
||||
@staticmethod
|
||||
def de_json(data):
|
||||
|
||||
+2
-2
@@ -145,7 +145,7 @@ class BotTest(BaseTest, unittest.TestCase):
|
||||
chat_id=self._chat_id)
|
||||
|
||||
self.assertTrue(self.is_json(message.to_json()))
|
||||
self.assertEqual(message.photo[0].file_size, 684)
|
||||
self.assertEqual(message.photo[0].file_size, 685)
|
||||
|
||||
@flaky(3, 1)
|
||||
@timeout(10)
|
||||
@@ -155,7 +155,7 @@ class BotTest(BaseTest, unittest.TestCase):
|
||||
chat_id=self._chat_id)
|
||||
|
||||
self.assertTrue(self.is_json(message.to_json()))
|
||||
self.assertEqual(message.photo[0].file_size, 684)
|
||||
self.assertEqual(message.photo[0].file_size, 685)
|
||||
|
||||
@flaky(3, 1)
|
||||
@timeout(10)
|
||||
|
||||
Reference in New Issue
Block a user