Commit graph

1243 commits

Author SHA1 Message Date
Jacob Bom
3244417f61 Add docs for filters. 2016-09-25 00:30:04 +02:00
Jacob Bom
61596400e1 __call__ should return the result
Also add tests with both & and |.
2016-09-24 18:56:54 +02:00
Jacob Bom
be0f5bc519 Merge branch 'master' into bitwise-filters
# Conflicts:
#	telegram/ext/messagehandler.py
#	tests/test_filters.py
2016-09-24 18:30:58 +02:00
Jacob Bom
921fbae2f3 Merge branch 'master' into bitwise-filters 2016-09-24 18:21:06 +02:00
Jacob Bom
2161681131 Use filter method instead of __call__
__call__ is scary looking for users wanted to create their own filters.
Also allows us to put additional logic in __call__ if we want in the future.
2016-09-24 18:20:32 +02:00
Jannes Höke
9d0e0386d9 Link echobot2 example from master 2016-09-24 16:30:39 +02:00
Rahiel Kasim
dc7a459511 README: formatting (adding a newline) 2016-09-24 15:46:02 +02:00
Jannes Höke
be675f0118 update all examples to use instance methods (#421) 2016-09-24 15:32:22 +02:00
Jannes Höke
c49058dbb4 Bump version to v5.1 2016-09-24 15:29:23 +02:00
Jannes Höke
8e80a8d273 comment out test_reply_contact 2016-09-24 14:25:31 +02:00
Jannes Höke
cbe057083f fix test_send_photo_resend 2016-09-24 14:16:04 +02:00
Jacob Bom
5f6138b06b Merge pull request #409 from python-telegram-bot/entities-filter
Add entities filter
2016-09-24 14:02:01 +02:00
Jacob Bom
1b99caa2f9 Merge remote-tracking branch 'origin/master' into entities-filter 2016-09-24 13:46:55 +02:00
Jacob Bom
e16c1da6b1 Change entities filter to be singular.
Also remove the faulty example completely since it should be no longer needed.
2016-09-24 13:38:56 +02:00
Jannes Höke
e1242b3b4a message.py: add quote keyword argument to reply_x methods (#420) 2016-09-23 17:44:09 +02:00
Gareth Dwyer
93dde1ac1d Add install from source instructions to readme (#419) 2016-09-23 17:13:32 +02:00
Jannes Höke
05fb9d161a Link echobot2 example from tag v5.0 2016-09-23 17:13:06 +02:00
Eli Gao
a91fe5f8f6 Properly split and handle arguments in CommandHandler (#414)
* Properly split and handle arguments in CommandHandler

* Update the docstring for pass_args in CommandHandler

* Properly split and handle arguments in StringCommandHandler
2016-09-20 06:38:49 +02:00
Jannes Höke
5116a77221 Class methods (#362)
* bot.py: add create_references method

* create bot reference in webhook handler, use create_references on new updates

* message.py: implement reply_text

* echobot2.py: use Message.reply_text

* fix create_references in webhook handler

* add some more instance methods

* Chat.kick_member and unban_member

* bot.py: Create bot references in outgoing messages

* add tests for everything testable

* test_updater.py: add create_references method to MockBot

* remove Bot.create_references and refactor TelegramObject.de_json to take the additional parameter bot

* List bot as named kwarg where used

* file.py: Use Bot.request property instead of Bot._request attr
2016-09-20 06:36:55 +02:00
Jannes Höke
1f597c6b4a Merge branch 'LiaungYip-master' 2016-09-20 05:07:00 +02:00
Jannes Höke
1efd330e59 ConversationHandler: Fix #373 2016-09-20 05:00:39 +02:00
Jannes Höke
af3e8c6440 Merge branch 'master' of https://github.com/LiaungYip/python-telegram-bot into LiaungYip-master 2016-09-20 04:10:39 +02:00
Jacob Bom
f34c09dd72 Fix image sizes in tests. 2016-09-14 19:58:30 +02:00
Jacob Bom
71e74da0a2 Make filters and/or-able using bitwise operators.
See associated PR for more info.
2016-09-14 19:29:15 +02:00
Jacob Bom
97bb04cd38 Faulty example was faulty. 2016-09-13 20:50:25 +02:00
Jacob Bom
7ab007d8d4 Add Filters.entities test. 2016-09-13 20:47:43 +02:00
Jacob Bom
f7b497c1b4 Fix in keyword ordering
We're testing for a string in list, not the other way around :P
2016-09-13 20:45:42 +02:00
Jacob Bom
4e60008086 Add entities filter
Should ideally superseed #375.
2016-09-13 20:09:46 +02:00
Rahiel Kasim
5285f63e4a Merge pull request #388 from python-telegram-bot/emoji
deprecate telegram.Emoji
2016-09-13 19:25:58 +02:00
Jacob Bom
6647ae3c25 Add methods to parse entities in Message
Should close #400.

* Add parse_entity

* Add parse_entities

* Add MessageEntity types as constants to MessageEntity.

* Add MAX_MESSAGE_ENTITIES to constants.py
Note: the value has been found by experimentation as opposed to extracted from the api docs.

* Add tests for parse_entity and parse_entities
2016-09-07 08:49:09 +02:00
Noam Meltzer
e4a132c0e4 Reusable dispatcher (#402)
* Create a Request class which maintains its own connection pool
* When creating a Bot instance a new Request instance will be created if one wasn't supplied.
* Updater is responsible for creating a Request instance if a Bot instance wasn't provided.
* Dispatcher: add method to run async functions without decorator
* Dispatcher can now run as a singleton (allowing run_async decorator to work) as it always did and as multiple instances (where run_async decorator will raise RuntimeError)
2016-09-06 16:38:07 +03:00
Rahiel Kasim
ca81a75f29 Merge pull request #396 from python-telegram-bot/json
use ujson as JSON en/decoder if available
2016-08-26 11:42:28 +02:00
Rahiel Kasim
da87d4ba78 fix yapf 2016-08-26 11:17:05 +02:00
Rahiel Kasim
4753d27bd5 bump yapf to 0.11.0 2016-08-26 10:55:41 +02:00
Rahiel Kasim
eabfc0b06b set ujson as optional dependency, test CPython builds with ujson 2016-08-26 10:23:17 +02:00
Rahiel Kasim
fcda567f8c use ujson as JSON en/decoder if available 2016-08-26 09:40:46 +02:00
Li-aung 'Lewis' Yip
1c36ff46ad Add myself to AUTHORS.rst 2016-08-24 09:37:23 +08:00
Jacob Bom
ffff0938f4 Add forwarded filter (#392) 2016-08-23 16:55:50 +02:00
Li-aung 'Lewis' Yip
ab2d6eb494 Fix "key not found" exception if the very first message handler in a ConversationHandler returns the state ConversationHandler.END. 2016-08-22 05:49:37 +08:00
Rahiel Kasim
fe14000515 remove tests for telegram.Emoji 2016-08-21 11:58:00 +02:00
Rahiel Kasim
5d27059631 deprecate telegram.Emoji 2016-08-21 11:50:22 +02:00
Rahiel Kasim
00bba73673 drop Python 2.6 support (closes #245) (#386)
* drop Python 2.6 support (closes #245)

* fix NullHandler import

* README: explicitly mention Py3 and PyPy compatibility
2016-08-20 22:01:07 +02:00
eugenio412
e9c5ee7ad6 unset but (#383)
solved the bug that prevented the unset to work
2016-08-16 21:13:31 +02:00
MWeesenaar
f2f62423ba Merge pull request #379 from bomjacob/master
Fix #376: Execfile not in python 3. Take #2
2016-08-11 14:58:24 +02:00
Mikki Weesenaar
26a0a173f4 Manual merge 2016-08-11 14:38:55 +02:00
Jacob Bom
b736e1e855 Move the exec out of function, since that's a whole other scope... 2016-08-11 13:08:28 +02:00
Jacob Bom
bd3fa3bb64 Fix #376: Execfile does not exist in python 3 (#377)
* Add execfile function since it's missing in python 3.

* Remove extra space.
2016-08-10 21:39:14 +02:00
Jacob Bom
c252042ddf Remove extra space. 2016-08-10 21:00:01 +02:00
Jacob Bom
8475c322af Add execfile function since it's missing in python 3. 2016-08-10 20:59:11 +02:00
Ilya Strukov
dd4c0f0f1d Add missing return statement in timerbot example (#368) 2016-08-07 17:59:58 +02:00