Compare commits

..

5 Commits

Author SHA1 Message Date
Jannes Höke dc27ff41ef bump version to 4.1.2 2016-05-22 13:01:14 +02:00
Jannes Höke 68ec73afb6 use kwargs on messageentity 2016-05-22 12:58:19 +02:00
Rahiel Kasim 0ace0aa016 README: remove "Getting the Code" section, confuses users like #297 2016-05-19 17:06:28 +02:00
Jannes Höke f5847be8ca update file size from 684 to 685 2016-05-17 10:19:00 +02:00
Jannes Höke ba26a8ba5d use command filter instead of regexhandler #292 2016-05-17 07:36:04 +02:00
7 changed files with 15 additions and 43 deletions
+6
View File
@@ -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
View File
@@ -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
View File
@@ -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.
+1 -1
View File
@@ -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',
+1 -1
View File
@@ -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',
+2 -2
View File
@@ -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
View File
@@ -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)