Commit graph

642 commits

Author SHA1 Message Date
Jacob Bom
c626044a30 Add "all" filter
Since and empty list cannot (in the future, currently only deprecated) be used.
2016-10-15 22:58:55 +02:00
Jacob Bom
ca5e3146c6 Fix docstring according to Jannes' commentns. 2016-10-14 10:32:12 +02:00
Jacob Bom
79bdfe4c5d Allow filters to be passed without list.
Also deprecates actually using a list.
2016-09-29 19:10:22 +02:00
Jacob Bom
79e065a730 Add __str__ and __repr__ to MergedFilter. 2016-09-25 16:31:06 +02:00
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
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
c49058dbb4 Bump version to v5.1 2016-09-24 15:29:23 +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
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
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
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
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
da87d4ba78 fix yapf 2016-08-26 11:17:05 +02:00
Rahiel Kasim
fcda567f8c use ujson as JSON en/decoder if available 2016-08-26 09:40:46 +02: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
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
Jannes Höke
5134f71380 Merge branch 'more-regex-handlers' of https://github.com/bomjacob/python-telegram-bot into bomjacob-more-regex-handlers 2016-08-06 14:32:05 +02:00
Jacob Bom
32268597d9 Wrap long lines 2016-08-06 14:19:41 +02:00
Jacob Bom
cd2f956e56 Also fix linebreak ^^ 2016-08-06 13:35:58 +02:00
Jacob Bom
18fdb5ed13 Fix weird indent. 2016-08-06 13:35:06 +02:00
Jacob Bom
8c698caa12 Add Regex handling to CallbackQueryHandler and InlineQueryHandler.
Mostly a copy-paste from RegexHandler.
Not fully tested! Also needs yapf - sorry.
2016-08-06 13:33:38 +02:00
Jannes Höke
587908457e move version string to telegram/version.py (#361) 2016-07-29 15:40:11 +00:00
overquota
f1ee54fa73 ChatMigrated exception (#353)
* ChatMigrated exception
2016-07-25 21:50:33 +03:00
Jannes Höke
834bf192b9 Bump version to v5.0.0 2016-07-15 01:48:11 +02:00
Jannes Höke
ad3eec2af8 ConversationHandler (#331)
* initial commit for conversationhandler and example

* implement simple Promise for run_async/conversationhandler

* refactor Promise._done to done

* add handling for timed out Promises

* correctly handle promises with None results

* fix handling tuple states

* update comments on example

* Added a first test on the ConversationHandler.

* Fixed a small typo.

* Yapf'd.

* add sphinx doc for conversation handler

* fix title for callbackqueryhandler sphinx docs
2016-07-15 01:30:54 +02:00
Rahiel Kasim
04a871aff5 introduce constants module (#342) 2016-07-14 21:48:31 +02:00
Jannes Höke
81a755a7d8 Merge branch 'urllib3_fix_proxy_auth' 2016-07-13 15:09:23 +02:00
Noam Meltzer
6016aca0ba Bump version to v4.3.4 2016-07-12 23:34:49 +03:00
Noam Meltzer
7c908db901 urllib3: can now connect through proxies which require auth
fixes #343
2016-07-12 23:31:38 +03:00
Noam Meltzer
d192b385ea dispatcher: add comment to describe the reason for conpool size 2016-07-12 21:58:27 +03:00
Jannes Höke
f0b2028e3f Merge pull request #344 from python-telegram-bot/silence-webhook-logging
Move webhook handler logs to logging at DEBUG level
2016-07-12 14:35:14 +02:00
Mikki Weesenaar
f443003408 Small change in the documentation. 2016-07-12 13:45:37 +02:00
Jannes Höke
afc36a235b move webhook handler logs to logging at DEBUG level 2016-07-11 23:44:40 +02:00
Noam Meltzer
b76337de87 __main__.py: assist with creating issues on github
usage:
python -m telegram

and copy/paste the output
2016-07-09 14:40:53 +03:00
Noam Meltzer
6afee6e0bd Merge pull request #340 from python-telegram-bot/v4.3.x
urllib3: now supports proxy
2016-07-08 23:53:56 +03:00
Jannes Höke
27e57bbf58 Bump version to v4.3.3 2016-07-08 22:13:46 +02:00
Noam Meltzer
b3e42c3e20 urllib3: now supports proxy
fixes #336
2016-07-08 22:33:37 +03:00