Commit graph

909 commits

Author SHA1 Message Date
Jannes Höke
09ddc1b1a8 DAAAANGER ZOOOONE 2016-12-14 16:27:45 +01:00
Jannes Höke
c7cd379016 jobqueue.py: move the check for job.interval types into Job.__init__ 2016-12-14 06:30:18 +01:00
Jannes Höke
92dc9b81ce bot.py: implement changes of december 04 (bot api 2.3.1) 2016-12-14 00:50:34 +01:00
Jannes Höke
8ead72e3ef jobqueue: add support for specifying next_t in datetime.datetime or datetime.time 2016-12-13 23:38:13 +01:00
Jannes Höke
71530f404d Bump version to v5.3.0 2016-12-11 23:51:51 +01:00
Jeong Arm
c5f9e53d44 Add "reply" filter (#465)
* Add "reply" filter

This filter will filter messages that reply to other's message.

* Add test for "reply" filter

* Add "Kjwon15" to AUTHORS.rst
2016-12-11 22:45:51 +01:00
Noam Meltzer
acf1541395 Botapi2.3 (#471)
* New fields channel_post and edited_channel_post for Update

refs #468

* setGameScore() changes

 - Changed behaviour: messages with high scores will be update with new
   high scores by default. (documentation fix)
 - Use (new) disable_edit_message in setGameScore to disable the above new
   behaviour.
 - The edit_message parameter from setGameScore is no longer in use. For
   backward compatibility, it will be taken into account for a while,
   unless disable_edit_message is passed explicitly.

refs #468

* New field forward_from_message_id for Message.

refs #468

* New parameter cache_time for answerCallbackQuery

refs #468

* replykeyboardhide renamed to replykeyboardremove

refs #468

* Unitests for updated setGameScore semantics

refs #468

* Backward compatibility for ReplyKeyboardHide

refs #468

* Fix docstrings of wrapper methods in Message

* Unitest new field forward_from_message_id of Message

refs #468

* Fix testMaxCaptionLength

Telegram servers changed their behaviour - now they truncate a long
caption instead of returning an error.

* MessageHandler: Added support for channel posts

* Fix flake8 complaints in a manner which yapf will like it too.

* fix rst markup
2016-12-11 22:44:52 +01:00
Jacob Bom
906a1b8d7d message.edit_reply_markup now correctly edits reply_markup (#473) 2016-12-08 13:23:51 +01:00
lisitsky
a2fddbe85c Fix telegram API change, returning '404 Not found' (#461)
* Fix telegram API change, returning '404 Not found' with raising own TelegramError rather native exception

* Change exception to InvalidToken in test and request util

* Added myself to AUTHORS. Thx for appreciation :)
2016-11-09 14:36:42 +01:00
Wesley Gahr
68e87db909 Job queue time units (#452)
* Adding timeunit and day support to the jobqueue

* Adding tests

* Changed the file permission back to 644.

* Changed AssertEqual argument order to (actual, expectd).

* Removed the TimeUnit enum and unit param, instead use datetime.time for interval.

* Removing the TimeUnits enum and unit param in favour of optionally using a datetime.time as the interval.

* Removing the TimeUnits enumeration, forgot the remove it in the last one.

* Removed some old docstrings refering to the TimeUnits enum.

* Removed the old TimeUnits import.

* Adding some error handling for the 'days' argument (only a 'tuple' with 'Days')

* Writing the error message directly in the exception.

* Moving a debug statement wrongfully saying a job would be running on days it wouldn't.

* Writing error messages directly in the exceptions instead of making an extra variable.

* Replacing datetime.time in favour of datetime.timedelta because of the get_seconds() method.

* Adding error handling for the method .

* Splitting the tests up in multiple ones, no float test because I haven't found a reliable way to test it.

* Excluding .exrc file.

* Removing \ at EOF of ValueError.

* Replacing Enums with plain new-style classes.

* Using numbers.number to check for ints/floats instead of seperate int/float checks.

* Fixing typo, number -> Number.

* Changed lower_case Days attributes to UPPER_CASE.

* Different formatting for Days class, removed the get_days function in favour of a tuple.

* Removed redundant function get_days.

* Edited the docstring for next_t to also take datetime.timedelta.

* Removed for-loop in favour of any().

* Changed docstring for interval.

* Removed debug print.

* Changing some docstrings.

* Changing some docstrings (again).
2016-11-08 23:39:25 +01:00
Jannes Höke
65061f8a99 [ci skip] docs: add all missing classes 2016-11-01 09:01:36 +01:00
Jannes Höke
aa3ca38837 Sphinx restructuring: Now builds PDF and better HTML docs (#449)
* update sphinx source files to properly build latexpdf and improve html build

* fix docstrings and sphinx sources to get rid of warnings

* add telegram.contrib.rst
2016-11-01 06:53:51 +01:00
Jannes Höke
2786252a51 Bump version to v5.2.0 2016-10-25 20:10:36 +02:00
neutronnnate
761547e71d Issue 422: Fixed start_polling with clean=True can cause 'Too Many Requests' error from Telegram. (#437) 2016-10-25 19:30:05 +02:00
Jannes Höke
10bdf8212c Add pass_user_data and pass_chat_data to Handler (#436)
* initial commit for user_data

* add chat_data and use defaultdict

* fix chat_data copy-paste error

* add test for user_data and chat_data

* fix case where chat is None

* remove braces from import line
2016-10-25 19:28:34 +02:00
Kristofer Kirss
45936c9982 Remove deprecated argument from Updater docstring (#444)
Argument (job_queue_tick_interval) was removed with commit 3aedd78 but the docstring in updater.py wasn't.
2016-10-23 00:31:44 +03:00
Jacob Bom
960862ccb1 Merge branch 'master' into october3
# Conflicts:
#	telegram/bot.py
#	telegram/callbackquery.py
#	telegram/chat.py
#	telegram/ext/messagehandler.py
#	telegram/inlinekeyboardbutton.py
#	telegram/inlinequeryresultcachedaudio.py
#	telegram/message.py
#	tests/test_filters.py
2016-10-19 12:35:50 +02:00
Jacob Bom
4e5f4582dd Merge pull request #411 from python-telegram-bot/bitwise-filters
Make filters and/or-able using bitwise operators.
2016-10-19 11:40:35 +02:00
Jacob Bom
225bc24c2a Merge pull request #442 from python-telegram-bot/explicit-kwargs
Use explicit kwargs and change/add a bunch of documentation.
2016-10-19 11:36:19 +02:00
Noam Meltzer
a5f9aa3171 more documentation 2016-10-17 23:44:40 +03:00
Noam Meltzer
78088f4f6a Fix grammer: 'a object' -> 'an object' 2016-10-17 01:22:40 +03:00
Noam Meltzer
59fa717023 Documentation improvements + small style fixes 2016-10-17 01:11:20 +03:00
Noam Meltzer
31cab0d1b4 editMessageCaption & editMessageReplyMarkup: more validation on input 2016-10-17 01:09:44 +03:00
Jacob Bom
e367b8519d Use explicit kwargs for all class inits in pure api.
While not stickily necessary for most classes (since user isn't directly creating them) it still unifies our approach.
However for some like ReplyKeyboardHide where users are making the classes themselves it should improve IDE autocomplete support.
2016-10-16 16:24:13 +02:00
Jacob Bom
b610316667 Use explicit kwargs for all bot methods.
This improves support for many IDEs' autocompletion.
2016-10-16 15:54:48 +02:00
Jacob Bom
62dd3a33e6 Better kwargs defaults. 2016-10-16 12:41:12 +02:00
Jacob Bom
3754cdafb2 send_game has differnt kwargs. 2016-10-16 12:41:12 +02:00
Jacob Bom
305ff93018 set_game_score might return True 2016-10-16 12:41:12 +02:00
Jacob Bom
a5671a8fb1 Merge pull request #423 from python-telegram-bot/edit-class-method
Add edit_* class methods
2016-10-15 23:03:43 +02:00
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
Noam Meltzer
a68cf8d464 Respect RetryAfter with polling Updater 2016-10-15 23:39:50 +03:00
Jacob Bom
ca5e3146c6 Fix docstring according to Jannes' commentns. 2016-10-14 10:32:12 +02:00
Noam Meltzer
53a574bbbb Improve unitests coverage 2016-10-13 22:52:53 +03:00
Noam Meltzer
5b8efe0c14 upgrade yapf to ver 0.12.2 2016-10-12 23:56:57 +03:00
Noam Meltzer
32a78722ae yapf fixes 2016-10-12 23:33:52 +03:00
Patrick Hofmann
8dc10fc7b2 fixes broken test cases with PhotoSize, Game and Animation classes (#435)
* fixes broken test with PhotoSize, Game and Animation

However:
testSendGame and test_set_game_score both produces *BadRequest: u'Wrong file identifier/HTTP URL specified'*.

* fixes test_set_game_score

* adds to_dict method to Game to prevent extra collection type checks in base.TelegramObject
2016-10-10 11:44:40 +02:00
Jacob Bom
b7c7612b3f Add game filter 2016-10-07 22:37:29 +02:00
Patrick Hofmann
8cab735342 small fix for game related parts
* bot.py fix copy paste error in url
* callbackquery.py make data field optional
* message.py introduce optional game field
2016-10-06 17:52:53 +02:00
Noam Meltzer
01a5a1c5b3 small documentation fix 2016-10-05 23:22:55 +03:00
Noam Meltzer
1f9d3163dd Game: use explicit keyword args + added docmentation 2016-10-04 02:17:12 +03:00
Noam Meltzer
837e9d2964 Animation: use explicit keyword args + added documentation 2016-10-04 02:16:33 +03:00
Noam Meltzer
fab97df58a GameHighScore: added attributes documentation 2016-10-04 02:06:22 +03:00
Noam Meltzer
d70fc48e94 getGameHighScores(): added documentation + fixed copy-paste errors 2016-10-04 01:57:19 +03:00
Noam Meltzer
36192912c2 setGameScore: fixes
- fix copy/paste errors
 - return Message object
2016-10-04 01:56:05 +03:00
Noam Meltzer
34748ec228 callbackgame: small documentation fix 2016-10-04 01:50:34 +03:00
Noam Meltzer
d5567cd9cd sendGame(): mall fixes 2016-10-04 01:37:44 +03:00
Noam Meltzer
2463b4b9c8 New exception: RetryAfter
Also, small fix to the description text of ChatMigrated
2016-10-04 01:27:45 +03:00
Noam Meltzer
7cf5009517 small documentation fixes 2016-10-04 01:10:30 +03:00
Noam Meltzer
9b74625d4a answerCallbackQuery: fix copy/paste: show_alert -> url 2016-10-04 00:55:29 +03:00
Noam Meltzer
4180c069b3 InputFile: use self instead of explicit class name 2016-10-04 00:25:32 +03:00
Noam Meltzer
3a0f219783 inputfile: define the file types as constant and use iterator 2016-10-04 00:25:05 +03:00
Noam Meltzer
3c889655c1 Allow http url as a file_id
N.B. test_send_video_mp4_file_url() is still failing, probably because
of telegram servers bug. Will contact telegram bot support about that.
2016-10-04 00:20:17 +03:00
Jacob Bom
5e2d96b47d Make tests actually run at all 2016-10-03 21:07:41 +02:00
Jacob Bom
551f6c556c Add game parameters in various places
Also chat_instance in CallbackQuery which will break a lot of tests probably
2016-10-03 21:01:38 +02:00
Jacob Bom
ae17eb3272 Add InlineQueryResultGame 2016-10-03 20:55:21 +02:00
Jacob Bom
358dd795c7 Add the rest of game_ methods to bot. 2016-10-03 20:43:02 +02:00
Jacob Bom
151a441af7 Add send_game 2016-10-03 20:40:17 +02:00
Noam Meltzer
1f67623615 Fix import order 2016-10-03 21:34:08 +03:00
Noam Meltzer
8737b5de63 fix syntax error by some weird char 2016-10-03 21:17:04 +03:00
Jacob Bom
f3b8a3a5e9 Merge remote-tracking branch 'origin/october3' into october3 2016-10-03 20:10:14 +02:00
Jacob Bom
9e9309eb90 Add all new Game related classes
Missing docstrings for now though, wanna add everything first
2016-10-03 20:09:57 +02:00
Noam Meltzer
e8a34d8eef cosmetic fixes and documentation for getWebhookInfo 2016-10-03 20:43:10 +03:00
Jacob Bom
34c62a633b Add url to answerCallbackQuery 2016-10-03 15:25:07 +02:00
Jacob Bom
868d9217bc Add WebhookInfo and getWebhookInfo
Still needs tests though
2016-10-03 15:16:43 +02:00
Jacob Bom
f7ede4baea Add caption fields to voice and audio
Or at least the methods/classes for sending.
2016-10-03 15:05:49 +02:00
Jacob Bom
c3e07b1056 Add switch_inline_query_current_chat 2016-10-03 14:52:58 +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
Michael Elovskikh
46657afa95 Start additional threads only when necessary (#415)
* Start all additional threads only when necessary.

* Deprecate prevent_autostart in the c'tor of JobQueue.
2016-09-27 10:21:35 +03:00
Jacob Bom
79e065a730 Add __str__ and __repr__ to MergedFilter. 2016-09-25 16:31:06 +02:00
Jacob Bom
0e2c3666c0 Add edit_* family of methods to CallbackQuery.
Either edits the message attribute, or the message associated with the inline_message_id.
2016-09-25 16:03:06 +02:00
Jacob Bom
a996e8873f Add edit_* family of methods to Message. 2016-09-25 15:50:58 +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
Jannes Höke
c2cce40299 Merge branch 'use-timeout' 2016-07-04 21:56:26 +02:00
Jannes Höke
a2ed7b26f1 Bump version to v4.3.2 2016-07-04 21:52:00 +02:00
Jannes Höke
89a3dc8372 use urlopen timeout 2016-07-04 21:40:31 +02:00
Jannes Höke
9fd298a393 Merge pull request #307 from python-telegram-bot/jobqueue-rework
Make job queue API similar to the dispatcher, add new functionality
2016-06-29 16:20:43 +02:00
Jannes Höke
ecbc268781 Bump version to v4.3.1 2016-06-29 15:53:52 +02:00
Jannes Höke
57efde5e0f Bump version to v4.3 2016-06-28 13:35:42 +02:00
Jannes Höke
31073101a3 yapf 2016-06-24 19:22:49 +02:00
Noam Meltzer
1e0ebe89f3 JobQueue: minimize the amount of places changing self.__tick state
- start the jobqueue (by default) during __init__() instead of during
   put()
 - protect self._next_peek and self.__tick with a Lock
 - rename self._start() to self._main_loop()
 - stop() is now blocking until the event loop thread exits
2016-06-24 19:35:54 +03:00
Noam Meltzer
f65b6911ea JobQueue: use class name for the logger name 2016-06-24 19:13:40 +03:00
Noam Meltzer
02af1ea803 jobqueue: cosmetic fixes 2016-06-24 19:13:40 +03:00
Jannes Höke
c4a8ee5175 Merge branch 'master' into jobqueue-rework
Conflicts:
	tests/test_jobqueue.py
2016-06-20 05:32:15 +02:00
Jannes Höke
738e3213a7 Merge branch 'master' into jobqueue-rework 2016-06-20 00:49:01 +02:00
leandrotoledo
b41f7e3e79 Code style with latest yapf 2016-06-19 17:50:02 -04:00
Jannes Höke
7635bc0eec comments, lock thread pool, while 1 and snake_case everywhere 2016-06-19 23:46:34 +02:00
Jannes Höke
703bece155 set loglevel of urllib3 to WARNING by default 2016-06-19 23:40:34 +02:00
Noam Meltzer
5b91194cc7 new yapf version, new cosmetic fixes 2016-06-18 20:05:10 +03:00
Noam Meltzer
494a7ec1e4 ypaf fixes 2016-06-18 19:57:11 +03:00
Noam Meltzer
fc05d3a626 switch back to PoolManager
telegram servers might send a reponse with HTTP 302 (redirect) to
another hostname. in such case HTTPSConnectionPool will fail to do the
job
2016-06-18 19:50:18 +03:00
Noam Meltzer
a814e9de6b make sure to stop conpool between sensitive unitests 2016-06-18 00:50:44 +03:00
Noam Meltzer
e479c7f25e type hinting (cosmetic fix) 2016-06-17 23:59:32 +03:00
Noam Meltzer
a30411c9fa make sure to remove the stopped dispatcher threads from ASYNC_THREADS 2016-06-17 23:58:22 +03:00
Noam Meltzer
881d1d0e25 fix/hack Updater.stop() not working on extreme cases
during test_bootstrap_retries_fail() there is an exception raised (by
design): TelegramError('test')

For a reason I haven't managed to pinpoint the above exception in its
precise timing caused the Updater to be left in a state which is
'self.running == False', but the dispatcher threads already initialized.
This patch identifies this extreme case and makes sure to go over the
stop procedure.
2016-06-17 23:53:18 +03:00
Noam Meltzer
cb6ddfded5 Merge remote-tracking branch 'origin/master' into urllib3 2016-06-17 17:54:04 +03:00
Noam Meltzer
bda0244ed8 updater: fix print in log 2016-06-17 16:52:25 +03:00
leandrotoledo
897f9615f0 Bump version to v4.2.1 2016-06-10 09:44:17 -04:00
leandrotoledo
bbbc622517 Adds @message decorator to editMessageText #320 2016-06-03 13:28:29 -04:00
Noam Meltzer
1f5601dae2 fix SyntaxWarning 2016-06-01 22:38:08 +03:00
Noam Meltzer
3608c2bbe5 dispatcher: if connection pool is already initialized raise exception
this will better protect the user from wrong usage
2016-06-01 22:30:34 +03:00
Noam Meltzer
c28763c5be dispatcher: cosmetic fix 2016-06-01 22:30:33 +03:00
Noam Meltzer
dd8b6219b9 dispatcher: a little performance improvment 2016-06-01 22:30:33 +03:00
Noam Meltzer
78f9bdcac9 dispatcher: pep8 style fix
globals are supposed to be upper case
2016-06-01 22:30:09 +03:00
Jannes Höke
b08d41d0ff formatting 2016-05-31 15:35:40 +02:00
Jannes Höke
de2d732135 Merge branch 'master' into jobqueue-rework
Conflicts:
	README.rst
	telegram/ext/commandhandler.py
	telegram/ext/messagehandler.py
2016-05-31 15:34:36 +02:00
Jannes Höke
1ff348adbb issue warning if connection pool was initialized before Dispatcher 2016-05-31 13:47:43 +02:00
Jannes Höke
6b457bada5 use keepalive for connection pool 2016-05-31 13:45:43 +02:00
Jannes Höke
74283bd414 use HTTPSConnectionPool instead of PoolManager 2016-05-30 17:12:50 +02:00
Jannes Höke
41f6591ac6 more sensible logging 2016-05-30 17:12:27 +02:00
Juan Madurga
073d7949dc fix callbackquery to_dict 2016-05-30 15:59:45 +02:00
Jannes Höke
dd91ce1f39 use single queue for thread pool, initialize connection pool with n+3 2016-05-30 13:09:23 +02:00
Jannes Höke
57759d8e6d [drunk] use actual thread pool and queue new functions into the pool instead of starting new threads every time 2016-05-30 03:16:33 +02:00
Noam Meltzer
574fc8cddf urllib3: validate https certificate 2016-05-30 01:05:19 +03:00
Noam Meltzer
3076dfc086 use urllib3 instead of urllib(2) 2016-05-30 01:05:19 +03:00
Jannes Höke
41432f5b02 bump version to v4.2.0 2016-05-28 22:49:15 +02:00
Rahiel Kasim
f31bd91673 Merge pull request #305 from python-telegram-bot/move-botan
move botan from utils to contrib
2016-05-28 21:32:07 +02:00
Noam Meltzer
7e7acdeb23 set default network_delay to 5 seconds
fixes #309
2016-05-28 19:34:16 +03:00
Jannes Höke
25bcfa9b35 add constants for Chat.type and ChatMember.status 2016-05-28 16:51:44 +02:00
Jannes Höke
ff00e211d7 include in warning that Py2.7 will still be supported 2016-05-28 16:44:39 +02:00
Jannes Höke
d40f0a8309 update update_queue and job_queue docstrings on all handlers 2016-05-28 16:04:19 +02:00
Jannes Höke
783f9c375c move job_queue kwarg to end 2016-05-28 14:21:39 +02:00
Jannes Höke
406303d6bb refactor: running -> _running, next_peek -> _next_peek 2016-05-28 13:48:30 +02:00
Jannes Höke
2534e0df9b allow jobs to be ran outside of jobqueue 2016-05-28 13:41:23 +02:00
Rahiel Kasim
b06983a94a let python 2 find the contrib module 2016-05-28 09:27:17 +02:00
Rahiel Kasim
c8497424b7 move botan to contrib 2016-05-28 09:12:10 +02:00
Jannes Höke
a0bb5730c6 add allow_edited parameter to MessageHandler and CommandHandler 2016-05-27 11:07:06 +02:00
Leandro Toledo
9a13de4a96 Merge remote-tracking branch 'origin/master' into bot2.1
Conflicts:
	telegram/bot.py
	tests/test_bot.py
2016-05-26 16:15:50 -03:00
Noam Meltzer
561f1c3f02 bot: validate token does not contain white spaces (#306)
in addition move validation code from validate.py into bot.py and delete
the former file
2016-05-26 22:09:14 +03:00
Leandro Toledo
3907e64966 Adds telegram.utils.botan back using deprecate 2016-05-26 14:13:27 -03:00
Rahiel Kasim
1abbca3324 bot.py: fix snake_case alias 2016-05-26 15:32:02 +02:00
Jannes Höke
bb165b6acf add pass_job_queue parameter to all handler classes 2016-05-26 14:39:11 +02:00
Jannes Höke
41daccce07 minor comments and formatting 2016-05-26 14:02:52 +02:00
Jannes Höke
786216305c Add context parameter in Job class #281 2016-05-26 13:55:56 +02:00
Leandro Toledo
663fa0013d merge master 2016-05-25 22:09:18 -03:00
Leandro Toledo
37c7af2e14 Add docstrings #302 2016-05-25 21:41:12 -03:00
Leandro Toledo
e70625772c Keeps backwards compatibility to BadRequest #302 2016-05-25 21:24:29 -03:00
Leandro Toledo
1e398821a0 Introducing telegram.error.BadRequest and testLeaveChat testcase #302 2016-05-25 21:15:17 -03:00
Jannes Höke
b3142d2974 yapf 2016-05-25 23:57:29 +02:00
Jannes Höke
3aedd78e29 make job queue API similar to the dispatcher, add new functionality 2016-05-25 23:36:41 +02:00
Rahiel Kasim
c4d5eff9f3 move botan from utils to ext 2016-05-24 23:40:09 +02:00
Leandro Toledo
0b2fd120d8 Due kwargs I had to change the factory class in favor of InputLocationMessageContent #302 2016-05-23 21:09:07 -03:00
Leandro Toledo
ab2f6e13c9 Add kwargs to API calls #302 2016-05-23 20:43:17 -03:00
Leandro Toledo
108e4264fc Add user to MessageEntity #302 2016-05-23 20:31:36 -03:00
Leandro Toledo
68b5562c49 Add edit_date to Message #302 2016-05-23 20:28:36 -03:00
Leandro Toledo
e50a3622e1 Add edited_message to Update #302 2016-05-23 20:24:43 -03:00
Leandro Toledo
d7e226ec0f Add new Bot methods and ChatMember class #302 2016-05-23 20:22:31 -03:00
leandrotoledo
c7db9a96cd Set split_before_logical_operator to True 2016-05-23 17:19:35 -03:00
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
Jannes Höke
d028d4edd0 bump to 4.1.1 2016-05-16 16:05:02 +02:00
Jannes Höke
4d770843cc use non-deprecated methods 2016-05-16 15:02:51 +02:00
leandrotoledo
ac55ba007e Bumping version to v4.1 [ci skip] 2016-05-15 20:05:38 -03:00
Leandro Toledo
49122d6a99 Remove \ from base code #259 2016-05-14 23:26:56 -03:00
Leandro Toledo
d445d35ceb Running yapf for codebase #259 2016-05-14 22:46:40 -03:00
Leandro Toledo
703b8d1301 Adding more pre-commit hooks and testing InputFile #259 2016-05-14 22:24:35 -03:00
Leandro Toledo
56b1d4f5ce Merge pull request #265 from python-telegram-bot/snakes
rename methods to snake_case
2016-05-14 10:56:24 -03:00
Jannes Höke
a18640a8d3 remove str conversion for emoji 2016-05-12 00:16:29 +02:00
Jannes Höke
fdc3ac0cc5 copy paste mishap 2016-05-11 23:37:46 +02:00
Jannes Höke
d881fa6a5f add forward_from_chat field to message 2016-05-11 23:22:05 +02:00
Jannes Höke
c551d71735 add emoji field to sticker 2016-05-11 23:19:35 +02:00
Jannes Höke
bee3d881d1 location docstring fix 2016-05-11 23:07:32 +02:00
Jannes Höke
6ec81dd552 move cleaning updates to bootstrapping phase (#282) 2016-05-11 00:58:55 +03:00
Rahiel Kasim
6e9f30ca6e fix merge conflict snakes 2016-05-02 16:37:45 +02:00
Jannes Höke
252cafb04c fix docs for inlinekeyboardmarkup #277 2016-05-02 14:19:06 +02:00
Jannes Höke
10a98211f8 bump version to 4.0.3 2016-05-01 22:13:27 +02:00
Rahiel Kasim
99c9544a27 Merge pull request #273 from python-telegram-bot/inlinequery_location
Add location attribute #272
2016-05-01 21:27:19 +02:00
Jannes Höke
0e0611767a add location attribute #272 2016-05-01 20:08:34 +02:00
Djaler
4b0be65a76 Fix Bot.getUpdates() docstring 2016-05-01 15:25:07 +03:00
Rahiel Kasim
5971cb35f8 fix merge conflict snakes with master 2016-04-30 14:56:48 +02:00
Jannes Höke
62c651d167 bump version to 4.0.2 2016-04-29 19:31:45 +02:00
Jannes Höke
41e457f5ed Merge pull request #269 from python-telegram-bot/buttons
support str and KeyboardButton for reply_markup
2016-04-29 19:29:12 +02:00
Jannes Höke
d940afa718 merge master into cr4.0 2016-04-29 18:37:41 +02:00
Rahiel Kasim
a327e9d6ff support str and KeyboardButton for reply_markup 2016-04-29 17:42:45 +02:00
Rahiel Kasim
5e5510d42b add deprecation warning for Python 2.6 users 2016-04-28 17:56:03 +02:00
Rahiel Kasim
c0489db17c fix import of deprecate function 2016-04-28 14:47:56 +02:00
Rahiel Kasim
592352c849 dispatcher/*handler methods to snake_case + deprecation warnings 2016-04-28 14:29:27 +02:00
Rahiel Kasim
9d367e9f2c telegram.utils.deprecate: helper module to facilitate deprecation 2016-04-28 14:24:12 +02:00
Rahiel Kasim
ec15e866be add snake_case aliases for CamelCase methods 2016-04-28 12:20:42 +02:00
Noam Meltzer
0c74b3cfb9 bot.py + request.py: network_delay is unique for getUpdates 2016-04-28 01:41:32 +03:00
Noam Meltzer
0ca3ef7a38 utils.request: clean imports using feature.moves 2016-04-28 01:41:32 +03:00
Noam Meltzer
e160355190 remove unused imports, use future for urllib imports 2016-04-28 01:41:32 +03:00
Jannes Höke
865bba3f3e bump version to 4.0.1 2016-04-27 01:17:47 +02:00
Jannes Höke
2745023854 Merge branch 'master' of github.com:python-telegram-bot/python-telegram-bot 2016-04-27 01:06:58 +02:00
Jannes Höke
fd15e51e28 bump version to 4.0.0, update CHANGES 2016-04-27 01:02:57 +02:00
Jannes Höke
7f463131aa re-order imports 2016-04-27 00:28:21 +02:00
Noam Meltzer
a686db2c6f bot.Bot: fix class docstring 2016-04-26 23:31:29 +03:00
leandrotoledo
1f29093027 Merge branch 'unittest-bot2.0' of https://github.com/python-telegram-bot/python-telegram-bot into unittest-bot2.0 2016-04-26 14:17:59 -03:00
Noam Meltzer
49385493f4 bot: 'if X is not None' is cleaner approach 2016-04-26 17:47:37 +03:00
Noam Meltzer
f107070db2 TelegramObject.to_dict(): cover cases where value is 0 or empty object 2016-04-26 17:47:37 +03:00
Noam Meltzer
3f28633e79 MessageHandler / filters: refactor
filters are now functions instead of enum like objects.
their definitions were moved to messagehandler.py
2016-04-26 17:47:37 +03:00
Noam Meltzer
8ff8d57998 TelegramObject.to_dict(): use iterators 2016-04-26 17:47:37 +03:00
Noam Meltzer
e9a782a3c8 dispatcher.addHandler(): fix docstring 2016-04-26 17:47:37 +03:00
Noam Meltzer
1f83e7ae4e dispatcher.addHandler(): validate value of group is int 2016-04-26 17:47:37 +03:00
Noam Meltzer
856f4460fc handler: docstring fix 2016-04-26 17:47:37 +03:00
Noam Meltzer
c5ad34b074 dispatcher: style fix 2016-04-26 17:47:37 +03:00
Noam Meltzer
78d1faa21e dispatcher: on removeHandle(), remove the groups too if it's empty 2016-04-26 17:47:37 +03:00
Noam Meltzer
4ac8f86156 dispatcher: honour the priority of groups 2016-04-26 17:47:37 +03:00
Noam Meltzer
8a087dce69 import queue (like in py3) directly
future module takes care of adding the `queue` package to py2
2016-04-26 17:47:37 +03:00
Noam Meltzer
82282ae125 dispatcher: retrieve Handler class name dynamically
this way it is more resilient to class name changes
2016-04-26 17:47:37 +03:00
Noam Meltzer
02243f6fda utils.validater: remove dead code 2016-04-26 17:47:37 +03:00
Noam Meltzer
05a90dc3bc regexhandler/stringregexhandler: python2 utf8 support 2016-04-26 17:47:37 +03:00
Leandro Toledo
1425533871 Adds docstring to InlineQueryResultCachedAudio 2016-04-25 20:15:05 -03:00
Leandro Toledo
fc7c161018 Merge remote-tracking branch 'origin/master' into unittest-bot2.0 2016-04-24 14:33:17 -03:00
Andrea Giove
39ba575a4d
Missing a comma 2016-04-24 17:54:36 +02:00
Andrea Giove
87ac962805
Added caption paramenter to sendDocument method 2016-04-24 17:51:15 +02:00