Compare commits

...

1224 Commits

Author SHA1 Message Date
Jannes Höke 6479e15578 Bump version to v6.0.0 2017-05-19 21:49:01 +02:00
Jannes Höke 5dd3a660e3 forgot some escaping 2017-05-19 20:57:52 +02:00
Eldinnie e2a651afc8 Allow edited as seperate input (#608)
* Allow edited as seperate input

In short made it possible to tune messagehandler more to your wishes. and choose exactly what updates to receive. messages, edited_message or channel_post or a combination.

- Added the edited_updates argument to MessageHandler
- Added DepricationWarning when using allow_edited
- replaced _is_allowed_message and _is_allowed_channel_post with _is_allowed_update
- Modified tests to reflect new way

* oops

Spelled deprecation wrong
made an error in the _is_allowed_update.

* Python 2 does not have assertWarns.

* remove unneeded statements
2017-05-19 20:26:10 +02:00
Evgen 33512ffd2e Improved CommandHandler (#613)
* Improved CommandHandler

Now you can pass list of commands instead of one command

* Added tests for list of commands

* Return backward compatibility

Renamed `commands` to `command` in CommandHandler

* Added test for a command not in the list

* Fixed py2 unicode command support in `CommandHandler`
2017-05-19 20:21:37 +02:00
Evgen c2c5452829 Updated docstring in deleteMessage methods (#618)
* Removed "undocumented" notice

* Updated docstring according to Bot API documentation

* Removed extra line
2017-05-19 20:21:20 +02:00
Jannes Höke 9aa5522694 sanitize html and markdown in Message.text_html and text_markdown (#621)
* sanitize html and markdown in Message.text_html and text_markdown

* add import for escape_html
2017-05-19 19:11:40 +02:00
Noam Meltzer 9720f59d7e Fix docs (#614)
* Spelling fixes in `README.rst`

Fixes #609 and #610

* Fixed and added some type hints in docstrings
2017-05-17 22:46:06 +03:00
evgfilim1 578627feca Fixed and added some type hints in docstrings 2017-05-17 21:41:08 +05:00
evgfilim1 257b8321f8 Spelling fixes in README.rst
Fixes #609 and #610
2017-05-16 22:59:02 +05:00
Eldinnie 4f2ea5b0f1 Update readme to reflect changed install procedure (#610)
Fixes #609
2017-05-16 10:32:36 +03:00
Noam Meltzer 9a2d5e0410 Update copyright notice to include 2017 - missing files from another PR 2017-05-15 00:37:40 +03:00
Jacob Bom 1b7f83625c Update copyright notice to include 2017
Not strictly needed, but it helps show that the project is being actively
developed which I find important.
2017-05-15 00:36:49 +03:00
Jacob Bom da01601ff9 Add equality rich comparision operators to telegram objects (#604)
fixes #587
2017-05-15 00:29:31 +03:00
Evgen 752b64769d Fix for #601 (#603) 2017-05-12 17:42:02 +02:00
Evgen f3b75d95c4 Implemented undocumented 'deleteMessage' method (#602)
* Implemented `Bot.delete_message()` and `Message.delete()` methods

* Added tests for `Bot.delete_message()` and `Messsage.delete()`

* Added myself to `AUTHORS.rst`

* Using `assertRaisesRegexp` instead of `assertRaisesRegex` in tests

Now tests can run on Python 2.7 without raising 'AttributeError'

* Fix docstring

Added a warning to the docstring describing that this method is undocumented and not guaranteed to work
2017-05-12 17:40:57 +02:00
Eldinnie 36b98b0ab4 fix mimetype errors in video tests (#600) 2017-05-12 17:39:28 +02:00
Eldinnie 05b85d4334 Skip test_idle() and test_UserSignal on Windows (#599) 2017-05-12 17:39:14 +02:00
Eldinnie f27807552f refactor self.id -> self._id to let pycharms testrunner run (#598) 2017-05-12 17:38:51 +02:00
Eldinnie f3aca42e69 pass errormessage to Unauthorized (#597) 2017-05-12 17:38:36 +02:00
Noam Meltzer ed49bdb19c Merge pull request #592 from python-telegram-bot/snake_case
prefer snake_case for telegram.Bot methods
2017-05-08 00:30:05 +03:00
Rahiel Kasim 9f3afa5fa2 prefer snake_case for telegram.Bot methods 2017-05-07 16:09:58 +02:00
Joscha Götzer cdf36a20b7 Fixed deprecation warning (#586) 2017-04-29 19:56:27 +02:00
manorom c5598b96bc Fix Bug #571 (second try) (#574)
* Fix Bug #571
ConversationHandler will not process CallbackQuery if per_chat=True and
the CallbackQuery has no message attached to it (as is the case with
buttons on inline results)

* Adds test case for CallbackQuery without Chat
2017-04-29 15:51:48 +02:00
Noam Meltzer ca4351079f Merge pull request #542 from python-telegram-bot/urllib3-vendor-beta
Vendor (embed) urllib3 with our package.
2017-04-29 16:38:44 +03:00
Noam Meltzer 34059c951d Don't run coveralls on the vendor subdir 2017-04-29 15:52:31 +03:00
Jannes Höke c7dbdce3dc Allow CallbackQueryHandler in ConversationHandler with per_mess… (#561)
* 🐛 Allow CallbackQueryHandler in ConversationHandler with per_message=False

but show a warning #556

*  warning logs instead of ValueErrors

 #556
2017-04-29 15:15:17 +03:00
Noam Meltzer fe5ae8ed84 request.py: Fix warning on stderr irrelevant for most users
Attempting to import urllib3.contrib.socks may fail if PySocks is not
installed. Most users won't care for that.
Only import that module if the user requested to use a socks proxy.
2017-04-29 14:42:36 +03:00
Noam Meltzer a6b28b022a Merge remote-tracking branch 'origin/master' into urllib3-vendor-beta 2017-04-29 14:09:45 +03:00
Noam Meltzer 284f16b87b Merge pull request #583 from whipermr5/gae-urllib3-support
Compatibility with GAE via urllib3.contrib package
2017-04-29 12:29:51 +03:00
John Yong 785245a57e Add myself to authors list 2017-04-27 17:00:31 +08:00
John Yong 1d905d567c GAE support via urllib3.contrib.appengine module #334 2017-04-27 16:59:35 +08:00
Jannes Höke 4541476143 enforce urllib3==1.20 (#580)
* 🚑 enforce urllib3==1.20

 #579

* 🚑 Bump version to v5.3.1

 #579
2017-04-25 17:26:54 +02:00
Dickson Tan 11a3de67ea Remove deprecated code #408 part 1 (#564)
* Remove non-pep8 dispatcher methods

* callbackqueryhandler: Remove non-pep8 compliant methods

* commandhandler: Remove non-pep8 compliant methods

* handler: Remove non-pep8 compliant methods

* messagehandler: Remove non-pep8 compliant methods

* stringcommandhandler: Remove non-pep8 compliant methods

* stringregexhandler: Remove non-pep8 compliant methods

* test_updater: fix usage of deprecated methods

* dispatcher: fix accidental misalignment of comments by pre-commit hook

* Add myself to list of contributors
2017-04-25 10:39:02 +02:00
Eldinnie 90bf26c09b Issue 566 (#577)
* stripping token of whitespaces before starting bot

* Line feed

* - Case insensitivity for commandhandler
- Ignore pylint case on windows.
2017-04-25 10:37:06 +02:00
Eldinnie b5b09884b1 Group filters (#575)
* stripping token of whitespaces before starting bot

* Line feed

* show exception that's caused (fixes flake8 failing)

* Add private/group filters

Add filters:
 - Filters.private (for messages in private chats)
 - Filters.group   (for messages in group chats)

* use constants
2017-04-23 23:22:05 +02:00
Rahiel Kasim 35132271af contributing: how to run tests without make; AUTHORS: fix formatting (#567) 2017-04-17 14:49:42 +03:00
Iulian Onofrei 44d7bad11c Update constants.py (#553)
Add maximum inline query results constant
2017-03-29 17:31:26 +02:00
Jacob Bom ad5f009ce7 Add the ability to invert (not) filters (#552)
* Add InvertedFilter and use it from __invert__

* Add docstrings and __str__ for inverting filters

* Tests for inverted filters
2017-03-28 18:38:44 +02:00
Jannes Höke 8fe6e13ff2 Update handlers (#532)
* 🔨 Refactor `Update.extract_` methods to `Update.effective_` properties
 #507

*  Update RegexHandler to work with edited messages and channel posts

* 🔨 messagehandler.py: refactor channel_posts_updates -> channel_post_updates

* 🔨 handler.py: use effective_ properties
2017-03-26 14:36:45 +02:00
Jannes Höke ff39e2436e Refactor Update.extract_ methods to Update.effective_ properties (#531)
* 🔨 Refactor `Update.extract_` methods to `Update.effective_` properties
 #507

* 🔨 handler.py: use effective_ properties
2017-03-26 14:36:34 +02:00
Alex Hirschfeld 5b14b134dc Added user defined function for updater's signalHandler (#512)
* Added user defined function for updater's signalHandler

* Added test_userSignal to test_updater

* Added test_userSignal to test_updater
Fixing paren
2017-03-26 14:36:13 +02:00
Jannes Höke 5897affa07 add missing allowed_updates to start_webhook (#549)
* 🐛 add missing allowed_updates to start_webhook
 #548

* 🔨 fix webhook-related tests
 #548
2017-03-25 12:46:37 +01:00
Jannes Höke 9982f3c908 🐛 fix message date parsing for messages without a timestamp (#550)
#546
2017-03-25 12:15:37 +01:00
thodnev 22142e7cbd Introduce MessageQueue (#537)
* Introduce MessageQueue

* minor documentation and terminology fixes according to the review

* minor documentation and terminology fixes according to the review

* minor documentation and terminology fixes according to the review

* pep8 fix
2017-03-15 17:35:33 +01:00
Noam Meltzer 4c8d1c9a5e Fix Bot.sendDocument 2017-03-11 23:55:26 +02:00
Noam Meltzer bef6651da0 travis: when running nosetests run only the telegram tests (not urllib3) 2017-03-11 23:50:30 +02:00
Noam Meltzer 8c2ee0b439 Remove urllib3 from requirements.txt 2017-03-11 23:50:30 +02:00
Noam Meltzer bfb99a688a AUTHORS.rst: Add self to maintainers and add license info about urllib3 2017-03-11 23:50:30 +02:00
Noam Meltzer d239f4ee62 setup.py: vendor the urllib3 package 2017-03-11 23:50:30 +02:00
Noam Meltzer 2b930c221d Sane default for sending files timeout 2017-03-11 16:23:43 +02:00
Jannes Höke 2a1d40bd28 🚧 manipulate sys.path to prefer vendor urllib3
#533
2017-03-09 23:29:15 +01:00
Jannes Höke 1d4464ddbd add git submodule to vendor urllib3
#533
2017-03-09 23:16:58 +01:00
Jannes Höke 85b9236641 Update AUTHORS.rst 2017-02-28 15:55:38 +01:00
Jose Luis Salazar Gonzalez e78d11a99b Add filters to commandHandler (#536)
* Add filters to commandHandler

* Add commandHandler tests with filters

* Add myself to authors
2017-02-28 15:44:55 +01:00
Jannes Höke cc73469dab Issue 502 (#530)
* conversationhandler.py: add per_chat, per_user and per_message

* test_conversationhandler.py: test case per_user=False

* test_conversationhandler.py: add test for callbackqueryhandlers

* ✏️ Fix accidental typo in logging format
2017-02-27 17:52:58 +01:00
Jannes Höke 853d823964 🚨 promise.py: remove pylint warning
#529
2017-02-27 16:23:04 +01:00
Jannes Höke 69bfb85298 Fix tests (missed one)
#494
2017-02-27 15:35:57 +01:00
Jannes Höke f267646828 Fix tests
#494
2017-02-27 15:23:48 +01:00
Jannes Höke 6b7144bbab 🚨 fix yapf 2017-02-27 14:53:28 +01:00
Jannes Höke f8b13440c1 🔀 Merge thodnev/ptb into ptb/promises-with-exceptions
#529
2017-02-27 14:45:12 +01:00
Jannes Höke a1ade408b0 🔀 Merge master into dec04
#483
2017-02-27 14:39:18 +01:00
Jannes Höke 2954ca2bad 🔀 Merge master into fix-460
#494
2017-02-27 14:33:58 +01:00
Eldinnie 34ebb7fe5a Issue 520 (#521)
* stripping token of whitespaces before starting bot

* Line feed

* fixed chat parameter all_members_are_administrators
2017-02-27 14:27:06 +01:00
Eldinnie 78094b796d Fix commandhandler (#515)
* stripping token of whitespaces before starting bot

* Line feed

* CommandHandler checks if message is for this bot

* CommandHandler checks if message is for this bot
- Added tests

* Fixed tests in test_conversationHandler to work with new commandhandler structure

* type in conversationhandler test
2017-02-27 14:26:53 +01:00
thodnev fb378775a4 Changed promises to handle exceptions 2017-02-26 23:27:03 +02:00
代码家 264b9bd08c add myself to authors (#527) 2017-02-26 13:57:50 +01:00
Noam Meltzer d714da4b36 Merge pull request #500 from python-telegram-bot/bug470
Fix bad formatting of BadRequest exception message

Fixes #470
2017-02-25 22:40:49 +02:00
代码家 e39afad321 Add support for Socks5 proxy. (#518) 2017-02-25 20:47:56 +02:00
Rahiel Kasim 0507378509 fix typo's (#523) and comment out failing sticker test 2017-02-18 16:03:50 +01:00
Rahiel Kasim 659ac52d92 fix tests (telegram cache file_id's) 2017-02-05 23:10:48 +01:00
Rahiel Kasim 924c241680 declare support for Python 3.6 2017-02-05 20:40:16 +01:00
Joscha Götzer ac59f2f37c Added methods to generate the original markdown/html string from entities contained in Message (#507)
* Added methods to generate the original markdown/html formatted string from the entities contained in an update

* Added

* Moved the html/markdown parsing methods to `Message`

* Moved extract_* methods from helpers to the appropriate location

* Refactored text_markdown and text_html

* Refactored text_markdown and text_html for efficiency

* Fixed method call in conversationhandler

* Fixed method call in handler

* Fixed `make test` command on windows systems

* Improved method documentation
2017-01-20 20:13:58 +01:00
Jannes Höke 86c8ebbfb7 fix tests 2017-01-16 00:28:47 +01:00
Jannes Höke cd38bdbed5 bot.py: add delete_webhook alias 2017-01-16 00:28:26 +01:00
Jannes Höke 975d193441 Merge branch 'master' into dec04 2017-01-16 00:15:09 +01:00
Jannes Höke 728ffa432d updater.py: add allowed_updates parameter to start_polling 2017-01-16 00:07:46 +01:00
Jannes Höke 8ac66698b5 test_bot.py: unit test setWebhook and deleteWebhook 2017-01-16 00:01:32 +01:00
Jannes Höke c2c93f5d51 webhookinfo.py: add new parameters 2017-01-16 00:00:54 +01:00
Jannes Höke fc9f36d4db use deleteWebhook in Updater._bootstrap 2017-01-16 00:00:27 +01:00
Jacob Bom e69e99ce23 Make everything default to None
This effectively removes most type checking from all optional variables... I'm not really sure that's what we want...
2017-01-11 19:41:39 +01:00
Jacob Bom 27b2fd64b7 More IDE friendliness 2017-01-09 19:29:05 +01:00
Jacob Bom 4dee785fba Last of the classes I think 2017-01-09 19:16:28 +01:00
Noam Meltzer 4c7cc3a05b Fix test_set_game_score3 - telegram changed something in their responses 2017-01-07 23:37:23 +02:00
Noam Meltzer 1bb5dd224b Fix bad formatting of BadRequest exception message
fixes #470
2017-01-07 23:09:06 +02:00
Noam Meltzer bd96771a7a Fix typo 2017-01-07 23:05:58 +02:00
Noam Meltzer 191e442e59 test_jobqueue.py: Fix time delta calculations on several tests 2017-01-07 20:13:08 +02:00
Noam Meltzer 58dddfd9c3 Control the read timeout from telegram servers
refs #495
refs #364
2017-01-07 20:13:08 +02:00
Noam Meltzer 68a7d9fa1b Make sure to hint Telegram servers that we reuse connections
refs #495
refs #364
2017-01-07 20:13:08 +02:00
Jacob Bom 38f2064639 Tricky empty string in __init__ 2016-12-30 14:03:49 +01:00
Jacob Bom 651119fd69 Fix instances of empty strings in __init__ in example contributing code 2016-12-30 13:58:57 +01:00
Jacob Bom 232a0b0286 Fix instances of empty strings in __init__
Should partially fix #460
2016-12-30 13:57:59 +01:00
Anton Tagunov 48bcc3129a set timeout for post message with file object (#486) 2016-12-29 12:01:58 +02:00
Joscha Götzer 6a01164897 ConversationHandler breaks when bot is also used in Channels (#487)
* ConversationHandler now ignores channel posts
2016-12-25 22:36:01 +02:00
Noam Meltzer 7f6b017ce2 Merge pull request #484 from python-telegram-bot/jobqueue-absolute-simple
JobQueue: Simpler API for adding jobs
2016-12-21 00:04:01 +02:00
Jannes Höke 09cb33f52d rename Job.is_removed to removed 2016-12-20 22:37:36 +01:00
Noam Meltzer 423251f66c Change Job.is_removed to be a property instead of a method 2016-12-20 00:14:03 +02:00
Noam Meltzer ed1785981d disable test_send_contact 2016-12-20 00:12:57 +02:00
Hugo Hakim Damer a8fecc527d Prevented modifications to the request object's original data (#454)
fixes #357
2016-12-20 00:07:35 +02:00
Yan c3984e1bf1 Download changed (#459)
* DownBytes added

* File.downbyte changed

* Changed file.download();Remove downbyte()

* Fixed typo

* add docstring, make custom_path and out mutually exclusive, rename downbytes to retrieve

* remove trailing whitespace

* run pre-commit hooks
2016-12-18 03:05:00 +01:00
Noam Meltzer 93bf21a0a4 jobqueue.py: stability improvments
- Job.job_queue is now weakref.proxy reducing the risk of cyclic
   pointers preventing Job object from being deleted.
 - JobQueue._put(): raise if both next_t and job.interval are None
 - Don't put repeating job back to queue if user had disabled it was
   disabled during the time of execution.
 - New method: Job.is_removed() - promising a consistent API (instead of
   access to private member Job._remove)
 - Documentation fixes.
2016-12-15 00:17:57 +02:00
Jannes Höke cbf93e1046 switch to run_x naming scheme 2016-12-14 18:01:44 +01:00
Jannes Höke a1a8628c75 bot.py: fix argument order, setWebhook: make 'url' and 'webhook_url' mutually exclusive 2016-12-14 17:38:06 +01:00
Jannes Höke d5ce32c672 removed Job.run_immediately and related code 2016-12-14 17:15:52 +01:00
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 84f3bc0c79 README.rst: update api support date 2016-12-14 00:51:43 +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 a37add39f4 [ci skip] update timerbot.py to use chat_data 2016-12-13 21:57:37 +01:00
Jannes Höke 71530f404d Bump version to v5.3.0 2016-12-11 23:51:51 +01:00
Jannes Höke 0cd7ecab50 fix test_filters_reply 2016-12-11 23:16:10 +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
Blue a7bfb0c3a1 hide inline keyboard in conversationbot example (#439) 2016-11-08 22:14:11 +01:00
Jannes Höke e76ee6bb57 [ci skip] docs: add even more missing classes (wtf) 2016-11-01 09:37:03 +01:00
Jannes Höke 65061f8a99 [ci skip] docs: add all missing classes 2016-11-01 09:01:36 +01:00
Jannes Höke dabbbcafcb [ci skip] docs: remove superfluous text in index.rst 2016-11-01 08:15:51 +01:00
Jannes Höke 1eb4b40dbf [ci skip] docs: add logo to html and pdf builds 2016-11-01 08:09:25 +01:00
Jannes Höke 7167936692 [ci skip] pdf docs: use a4paper, update motto 2016-11-01 07:54:04 +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 b22c3cc5c0 [ci skip] add state diagrams for conversation handler examples 2016-10-28 08:26:02 +02:00
Jannes Höke 2786252a51 Bump version to v5.2.0 2016-10-25 20:10:36 +02:00
Jannes Höke 3f30f74024 update examples to use bitwise filters 2016-10-25 19:51:56 +02:00
Jannes Höke 79fc3be9cd Update README.md 2016-10-25 19:37:19 +02:00
Jannes Höke 71c73bdc74 Update README.md 2016-10-25 19:36:57 +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
Jannes Höke fae1896232 Switch to readthedocs (#443)
* replace pythonhosted by readthedocs

* fix rtd links in examples/README
2016-10-19 18:00:33 +02:00
Jacob Bom 2518ddac22 Update comtributing guide with explicit kwargs 2016-10-19 13:07:20 +02:00
Jacob Bom 61fe438a8b Merge pull request #431 from python-telegram-bot/october3
Add api changes as of october 3
2016-10-19 12:59:00 +02: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 7fafaa1ea3 Update support date in readme. 2016-10-16 16:54:08 +02: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 39832d2f6b __str__ behaves differntly on py2 apparently. 2016-10-16 13:19:42 +02:00
Jacob Bom 5408c23e33 assertRegexMatches still exists for now. Use it. 2016-10-16 12:48:45 +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 29e0cc64e9 Fix py2 compat 2016-10-15 23:29:46 +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 f99b2f8f3b Inprove coverage 2016-10-15 22:59:41 +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 de96cc87ea Only build master branch and PRs on travis. Yapf only on py3.5. 2016-10-14 11:24:00 +02: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 d07a1c3f67 yapf: use our own mirror of yapf & update to version 0.12.2 2016-10-12 23:51:46 +03:00
Noam Meltzer 32a78722ae yapf fixes 2016-10-12 23:33:52 +03:00
Jacob Bom 04feeeff55 Update test cases
Needs proper animation file_id and size.
Also assertEqual can't test if two objects have the same data, so we just check the file_id instead.
2016-10-12 20:30:34 +02:00
Jannes Höke a1495956aa temporary fix for documentation builds on readthedocs 2016-10-10 12:51:12 +02: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 7ad92dcc65 Add test for set_game_score 2016-10-09 12:39:05 +02:00
Jacob Bom d1ddfaddf0 Add tests for Game, Animation and sendGame.
Still need setGameScore (I'm thinking we can set it to the ever increasing
envvar 'TRAVIS_BUILD_NUMBER') and getGameHighScores.
The tests currently don't work... Since I don't really understand how
PhotoSize works... Please halp :P
2016-10-07 23:57:10 +02:00
Jacob Bom b7c7612b3f Add game filter 2016-10-07 22:37:29 +02:00
Jacob Bom ade89772f4 Fix tests
Data is an optional kwargs in CallbackQuery according to Telegram
2016-10-07 22:32:54 +02:00
Jacob Bom 67b98e3190 Merge pull request #433 from PH89/october3
small fix for game related parts
2016-10-07 22:25:52 +02:00
Patrick Hofmann e672625a41 add myself to AUTHORS.rst 2016-10-06 18:17:42 +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 bfb4c63d60 add unitest for getWebhookInfo 2016-10-06 00:11:28 +03:00
Noam Meltzer 01a5a1c5b3 small documentation fix 2016-10-05 23:22:55 +03:00
Noam Meltzer 1db1b76a7c fix test_video unitest 2016-10-05 23:19:17 +03:00
Jacob Bom 976f34082f Add possibly good-enough test for all_members_are_admin
Should be good enough... If we /really/ wanted to we could get two different chats from telegram and check them, but it really shouldn't be necessary.
2016-10-05 17:55:00 +02:00
Jacob Bom 6b7788570c Add tests for captions in audio and voice 2016-10-05 17:50:48 +02: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 c2b8c4bf95 Fix regexGroupHandlerCallbackQuery test 2016-10-03 21:29:30 +02:00
Jacob Bom 8234321a20 Fix tests for Inline Voice Queries 2016-10-03 21:28:35 +02: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 9928a1eefc Add test for edit_text 2016-09-25 16:11:19 +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 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
Jannes Höke 555e36ee80 tests 2016-08-06 14:47:45 +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 4feb2553ff Add self to Authors.rst 2016-08-06 13:45:43 +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
Noam Meltzer 4375820863 fixup! updated issue template 2016-07-25 22:31:23 +03:00
Noam Meltzer 171c70b4c2 updated issue template
[ci skip]
2016-07-25 22:29:55 +03:00
overquota f1ee54fa73 ChatMigrated exception (#353)
* ChatMigrated exception
2016-07-25 21:50:33 +03:00
Jannes Höke 90913724ca Update README.rst 2016-07-24 02:42:55 +02:00
Jannes Höke 9d4691e50d Create README.md 2016-07-24 02:35:01 +02:00
Rahiel Kasim c4928229d6 README: link to website 2016-07-24 01:21:35 +02:00
Jannes Höke 2f2337cac1 update motto in readme 2016-07-24 01:16:57 +02:00
Jannes Höke f5c57cd6c6 new inlinekeyboard example (#355) 2016-07-20 00:15:03 +02:00
Rahiel Kasim c51c2224da README: update link to new conversationbot example 2016-07-15 12:36:37 +02:00
Jannes Höke 834bf192b9 Bump version to v5.0.0 2016-07-15 01:48:11 +02:00
Jannes Höke d5486433e5 use job context for timerbot example 2016-07-15 01:46:27 +02:00
Jannes Höke c9ec436d68 remove old state machine example 2016-07-15 01:45:43 +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
leandrotoledo e3fe1d2632 Merge branch 'master' of https://github.com/python-telegram-bot/python-telegram-bot 2016-07-14 17:19:13 -03:00
leandrotoledo 52bd3daa39 Bumping version of pre-commit [ci skip] 2016-07-14 17:18:29 -03:00
Leandro Toledo b4e8209f2c Update CONTRIBUTING.rst
Adding a bullet on "assertEqual method's arguments should be in ('actual', 'expected') order"
2016-07-14 17:16:25 -03:00
Valentijn f5f95ef8c9 Documentation (#350)
* Small fixes to documentation and add myself to AUTHORS.

* Rework CONTRIBUTIONS.rst

Use code-blocks instead of literals, change headings for portability and use a relative link to AUTHORS instead of linking to a specific copy.
2016-07-14 16:56:05 -03: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 4990d664bb Merge pull request #339 from python-telegram-bot/urllib3_fix_proxy
urllib3: now supports proxy
2016-07-08 23:00:02 +03: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 c7c21c94ea update requirement: urllib3>=1.10 2016-06-29 15:53:10 +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 35872d7a8b test_jobqueue: fix test_jobs_tuple()
this test was based on timing and assumed that the JobQueue did not have
time to start processing the queue before checking the assert.
what we really should do is make sure JobQueue does not process anything
2016-06-24 19:13:40 +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
Noam Meltzer e0539d5992 Merge pull request #327 from python-telegram-bot/urllib3
Urllib3
2016-06-20 06:30:25 +03: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 caf72ca490 Merge branch 'urllib3' of github.com:python-telegram-bot/python-telegram-bot into urllib3 2016-06-19 23:46:53 +02: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
Jannes Höke 949f4a4fbd update requirements: minimum versions of urllib3 and future 2016-06-19 23:39:00 +02:00
leandrotoledo 05522e4321 Merge remote-tracking branch 'origin/master' into urllib3 2016-06-19 17:38:19 -04:00
leandrotoledo 4f101a79bb Update travis yapf [ci skip] 2016-06-19 17:08:12 -04: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 bc77c845ea test_updater: make sure that conpool is stopped before setting updater
even for the first unitest, it might come after another unitests from
another file which had already init the conpool.
2016-06-18 09:53:08 +03:00
Noam Meltzer a814e9de6b make sure to stop conpool between sensitive unitests 2016-06-18 00:50:44 +03:00
Noam Meltzer d37b6d6735 make sure to stop Updater after the test_createBot is over 2016-06-18 00:01:36 +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
Rahiel Kasim 9338f93d24 Merge pull request #325 from python-telegram-bot/examples
more robust echobot, let roboed go
2016-06-12 17:08:15 +02:00
Rahiel Kasim e10fa66286 echobot: simplify handling messageless updates 2016-06-12 17:06:03 +02:00
Rahiel Kasim deb9de0ba0 README: remove roboed, rename example 2016-06-12 16:58:18 +02:00
Rahiel Kasim 94fd6851ab more robust echobot, let roboed go 2016-06-12 15:30:56 +02:00
leandrotoledo 897f9615f0 Bump version to v4.2.1 2016-06-10 09:44:17 -04:00
Leandro Toledo 86676d59f1 Merge pull request #321 from python-telegram-bot/editMessageText-decorator
Adds @message decorator to editMessageText #320
2016-06-04 05:19:27 -04:00
leandrotoledo f0b91ecf46 Fix travis 2016-06-03 13:44:24 -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 da95341d5b Update README.rst 2016-06-01 00:05:09 +02:00
Jannes Höke 98be6abc11 Remove clibot.py example 2016-05-31 21:07:47 +02: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
Leandro Toledo 6d08e1bc7f Merge pull request #317 from jlmadurga/issue/316
Fix callbackquery to_dict
2016-05-30 11:35:44 -03: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 b040568b07 test_bot: fix for urllib3 compatibility 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 f8a9722573 remove duplicate target names 2016-05-29 12:35:52 +02:00
Leandro Toledo 527daaf93d Merge pull request #315 from jlmadurga/typo/changes
Fix typo in Transition to 4.0 link
2016-05-29 06:50:57 -03:00
Juan Madurga 986add59ab fix typo in Transition to 4.0 link 2016-05-29 11:37:35 +02:00
Jannes Höke bc62a1813a fix rst according to collective.checkdocs 2016-05-28 23:36:51 +02:00
Jannes Höke 41432f5b02 bump version to v4.2.0 2016-05-28 22:49:15 +02:00
Jannes Höke f737ab780a Merge pull request #314 from python-telegram-bot/docs-restructuring
Move large parts from README to Wiki
2016-05-28 22:44:17 +02:00
Rahiel Kasim e0e8f6b085 README: update docs badge link, https some links 2016-05-28 22:40:18 +02:00
Jannes Höke 17abf0274e Fix formatting 2016-05-28 21:52:03 +02:00
Jannes Höke 8fab7ad302 move stuff to wiki, other stuff 2016-05-28 21:44:10 +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
Leandro Toledo 32ac617e2e Merge pull request #312 from python-telegram-bot/timeout_take2
set default network_delay to 5 seconds
2016-05-28 15:14:54 -03:00
Noam Meltzer 7e7acdeb23 set default network_delay to 5 seconds
fixes #309
2016-05-28 19:34:16 +03:00
Leandro Toledo 792ad62fe8 Merge pull request #308 from python-telegram-bot/bot2.1
New methods for Bot 2.1 API
2016-05-28 12:14:01 -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 2f408ab767 generate docs for botan 2016-05-28 09:18:36 +02:00
Rahiel Kasim c8497424b7 move botan to contrib 2016-05-28 09:12:10 +02:00
Leandro Toledo 80fbe98b44 Reflecting tests for Filters change 2016-05-27 21:14:55 -03:00
Leandro Toledo 22e9326610 Merge remote-tracking branch 'origin/master' into bot2.1 2016-05-27 21:10:24 -03:00
Jannes Höke a0bb5730c6 add allow_edited parameter to MessageHandler and CommandHandler 2016-05-27 11:07:06 +02:00
Jannes Höke 748cc3a35f Add isitmaintained.com issue resolving time badge 2016-05-26 23:30:29 +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 e7f4a07b7a update timerbot example with pass_job_queue 2016-05-26 14:48:50 +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 20067ff178 add test for context parameter 2016-05-26 14:07:44 +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 86571bc75d addHandler to add_handler 2016-05-26 01:55:51 -03: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 8278779a23 Merge branch 'jobqueue-rework' of github.com:python-telegram-bot/python-telegram-bot into jobqueue-rework 2016-05-25 23:37:10 +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
Jannes Höke 6b90ac9f1c make job queue API similar to the dispatcher, add new functionality 2016-05-25 22:51:13 +02:00
Rahiel Kasim 386b91f708 refactor testing if user is bot 2016-05-25 09:41:48 +02:00
Rahiel Kasim 76b9a7d328 add tests for Bot.getChat* 2016-05-25 01:31:10 +02:00
Leandro Toledo d90b0f495d End the madness when bumping versions [ci skip] 2016-05-24 19:43:24 -03:00
Rahiel Kasim c4d5eff9f3 move botan from utils to ext 2016-05-24 23:40:09 +02:00
Rahiel Kasim f45ecee820 Merge pull request #304 from TiagoDanin/FixReadme
README Update url for contribution guidelines
2016-05-24 23:09:13 +02:00
Tiago Danin c340585f33 README Update url for contribution guidelines 2016-05-24 15:49:43 -05:00
Leandro Toledo 75490ac757 Fix travis 2016-05-23 22:13:38 -03:00
Leandro Toledo 046e69b1c1 Commenting test for token with newline 2016-05-23 22:02:15 -03:00
Leandro Toledo 7e0be09c58 Merge remote-tracking branch 'origin/master' into bot2.1 2016-05-23 21:56:01 -03:00
Leandro Toledo 18f3f43026 Add issue template #298 2016-05-23 21:54:36 -03: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 408959e91c Removes examples from tests 2016-05-23 20:44:47 -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
Leandro Toledo 7c84516d2b Merge branch 'master' of github.com:python-telegram-bot/python-telegram-bot 2016-05-23 19:44:34 -03:00
Leandro Toledo 53a91be21f Update CONTRIBUTING.rst 2016-05-23 19:05:56 -03:00
Leandro Toledo 2471eaa778 Adding some style commandments 2016-05-23 19:05:04 -03:00
leandrotoledo 6bfdff8892 Update examples to column width to 99 [ci skip] 2016-05-23 17:45:01 -03:00
leandrotoledo 2389b07382 Updates pre-commit hooks to check examples folder [ci skip] 2016-05-23 17:23:57 -03:00
leandrotoledo c7db9a96cd Set split_before_logical_operator to True 2016-05-23 17:19:35 -03:00
Leandro Toledo af89cbecf3 Add test for unstripped tokens [ci skip] 2016-05-22 18:22:22 -03:00
leandrotoledo b987c8937c Hooks for travis 2016-05-22 13:26:57 -03:00
leandrotoledo 5a0696b181 Replace individual checks to pre-commit run --all-files in Travis 2016-05-22 13:12:05 -03:00
leandrotoledo eb303903ef Fix travis 2016-05-22 12:55:48 -03:00
leandrotoledo a00f409992 Updates pre-commit hooks 2016-05-22 12:31:03 -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
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
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
Rahiel Kasim 53de38f6c9 README: fix formatting inline code 2016-05-16 01:46:42 +02:00
Leandro Toledo be105a2d4a Update CHANGES.rst 2016-05-15 20:24:09 -03:00
leandrotoledo ac55ba007e Bumping version to v4.1 [ci skip] 2016-05-15 20:05:38 -03:00
Leandro Toledo 6bdca1e4f8 Merge pull request #294 from python-telegram-bot/yapf
yapf formatter, pre-commit hooks and new travis tests
2016-05-15 19:31:54 -03:00
Leandro Toledo fd7b571e92 Disables yapf for travis tests for pypy3 (ugh!) #259 2016-05-15 00:19:59 -03:00
Leandro Toledo 9243cd3507 Minor typo fix #259 [ci skip] 2016-05-15 00:11:14 -03:00
Leandro Toledo 1b09738191 Disables yapf for travis tests for pypy3.3 #259 2016-05-15 00:07:59 -03:00
Leandro Toledo 836c50965a Disables yapf for travis tests for py2.4 and 3.3 #259 2016-05-14 23:59:45 -03:00
Leandro Toledo 1d9d0fc764 Disables yapf for travis tests for py2.4 and 3.3 #259 2016-05-14 23:53:02 -03:00
Leandro Toledo e57e6dd645 Add yapf to travis and updates CONTRIBUTING doc #259 2016-05-14 23:46:21 -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 46993d5f2d Adding pre-commit hooks #259 2016-05-14 21:59:08 -03:00
Leandro Toledo 880746baed Column width to 90 #259 2016-05-14 21:52:35 -03:00
Leandro Toledo 8ad1f330ea First run of yapf for tests/* #259 2016-05-14 21:39:11 -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
Leandro Toledo df16846d80 Update README.rst
#293
2016-05-14 10:28:16 -03:00
Jannes Höke 3ac9a1cd71 Merge pull request #291 from python-telegram-bot/api-2016-05-06
Api additions 2016-05-06
2016-05-13 21:31:35 +02:00
Jannes Höke 4d8174edc3 check for py2 and decode 2016-05-12 08:31:47 +02:00
Jannes Höke 235bb72702 use future.utils.text_to_native_str 2016-05-12 08:17:05 +02:00
Rahiel Kasim 9a5ccb1c2d fix sticker emoji test
We always get utf-8 text from Telegram, so we compare to that.
2016-05-12 01:10:04 +02: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 d4f7b7165c flake8: set max line length to 99 2016-05-02 10:35:20 +02:00
Leandro Toledo 0ed5e8e1a3 Merge pull request #274 from kiote/master
Update README.rst
2016-05-01 18:29:55 -03:00
Ekaterina Krivich 335813a11a Update README.rst
answerCallbackQuery mentioned twice
2016-05-02 00:28:09 +03:00
Jannes Höke 10a98211f8 bump version to 4.0.3 2016-05-01 22:13:27 +02:00
Jannes Höke b5570ddfa5 update CHANGES.rst 2016-05-01 22:13:24 +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
Rahiel Kasim 4ba5fbf4f5 Merge pull request #271 from Djaler/master
Fix Bot.getUpdates() docstring
2016-05-01 14:31:23 +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 6e5302c089 pass args in timerbot example #270 2016-04-30 10:19:41 +02:00
Jannes Höke 5aab4525c2 add keyboard changes 2016-04-29 19:31:45 +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 4ce0ab53d0 Merge branch 'tsnoam-cr4.0_api2' 2016-04-29 18:57:23 +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 73c60ee817 simpler py2/py3 input in clibot example 2016-04-28 17:32:10 +02:00
Rahiel Kasim 474d5f0c9f update README and examples to new snake_case methods 2016-04-28 17:29:34 +02:00
Rahiel Kasim 74a2baf03d update CONTRIBUTING guide 2016-04-28 15:41:44 +02:00
Rahiel Kasim 0612385233 set project max line length to 99 (flake8) 2016-04-28 15:03:43 +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 d86ca30601 README: document snake_case alias methods for telegram.Bot 2016-04-28 12:44:35 +02:00
Rahiel Kasim ec15e866be add snake_case aliases for CamelCase methods 2016-04-28 12:20:42 +02:00
Leandro Toledo 998040da92 Update clibot.py
Changes group=str to int
2016-04-27 22:10:31 -03: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
Leandro Toledo d80e0b4b8c Add more test cases 2016-04-26 22:48:02 -03:00
Leandro Toledo 96d98084c7 Update README.rst
Drops 4.0rc version argument
2016-04-26 20:39:34 -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
Leandro Toledo d093506ef2 Merge pull request #261 from python-telegram-bot/unittest-bot2.0
Unittest for Bot 2.0 features
2016-04-26 19:44:55 -03:00
Jannes Höke 7f463131aa re-order imports 2016-04-27 00:28:21 +02:00
Leandro Toledo a79f636345 Formatting 2016-04-26 19:08:35 -03:00
Leandro Toledo 4a4dbcdbf8 unittest2 for py2 2016-04-26 19:02:17 -03:00
Leandro Toledo 7b13adb34b Renaming methods for InlineKeyboardButton 2016-04-26 18:58:22 -03:00
Leandro Toledo e905f310c4 Renaming methods for KeyboardButton 2016-04-26 18:57:52 -03:00
Leandro Toledo 631c825c1d Merge remote-tracking branch 'origin/unittest-bot2.0' into unittest-bot2.0 2016-04-26 18:51:02 -03:00
Leandro Toledo ed7ecddb8d address to _address due nose limitations 2016-04-26 18:50:47 -03:00
Jannes Höke a3dae1f112 use correct filter in command filter test 2016-04-26 23:49:59 +02:00
Leandro Toledo 1d33c39a1b Merge remote-tracking branch 'origin/unittest-bot2.0' into unittest-bot2.0 2016-04-26 18:43:56 -03:00
Leandro Toledo 14d3f62e44 Minor fix 2016-04-26 18:43:39 -03:00
Jannes Höke 931b22f49e tests for Filters 2016-04-26 23:42:58 +02:00
Leandro Toledo f0aafda1b9 Add KeyboardButtonTest 2016-04-26 18:40:48 -03:00
Leandro Toledo ecb6ddd83d Add VenueTest 2016-04-26 18:34:25 -03:00
Leandro Toledo cb46b0373f Add MessageEntityTest and reformatting. 2016-04-26 18:29:13 -03:00
Leandro Toledo 35f6de326b Add InlineKeyboardButtonTest and reformatting. 2016-04-26 18:23:15 -03: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 0e34c0395f Merge pull request #258 from tsnoam/cr4.0
CR & fixes for 4.0 (dispatcher mostly, API2.0 still TODO)
2016-04-26 18:14:34 +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 186db99565 Merge remote-tracking branch 'upstream/master' into unittest-bot2.0 2016-04-25 20:14:43 -03:00
Rahiel Kasim 835c4d04c1 Merge pull request #257 from python-telegram-bot/code-highlighting
Code highlighting
2016-04-25 12:15:04 +02:00
Rahiel Kasim 5b867b2290 README: format shell code for consistency 2016-04-25 10:34:43 +02:00
Rahiel Kasim ff66a9fa21 README: fix header formatting 2016-04-25 10:02:45 +02:00
Jannes Höke 3189d4d339 fix quotes 2016-04-25 10:01:57 +02:00
Jannes Höke d66493b038 use python code highlighting 2016-04-25 09:58:09 +02:00
Leandro Toledo eca5f66cd6 Update README.rst
Add requirements-dev.txt install
2016-04-25 00:25:02 -03:00
Leandro Toledo f7aec236e7 Merge pull request #254 from rahiel/master
readme work
2016-04-25 00:21:24 -03:00
Leandro Toledo fc7c161018 Merge remote-tracking branch 'origin/master' into unittest-bot2.0 2016-04-24 14:33:17 -03:00
Leandro Toledo c0d63deae3 Merge remote-tracking branch 'origin/unittest-bot2.0' into unittest-bot2.0 2016-04-24 14:33:04 -03:00
Leandro Toledo f152195a68 Minor fix 2016-04-24 14:32:52 -03:00
Jannes Höke b2fd2ba697 add callback data 2016-04-24 19:00:21 +02:00
Rahiel Kasim d21ee819b7 README: move license to bottom 2016-04-24 18:39:48 +02:00
Rahiel Kasim d3cec77e78 README: make smaller, fix links, add "Getting help" section 2016-04-24 18:36:08 +02:00
Jannes Höke 94e35d5b1c Merge pull request #253 from aadeg/master
Added caption paramenter to sendDocument method
2016-04-24 18:01:43 +02: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
Jannes Höke 01cca924ca inlinekeyboardmarkup test (failing) 2016-04-24 16:30:53 +02:00
Leandro Toledo 14cb13acfd Adds @message decorator to editMessageText 2016-04-24 11:19:37 -03:00
Leandro Toledo 4ecb4911db Adds @message decorator to editMessageText 2016-04-24 11:18:16 -03:00
Leandro Toledo d47787876a Merge remote-tracking branch 'origin/master' into unittest-bot2.0 2016-04-24 11:08:35 -03:00
Leandro Toledo 4b173bfd52 Add tests for InputContactMessageContent InputLocationMessageContent InputTextMessageContent InputVenueMessageContent 2016-04-24 11:08:06 -03:00
Leandro Toledo bfbad1625e Merge pull request #252 from python-telegram-bot/fix-timeout-args
Add timeout and network_delay kwargs to all bot methods.
2016-04-24 11:05:26 -03:00
Jannes Höke 564baea8c3 Merge pull request #251 from python-telegram-bot/fix_run_async
release semaphore on exceptions
2016-04-24 15:59:09 +02:00
Leandro Toledo adc3104214 Add timeout and network_delay kwargs to all bot methods. 2016-04-24 10:06:59 -03:00
Jannes Höke 2f7cccfc9f revert c0dd9c6 2016-04-24 14:15:01 +02:00
Jannes Höke 5a7a62c3d8 release semaphore on exceptions 2016-04-24 13:43:42 +02:00
Leandro Toledo ca1fff25f7 Some code reformat and minor fixes 2016-04-23 23:11:25 -03:00
Leandro Toledo 0d6b3a5411 Seems like self.address conflicts with nose. Validating... 2016-04-23 22:47:50 -03:00
Leandro Toledo 6cacea96f7 No clue what's going on with travis and Venue 2016-04-23 22:43:48 -03:00
Leandro Toledo 4775107af0 Trying to isolate the problem. 2016-04-23 22:40:52 -03:00
Leandro Toledo fe06708d34 Trying to isolate the problem. 2016-04-23 22:37:59 -03:00
Leandro Toledo 6390b7fd9b Going deeper... 2016-04-23 21:43:27 -03:00
Leandro Toledo 2160ce70a6 This piece of code killed Travis somehow, investigating. 2016-04-23 21:40:36 -03:00
Leandro Toledo 5e5125444c Adding all the others inlinequeryresult tests #188. 2016-04-23 21:26:59 -03:00
Leandro Toledo f86e6f97db Adding some inlinequeryresult tests #188. 2016-04-23 21:06:18 -03:00
Leandro Toledo 325d8131ee Adding input_message_content and reply_markup for existing inlinequery* tests. 2016-04-23 20:40:51 -03:00
Leandro Toledo f68b8c3a4a Adds InputContactMessageContent class, fixes InlineQueryResultArticle tests, de_json super calls for replymarkup objects and factory for InputMessageContent #188 2016-04-23 20:19:51 -03:00
Jannes Höke 7c8a0e00c0 update readme pip install command 2016-04-23 15:51:02 +02:00
leandrotoledo 4c0737d7c1 Moving InlineQuery* classes to its own test files 2016-04-23 10:47:10 -03:00
leandrotoledo 5dd95f1968 Renaming some tests 2016-04-23 10:39:52 -03:00
Jannes Höke b30417681b Merge pull request #248 from python-telegram-bot/bytes-images-py2
InputFile to support any objects with .read attribute
2016-04-23 14:36:59 +02:00
leandrotoledo 37e48b4707 Fixing BufferedReader test #248 2016-04-23 09:23:03 -03:00
Jannes Höke 9e306dce16 Update README.rst 2016-04-23 12:27:37 +02:00
leandrotoledo 9b1a55f9e9 Reverting some master files 2016-04-22 22:15:48 -03:00
leandrotoledo 252abb138d Using hasattr instead isinstance for file check #119 2016-04-22 21:51:00 -03:00
leandrotoledo 203364d939 Merge branch 'bot-api-2.0' of https://github.com/python-telegram-bot/python-telegram-bot into bot-api-2.0 2016-04-22 21:33:37 -03:00
Jannes Höke 1450478d27 Merge pull request #241 from python-telegram-bot/dispatcher-rework
v4.0: Dispatcher rework/Bot API 2.0 (RC1)
2016-04-22 16:37:27 +02:00
Jannes Höke 5b36a85e63 release notes 4.0rc1 2016-04-22 16:27:49 +02:00
Jannes Höke 7daf26198e bump version to 4.0rc1 2016-04-22 16:24:32 +02:00
Jannes Höke 8c0de59d46 fix rst syntax 2016-04-22 16:13:24 +02:00
Jannes Höke d46d9a711d Merge branch 'bot-api-2.0' into dispatcher-rework
Conflicts:
	docs/source/telegram.ext.jobqueue.rst
	docs/source/telegram.rst
2016-04-22 16:12:45 +02:00
Leandro Toledo b444cd7bce Adding new modules to docs #232 2016-04-22 11:07:44 -03:00
Jannes Höke 93e15fa9f8 Merge branch 'bot-api-2.0' into dispatcher-rework 2016-04-22 15:36:51 +02:00
Jannes Höke d383c10d4e remove check for inline_query 2016-04-22 15:36:46 +02:00
Jannes Höke 012bbe1307 update readme to bot-api-2.0 2016-04-22 15:34:21 +02:00
Jannes Höke 4faa4774bd Remove bot token 2016-04-22 09:11:52 +02:00
Jannes Höke cb79317354 remove lazy import of JobQueue 2016-04-21 20:37:43 +02:00
Jannes Höke cfdfdeb4fc Merge branch 'bot-api-2.0' into dispatcher-rework 2016-04-21 17:20:05 +02:00
Leandro Toledo 67a2d31edf Merge branch 'bot-api-2.0' of https://github.com/python-telegram-bot/python-telegram-bot into bot-api-2.0 2016-04-21 12:18:59 -03:00
Leandro Toledo 0669c72fe3 Fixing little princes Python 2.6 string format arg #232 2016-04-21 12:18:51 -03:00
Leandro Toledo 185c40da79 Fixing little princes Python 2.6 string format arg #232 2016-04-21 12:15:37 -03:00
Leandro Toledo 5315e072cb PEP8 for Py2 #232 2016-04-21 11:59:18 -03:00
Leandro Toledo a8255e4f51 Revert switch_inline_query #232 2016-04-21 11:42:02 -03:00
Leandro Toledo e56c6dfab6 Revert "Minor fixes #232"
This reverts commit 720c4d22d8.
2016-04-21 11:20:09 -03:00
Leandro Toledo 263310be36 switch_inline_query defaults to empty string #232 2016-04-21 11:02:34 -03:00
Leandro Toledo 720c4d22d8 Minor fixes #232 2016-04-21 10:56:38 -03:00
Leandro Toledo 3be8b9ecb9 Should fix empty string but set args #232 2016-04-21 09:56:57 -03:00
Leandro Toledo bb36c725af More refactoring and docstrings #232 2016-04-21 09:21:12 -03:00
Leandro Toledo ba7e1cada7 Bot class refactor and its docstrings #232 2016-04-21 08:15:38 -03:00
Jannes Höke 9bf5da5ed3 add test for callback query handler 2016-04-21 13:07:44 +02:00
Jannes Höke c0dd9c6ffc always set webhook_url 2016-04-21 12:57:03 +02:00
leandrotoledo 10a96481f5 Merge branch 'bot-api-2.0' of https://github.com/python-telegram-bot/python-telegram-bot into bot-api-2.0 2016-04-19 11:36:00 -03:00
Leandro Toledo 9a96ad8efd Unused import #232 2016-04-19 09:12:22 -03:00
Leandro Toledo fc277d7393 Refactor of telegram.Bot class and docstrings #232 2016-04-19 09:04:25 -03:00
Jannes Höke 48eb623f15 Merge branch 'bot-api-2.0' into dispatcher-rework 2016-04-19 01:24:02 +02:00
Leandro Toledo 9a340d2ea9 Endorsing if empty or 0 or empty string and minor typo fix #232 2016-04-18 20:18:32 -03:00
Jannes Höke 693df6dc2c Merge branch 'bot-api-2.0' into dispatcher-rework 2016-04-19 00:08:59 +02:00
Jannes Höke a98919a86e fix cache_time==0 case 2016-04-19 00:08:47 +02:00
Jannes Höke 9790d6d8dc Merge branch 'bot-api-2.0' into dispatcher-rework 2016-04-18 21:35:50 +02:00
Jannes Höke 7913d09295 fix message.to_dict 2016-04-18 21:35:39 +02:00
Jannes Höke 1db337fe2b Merge branch 'master' into dispatcher-rework 2016-04-18 21:23:14 +02:00
Leandro Toledo b40a59f509 Merge pull request #240 from python-telegram-bot/os_exit
exit immediately if receiving second interrupt #224
2016-04-18 16:22:21 -03:00
Jannes Höke 0d9d5032ef exit immediately if receiving second interrupt #224 2016-04-18 19:21:57 +02:00
Jannes Höke de5619f3ca tests 2016-04-18 18:50:49 +02:00
Jannes Höke b6fceefc80 documentation 2016-04-18 18:13:54 +02:00
Jannes Höke 687a3b0ba1 dispatcher: also break on errors in checkHandler 2016-04-18 17:15:41 +02:00
Jannes Höke bf5ba9a369 Merge branch 'bot-api-2.0' into dispatcher-rework 2016-04-17 22:22:52 +02:00
Jannes Höke d879a0d018 convert reply_markup to json 2016-04-17 22:11:29 +02:00
Jannes Höke ad211655ea Merge branch 'master' into dispatcher-rework
Conflicts:
	README.rst
2016-04-17 12:45:31 +02:00
Jannes Höke 3a0eb588cb Merge branch 'bot-api-2.0' into dispatcher-rework 2016-04-17 12:43:59 +02:00
Jannes Höke c9bfa71ff9 decode new message fields 2016-04-17 12:43:34 +02:00
Jannes Höke 5f19452dd7 implement de_list 2016-04-17 12:43:09 +02:00
Jannes Höke 5cccf2603b reorder imports 2016-04-17 12:42:41 +02:00
Jannes Höke 185b080daa fix de_json 2016-04-17 12:42:30 +02:00
Jannes Höke cb99341848 Update README.rst 2016-04-16 22:17:43 +02:00
Jannes Höke 1544f612ae remove cancel command 2016-04-16 21:11:41 +02:00
Jannes Höke 53d1d5f589 fix cancel command 2016-04-16 21:09:24 +02:00
Jannes Höke 6992a7a369 fix key error 2016-04-16 21:03:30 +02:00
Jannes Höke a846c8fd86 Merge branch 'bot-api-2.0' into dispatcher-rework 2016-04-16 20:58:08 +02:00
Jannes Höke 0e5129e59f fix method names and parameters for new methods 2016-04-16 20:57:50 +02:00
Jannes Höke 90576de9e2 inline keyboard example works 2016-04-16 20:55:43 +02:00
Jannes Höke 79ca07f839 Merge branch 'bot-api-2.0' into dispatcher-rework 2016-04-16 20:33:36 +02:00
Jannes Höke 63c793aad4 initial example for inline keyboard 2016-04-16 20:32:44 +02:00
Jannes Höke 5e80efaa54 editMessage->editMessageText 2016-04-16 20:29:43 +02:00
Jannes Höke a114f70249 fix callback query condition 2016-04-16 20:29:08 +02:00
Jannes Höke 31fba47829 fix super calls and module docs 2016-04-16 19:25:38 +02:00
Jannes Höke 360c3077ea update examples 2016-04-16 19:25:08 +02:00
Jannes Höke f2a92ccf46 Merge branch 'bot-api-2.0' into dispatcher-rework 2016-04-16 19:00:01 +02:00
Leandro Toledo dd8f94885a Commenting out deprecated arguments #232 2016-04-16 13:59:15 -03:00
Jannes Höke 06ec465c5f Merge pull request #237 from tsnoam/master
request: catch socket.error
2016-04-16 18:49:21 +02:00
Leandro Toledo 79228b0655 Adds kwargs for InlineQueryResult objects #232 2016-04-16 13:49:16 -03:00
Jannes Höke b2045717d6 Merge branch 'bot-api-2.0' into dispatcher-rework 2016-04-16 18:18:37 +02:00
Leandro Toledo 15cc410c10 Merge remote-tracking branch 'upstream/master' into bot-api-2.0 2016-04-16 13:16:49 -03:00
Leandro Toledo f6524b0207 Adding InlineQueryResultCachedVoice #232 2016-04-16 13:10:30 -03:00
Noam Meltzer ecc86d4bcd request: catch socket.error
socket.error is another exception which is thrown by the underlying
infrastacture and not handled by the urllib2 or httplib layers

fixes #236
2016-04-16 19:09:45 +03:00
Leandro Toledo 56b17f2a17 Adding InlineQueryResultVoice #232 2016-04-16 13:05:55 -03:00
Leandro Toledo 8bf4a6fdda Refactoring InlineQueryResultVideo #232 2016-04-16 13:01:26 -03:00
Leandro Toledo 109af62425 Adding InlineQueryResultVenue #232 2016-04-16 12:58:36 -03:00
Leandro Toledo ec27edef58 Refactoring InlineQueryResultPhoto #232 2016-04-16 12:55:05 -03:00
Leandro Toledo 7231eaa349 Refactoring InlineQueryResultMpeg4Gif #232 2016-04-16 12:52:21 -03:00
Leandro Toledo 1876867ec7 Adding InlineQueryResultLocation #232 2016-04-16 12:49:07 -03:00
Leandro Toledo 17509fc24f Refactoring InlineQueryResultGif #232 2016-04-16 12:46:24 -03:00
Leandro Toledo 2d2b269932 Adding InlineQueryResultDocument #232 2016-04-16 12:39:53 -03:00
Leandro Toledo 802a74c606 Adding InlineQueryResultContact #232 2016-04-16 12:35:23 -03:00
Leandro Toledo c4074f740e Refactoring InlineQueryResultAudio #232 2016-04-16 12:32:40 -03:00
Leandro Toledo 1e0ee0694f Refactoring InlineQueryResultArticle #232 2016-04-16 12:30:18 -03:00
Leandro Toledo 6a7c0bb584 Adding InlineQueryResultCachedVideo #232 2016-04-16 12:22:29 -03:00
Leandro Toledo fb2fc3842b Adding InlineQueryResultCachedSticker #232 2016-04-16 12:20:15 -03:00
Leandro Toledo c794c3520b Adding InlineQueryResultCachedPhoto #232 2016-04-16 12:18:50 -03:00
Leandro Toledo 0fd013feec Adding InlineQueryResultCachedMpeg4Gif #232 2016-04-16 12:16:45 -03:00
Leandro Toledo 1834d6c754 Adding InlineQueryResultCachedGif #232 2016-04-16 12:14:43 -03:00
Leandro Toledo f51564f7cd Adding InlineQueryResultCachedDocument #232 2016-04-16 12:12:37 -03:00
Leandro Toledo 624160e1db Adding InlineQueryResultCachedAudio #232 2016-04-16 12:09:26 -03:00
Jannes Höke d2f2b74bdb imports and classname fix 2016-04-16 16:54:07 +02:00
Leandro Toledo 85f1b1af0c Adding sendContact and sendVenue methods #232 2016-04-16 11:48:36 -03:00
Jannes Höke 6cb177d2a7 fix markup in readme 2016-04-16 16:46:40 +02:00
Jannes Höke b5cbf17ef5 Merge branch 'bot-api-2.0' into dispatcher-rework 2016-04-16 16:41:39 +02:00
Jannes Höke 0d0ad1334c add documentation and minor stuff 2016-04-16 16:36:12 +02:00
Leandro Toledo b9305ca7ac Adding MessageEntity and Venue classes #232 2016-04-16 11:33:58 -03:00
Leandro Toledo 0e21609382 Adding InputMessageContent classes #232 2016-04-16 11:23:25 -03:00
Jannes Höke 95fde0c6c4 create missing handler types and minor fixes 2016-04-16 15:21:19 +02:00
Jannes Höke 884bb41d4a update README with dispatcher changes 2016-04-16 15:20:52 +02:00
kiddick a9b305edd0 Fix class declaration according to consistency. (#235) 2016-04-15 17:20:37 +03:00
Jannes Höke 1e19084a0d initial commit for dispatcher rework. deleted updatequeue.py as it is not needed. added handler base class, messagehandler, commandhandler, regexhandler. adjusted dispatcher for new system 2016-04-14 23:57:40 +02:00
Noam Meltzer e179b27f57 dispatcher: fix wrong variable (#233) 2016-04-14 23:23:02 +03:00
Leandro Toledo 8b95f9cbeb PEP 8 - lemme sleep Traviszzzzz #232 2016-04-14 03:59:33 -03:00
Leandro Toledo 390184f605 Replacing assertIsInstance() to assertTrue(isinstance()) #232 2016-04-14 03:52:35 -03:00
Leandro Toledo 086fa1251c Minor fixes #232 2016-04-14 03:40:26 -03:00
Leandro Toledo 60f9aede07 Minor fix on answerInlineQuery #232 2016-04-14 02:38:51 -03:00
Leandro Toledo c411ef7822 Adding switch_pm_text and switch_pm_parameter to answerInlineQuery #232 2016-04-14 02:34:29 -03:00
Leandro Toledo e1de7220df Adding ChosenInlineResult #232 2016-04-14 02:21:00 -03:00
Leandro Toledo 429ea92254 Adding KeyboardButton #232 2016-04-14 02:01:05 -03:00
Leandro Toledo 751402a0d3 Adding new Bot methods editMessageText, editMessageCaption, editMessageReplyMarkup #232 2016-04-14 00:28:06 -03:00
Leandro Toledo 2af15cadd6 New method answerCallbackQuery #232 2016-04-13 21:25:26 -03:00
Leandro Toledo 93e19dc2ae Adding CallbackQuery #232 2016-04-13 21:10:04 -03:00
Leandro Toledo c2f5309cbf Adding InlineKeyboardMarkup #232 2016-04-13 20:41:26 -03:00
Leandro Toledo 1657e43904 Adding InlineKeyboardMarkup #232 2016-04-13 20:38:45 -03:00
Leandro Toledo 23eba8a24e Adding InlineKeyboardButton #232 2016-04-13 20:26:38 -03:00
Leandro Toledo ed170e1595 Bootstrapping InputMessageContent classes #232 2016-04-13 20:01:36 -03:00
Leandro Toledo 46ca28f01c Bootstrapping InlineQueryResult classes #232 2016-04-13 09:59:48 -03:00
Leandro Toledo b99518e8b8 3 more classes #232 2016-04-12 01:23:52 -03:00
Leandro Toledo 62045316fe Adding 27 new classes #232 2016-04-12 01:12:35 -03:00
Leandro Toledo 736d62e20d New methods kickChatMember and unbanChatMember #232 2016-04-12 00:46:50 -03:00
Leandro Toledo 68dca31f15 Renamed fields new_chat_participant and left_chat_participant #232 2016-04-12 00:33:42 -03:00
Leandro Toledo 9a523dbc40 Update CONTRIBUTING.rst 2016-04-12 00:29:00 -03:00
Avanatiker 0342a5b30b Update timerbot.py
The missing space bothered me.
2016-04-11 13:36:59 +03:00
Rahiel Kasim b7f83cf375 Merge pull request #226 from rahiel/master
move examples to wiki, improve docs
2016-04-03 14:44:59 +02:00
Rahiel Kasim d9d48f5c91 readme: move external examples to the wiki + other improvements 2016-04-03 00:26:24 +02:00
Rahiel Kasim 01b90e7ede small improvements 2016-04-02 23:13:49 +02:00
leandrotoledo ba0ea4f268 Add TOKEN and CHAT_ID for testing in favor of #221 2016-03-31 15:36:18 -03:00
Noam Meltzer a0788788da Merge pull request #220 from kiddick/master
Fix obsolete import for fsm bot.
2016-03-26 19:12:00 +03:00
kiddick@users.noreply.github.com a264530540 Fix obsolete import for fsm bot. 2016-03-26 19:00:05 +03:00
Noam Meltzer 33f047a3dc Merge pull request #219 from tsnoam/master
Documentation improvements
2016-03-23 23:06:46 +02:00
Noam Meltzer 88eb332c99 Documentation improvements 2016-03-23 22:41:21 +02:00
Noam Meltzer eb6bafc003 Merge pull request #217 from python-telegram-bot/fix_webhook
Only set webhook if using SSL and also send certificate
2016-03-23 20:26:23 +02:00
Rahiel Kasim f4603831b8 Merge pull request #218 from springjools/master
Fix annoying grammar error
2016-03-23 15:32:02 +01:00
jools b41e1ab127 Fix annoying grammar error 2016-03-23 16:23:38 +02:00
Jannes Höke 5c71ebce52 ensure url_path is string 2016-03-23 11:04:38 +01:00
Jannes Höke 6db377d56d Only set webhook if using SSL and also send certificate 2016-03-23 10:11:10 +01:00
leandrotoledo da193711b1 Add legacy imports test to Dispatcher and JobQueue 2016-03-22 11:12:47 -03:00
Leandro Toledo 4f26bdd18f Merge pull request #213 from python-telegram-bot/prep34
Prepare Release of v3.4
2016-03-21 23:15:38 -03:00
Jannes Höke 808945b623 prepare release of v3.4 2016-03-22 03:02:13 +01:00
Jannes Höke 63a83d4cc2 fix imports of updatequeue 2016-03-22 02:48:56 +01:00
Jannes Höke c43b348117 lazily load all of telegram.ext 2016-03-22 02:42:40 +01:00
Jannes Höke 45a47d54bd move updatequeue to telegram.utils 2016-03-22 02:42:19 +01:00
Jannes Höke 5e7f2688be add encoding to fsm example bot 2016-03-22 02:33:43 +01:00
Jannes Höke 7199d2894f add state machine example 2016-03-21 20:08:32 +01:00
Jannes Höke d9a58fd904 Merge pull request #211 from python-telegram-bot/ext-docs
Adjust sphinx docs to telegram.ext submodule
2016-03-21 14:23:33 +01:00
Jannes Höke cf9897e74b Merge pull request #208 from rahiel/master
declare support for python 3.5, drop old py 3.2 reference
2016-03-21 14:23:23 +01:00
Jannes Höke 30308bdcc6 Fix formatting, table of contents link, add note on errors 2016-03-20 00:37:55 +01:00
Jannes Höke af62c5be8e update examples to telegram.ext 2016-03-19 16:39:35 +01:00
Jannes Höke cd7bc8dfac Update README to telegram.ext, move API section up 2016-03-19 16:35:02 +01:00
Jannes Höke 150914cf25 Adjust sphinx docs to telegram.ext submodule 2016-03-19 13:26:38 +01:00
Rahiel Kasim 19390b9659 declare support for python 3.5, drop old py 3.2 reference 2016-03-17 22:12:36 +01:00
Jannes Höke fac4eb6438 Merge pull request #202 from tsnoam/master
Updater webhook bootstrapping improvements
2016-03-17 13:05:04 +01:00
Noam Meltzer 2939885c5b test_updater: import Updater from telegram.ext 2016-03-15 22:08:06 +02:00
Noam Meltzer f07f33e160 updater: unitests for _set_webhook 2016-03-15 22:02:34 +02:00
Noam Meltzer 0ddcb16889 start_webhook(): call bot.setWebhook() as a bootstrap step 2016-03-15 22:02:34 +02:00
Noam Meltzer 594b81e463 start_polling(): new argument - bootstrap_retries
refs #196
2016-03-15 22:02:16 +02:00
Leandro Toledo 41d0d45e2f Merge pull request #204 from python-telegram-bot/debug-level-logs
Changing INFO logs to DEBUG and minor fixes
2016-03-15 11:35:05 -03:00
Leandro Toledo 1e4ae6546f Changing INFO logs to DEBUG and minor fixes 2016-03-14 22:56:20 -03:00
Leandro Toledo fd170773e2 Merge pull request #198 from rahiel/master
lazily load Updater & move extended classes to submodule
2016-03-14 17:00:25 -03:00
Rahiel Kasim d1516f66ac deprecation warning for telegram.Updater 2016-03-14 19:43:38 +01:00
Rahiel Kasim 739e218eb7 PEP8 2016-03-14 15:26:22 +01:00
Rahiel Kasim dcea2c8015 Merge branch 'master' of https://github.com/leandrotoledo/python-telegram-bot 2016-03-14 15:07:16 +01:00
Rahiel Kasim 98112d3987 move Updater and friends to ext submodule 2016-03-14 14:50:12 +01:00
Jannes Höke 45a4689fd0 update docstrings of Message regarding supergroup conversion 2016-03-14 09:54:33 +01:00
Jannes Höke 82030c4109 Merge pull request #199 from python-telegram-bot/send-inputfile-from-bytesio
Fix InputFile attribute check when from a BufferedReader object
2016-03-14 01:17:27 +01:00
Leandro Toledo 25595e6d9e Update README.rst
Update group link
2016-03-13 19:23:48 -03:00
Leandro Toledo 9637a8748c Merge pull request #201 from shelomentsevd/master
Dispather command processing fix(#200).
2016-03-13 12:26:04 -03:00
Dmitriy 00e2b4815a Processing commands without casting to UTF-8 2016-03-13 12:32:27 +03:00
Shelomentsev Dmitriy fb34f81533 ShelomentsevD added to AUTHORS.rst 2016-03-13 02:27:10 +03:00
Shelomentsev Dmitriy 3d89f6b284 dispatchTelegramCommand no-break space fix. 2016-03-13 02:15:48 +03:00
Leandro Toledo 7a8e84b46f Update README.rst 2016-03-12 20:04:45 -03:00
Leandro Toledo 8ad34fc3c0 Fix InputFile attribute check when from a BufferedReader object 2016-03-12 19:40:56 -03:00
Leandro Toledo 00f4328bab Remove files from download()' tests on make clean 2016-03-12 18:23:14 -03:00
Rahiel Kasim 8b196ce71f load Updater class only when used 2016-03-12 15:29:54 +01:00
Jannes Höke 196d1fcc3d Update invite link to supergroup 2016-03-11 23:43:41 +01:00
Leandro Toledo 7ff7397d0f Update CONTRIBUTING.rst 2016-03-11 17:45:06 -03:00
Leandro Toledo 0c676b1a75 Merge pull request #195 from aidarbiktimirov/master
Added disable_notification parameter for silent messages
2016-03-11 17:12:00 -03:00
Aydar Biktimirov dc9b77e02c Merge remote-tracking branch 'upstream/master' 2016-03-11 23:03:13 +03:00
Leandro Toledo e7b339d527 Merge pull request #197 from rahiel/master
bot.sendMessage: update documentation
2016-03-11 16:42:16 -03:00
Rahiel Kasim 5958da0031 bot.sendMessage: update documentation 2016-03-11 20:32:10 +01:00
Aydar Biktimirov 0600b2634e added tests for disable_notification parameter 2016-03-11 09:37:43 +03:00
Leandro Toledo f8f16f0fe9 Update README.rst
Link to group updated
2016-03-10 10:12:39 -03:00
Aydar Biktimirov 433110abe9 Added disable_notification parameter for silent messages 2016-03-09 18:47:33 +03:00
Noam Meltzer 793437fec7 Merge pull request #191 from tsnoam/master
updater: allow cleaning updates from Telegram servers before start (+ docstring fix)
2016-03-01 23:32:20 +02:00
Noam Meltzer a0a040a9c2 updater: allow cleaning updates from Telegram servers before start 2016-03-01 22:12:12 +02:00
Noam Meltzer f0e7a3316c jobqueue: fix docstring 2016-03-01 20:20:51 +02:00
Jannes Höke 218e22631c Prepare to release v3.3 2016-02-28 02:33:49 +01:00
Jannes Höke 75c6662f35 leverage timing a bit more 2016-02-28 02:11:48 +01:00
Jannes Höke cd42524fd4 Merge pull request #174 from python-telegram-bot/inlinebots
Implement Inlinebots
2016-02-28 02:10:21 +01:00
Jannes Höke b5875a3abd increase timing for repeatedly failing travis test 2016-02-28 01:53:18 +01:00
Jannes Höke 139cbc657d add inline bot handler example 2016-02-28 01:51:14 +01:00
Jannes Höke 4aca4d1d1f Merge pull request #187 from python-telegram-bot/flaky-tests
Flaky tests
2016-02-28 01:02:11 +01:00
Noam Meltzer 2e6db1330f test_botan.py: another flaky test 2016-02-27 23:39:03 +02:00
Noam Meltzer ccb24d1288 request.py: fix for python2.7 2016-02-27 23:13:29 +02:00
Noam Meltzer 26f87c4873 test_video.py: specify timeout for the sendVideo operation itself 2016-02-27 23:01:22 +02:00
Noam Meltzer fc618274ae bot.py: allow specifying timeout for sendVideo operations 2016-02-27 23:00:33 +02:00
Noam Meltzer d2623d2671 test_voice.py: adapt to latest changes in the API 2016-02-27 22:53:40 +02:00
Noam Meltzer ec8cd37345 test_video.py: adapt to latest changes in the API 2016-02-27 22:50:28 +02:00
Jannes Höke ee56ffc9a5 Merge pull request #182 from tsnoam/master
request: better parsing of URLError exception
2016-02-24 09:51:02 +01:00
Noam Meltzer ca8404adb7 travis.yml: another try to fix nosetests command line 2016-02-24 00:55:30 +02:00
Noam Meltzer d5b35e7e1d unitests: remove docstrings & prints - not needed with nosetests 2016-02-24 00:45:49 +02:00
Noam Meltzer df8e388189 travis.yml: fix nosetests command line 2016-02-23 23:32:52 +02:00
Noam Meltzer a2632b777a travis.yml: enable nosetests --with-flaky 2016-02-22 02:03:10 +02:00
Noam Meltzer e0cf0abb1b flaky tests: try up to 3 times, need to succeed once 2016-02-22 01:52:31 +02:00
Noam Meltzer ec13a36bdd unitests: use home brewed timeout for tests 2016-02-22 01:38:26 +02:00
Jannes Höke d05fa1275a use timed tests and flaky 2016-02-21 12:52:47 +01:00
Jannes Höke e189e8ad05 add -v to nosetests to debug travis tests 2016-02-21 12:08:40 +01:00
Jannes Höke efd10507d0 remove kwargs in favor of named keyword arguments, validate argument types 2016-02-21 11:33:34 +01:00
Noam Meltzer 2338377eda request: better parsing of URLError exception 2016-02-20 15:20:00 +02:00
Jannes Höke ca526fba73 improve unit tests according to comments 2016-02-20 12:14:34 +01:00
Jannes Höke e2cc8db992 Merge branch 'master' into inlinebots 2016-02-20 11:17:34 +01:00
Noam Meltzer 04c86813b3 Merge pull request #177 from tsnoam/master
join() threads for a cleaner stop procedure
2016-02-19 19:10:35 +02:00
Noam Meltzer 7d39e1bdef updater: more unitests for webookhandler 2016-02-19 18:00:57 +02:00
Noam Meltzer d415a60ebf join() threads instead of guessing if they're running
- new book keeping of dispatcher's async threads so they can be joined
   when stopping
 - updater, webhook & dispatcher threads are now kept on
   Updater.__threads so they can be joined at the end

refs #175
2016-02-19 18:00:57 +02:00
Noam Meltzer fd7baa2236 updater.py: use _init_thread for webhook as well 2016-02-19 18:00:57 +02:00
Noam Meltzer 4945d99de6 webhookhandler: better handling of invalid POST data 2016-02-19 18:00:57 +02:00
Noam Meltzer c103c05679 updater.py: fix log of thread name 2016-02-19 18:00:57 +02:00
Jannes Höke 8afea8cd69 Update group link (issue #178) 2016-02-12 08:15:06 +01:00
Noam Meltzer 9d77a3b503 Merge pull request #162 from rahiel/master
legacy echobot: simpler exception handling
2016-02-10 10:44:09 +02:00
Rahiel Kasim 3e978277b3 echobot: simplify exception handling 2016-02-09 15:28:54 +01:00
Rahiel Kasim d02e656700 raise NetworkError for HTTP 502 (Bad Gateway) 2016-02-09 15:26:59 +01:00
Jannes Höke edf4e8abbe fix docstring 2016-02-07 23:34:26 +01:00
Jannes Höke c55c5408b1 tests and corrections for inlinequery 2016-02-07 23:34:15 +01:00
Jannes Höke d1dc32d849 tests and corrections for choseninlineresult 2016-02-07 23:26:38 +01:00
Jannes Höke fc73948c82 fix to_dict tests 2016-02-07 23:25:48 +01:00
Jannes Höke 70dfb88eb5 complete tests for inline results 2016-02-07 22:56:25 +01:00
Jannes Höke 2a01292a64 Merge branch 'master' into inlinebots 2016-02-07 22:42:12 +01:00
Jannes Höke 5b9ec7ff40 catch errors in error handlers 2016-02-07 22:40:55 +01:00
Jannes Höke bec81b5c3b Merge pull request #161 from tsnoam/master
better exception handling
2016-02-07 22:34:49 +01:00
Jannes Höke f5a1e00af9 add info about logging to getting started section 2016-02-07 22:25:16 +01:00
Jannes Höke eac3d8842d remove json import 2016-02-07 15:09:41 +01:00
Jannes Höke 17ac73c3c4 fix message to json 2016-02-07 14:46:36 +01:00
Noam Meltzer 4a5001668d updater/dispatcher: on exception stop all threads 2016-02-07 00:56:30 +02:00
Noam Meltzer 7ebbc60694 Unauthorized is HTTP code 401
I am not certain where the older 403 came from, but for now going to
leave it as is
2016-02-07 00:56:30 +02:00
Noam Meltzer 9c81b810f2 be verbose when running test - easier to follow progress 2016-02-07 00:56:30 +02:00
Noam Meltzer e8363f2440 control name and location of python cmds
this is very useful for setups where python/pylint/etc. are not
installed in default names/paths
2016-02-07 00:56:30 +02:00
Noam Meltzer e82ae432f7 dispatcher is now stopped using a threading.Event 2016-02-07 00:56:30 +02:00
Noam Meltzer d4beb94059 Add specific exceptions types for important errors
maintain backward compatibility with the 'old' exception by inherting
from TelegramError and using the same message
2016-02-06 18:48:55 +02:00
Noam Meltzer 029705e0af updater: catch TelegramError instead of URLError
- URLError is now being caught by telegram.request.
- simplify the code now that we don't need to catch URLError
2016-02-06 18:48:55 +02:00
Noam Meltzer 2859a8873f utils.request: catch URLError in _try_except_req decorator 2016-02-06 18:48:55 +02:00
Jannes Höke e5df2072e4 Merge pull request #171 from tsnoam/disable_audio_unitest
test_audio: temp. disable duration unitest
2016-02-06 17:47:06 +01:00
Noam Meltzer 034d0054ea test_audio: temp. disable duration unitest
due to telegram server bug
2016-02-06 18:34:30 +02:00
Leandro Toledo 0edb2e0a0f Update README.rst
Updating joinchat link
2016-02-03 11:29:50 -02:00
Jannes Höke 2436cab2e5 tests for gif and mpeg4 2016-02-03 02:09:05 +01:00
Leandro Toledo 3e7dc705db Merge pull request #169 from trollknurr/little-readme-extend
Little document extend
2016-02-01 21:22:35 -02:00
Shtarev cabbef8780 how to send photo 2016-02-01 20:14:17 +03:00
Jannes Höke 08836c60ca tests for InlineQueryResultPhoto 2016-01-31 10:52:04 +01:00
Jannes Höke 6d2e159d75 move 'no new updates found' message to debug (#167) 2016-01-31 10:32:34 +01:00
Jannes Höke 8d94c14504 Merge branch 'master' into inlinebots 2016-01-29 23:55:34 +01:00
Jannes Höke 69183d85f7 add test for InlineQueryResultArticle 2016-01-29 23:54:49 +01:00
Jannes Höke 142cc6e6ad add test for dispatching inline queries/results 2016-01-29 23:54:49 +01:00
Jannes Höke d4370e49e5 Merge pull request #164 from jlmadurga/parse_mode-html
Parse mode for HTML added
2016-01-27 11:46:10 +01:00
Juan Madurga df1d639144 Fix doc 2016-01-27 11:28:44 +01:00
Juan Madurga c13af4d61d parse mode for HTML added 2016-01-27 11:20:32 +01:00
Leandro Toledo 516d41eac0 Merge pull request #163 from jlmadurga/replymarkup-tests
Add tests for replymarkup objects
2016-01-26 21:11:03 -02:00
Juan Madurga 702544f709 fix pep8 extra lines 2016-01-26 23:58:07 +01:00
Juan Madurga 713f0d1335 add tests for replymarkup objects 2016-01-26 23:43:16 +01:00
Jannes Hoeke a383cee558 merge master into inlinebots 2016-01-25 18:05:27 +01:00
Jannes Höke 44645d2cc6 Merge pull request #157 from jlmadurga/context-for-handlers
Add context to dispatcher
2016-01-25 17:46:14 +01:00
Jannes Höke 77f00e386c Merge pull request #159 from ollmer/botan_integration
Botan integration
2016-01-25 17:18:12 +01:00
Oleg Shlyazhko 1000a56e0d more test vor botan module, increase coverage 2016-01-24 18:32:12 +03:00
Oleg Shlyazhko c3bca9af48 remove checking for non 200 http codes, exceptions already handle it 2016-01-24 18:28:27 +03:00
Oleg Shlyazhko 9eec34edd1 pep8 fix 2016-01-23 20:13:48 +03:00
Oleg Shlyazhko 383a2d3742 fix httperror error output 2016-01-23 20:03:29 +03:00
Oleg Shlyazhko d1e4eeaf30 fix urlopen data format 2016-01-23 19:49:55 +03:00
Oleg Shlyazhko 80b53f1ab7 fix urlopen call 2016-01-23 19:44:40 +03:00
Oleg Shlyazhko 0faa38b8af fix httperror logging 2016-01-23 19:29:01 +03:00
Oleg Shlyazhko 5a2a541ae0 rename botan test correctly and move token to ENV 2016-01-23 19:09:56 +03:00
Oleg Shlyazhko 7508c2f8bf add detailed comment in class and src key to tracking url 2016-01-23 16:59:53 +03:00
Oleg Shlyazhko bb2cce56a3 insert correct appmetrica token instead of bot token in botan test 2016-01-23 16:58:44 +03:00
Oleg Shlyazhko 2c12bd6775 replace print with logging 2016-01-23 16:58:01 +03:00
Oleg Shlyazhko 5b05bcc8f2 add http error exception handling 2016-01-23 15:21:13 +03:00
Oleg Shlyazhko adb446abf6 fix pep8 styling 2016-01-23 15:14:17 +03:00
Oleg Shlyazhko 545767ea40 add myself to authors 2016-01-23 14:25:09 +03:00
Oleg Shlyazhko 7931045bf3 test for botan analytics module 2016-01-23 14:24:49 +03:00
Oleg Shlyazhko 17c2857622 add module for botan analytics 2016-01-23 14:24:34 +03:00
Juan Madurga cbcbfab45f fix pep8 2016-01-22 16:42:39 +01:00
Juan Madurga 1dc9907a70 fix code comments by jh0ker 2016-01-22 16:30:55 +01:00
Juan Madurga b8c9992eff Merge branch 'master' into context-for-handlers 2016-01-22 09:46:05 +01:00
Jannes Höke fe26c94440 Merge pull request #155 from tsnoam/master
_try_except_req(): catch httplib.HTTPException
2016-01-22 02:48:11 +01:00
Juan Madurga a6650de93d Add context parameter to dispatcher. Handlers now can updates with a context data if required 2016-01-20 19:56:41 +01:00
Noam Meltzer dc032b349c _try_except_req(): catch httplib.HTTPException
fixes #153
2016-01-19 22:02:34 +02:00
Jannes Höke 5c2458bfd8 merge master into inlinebots 2016-01-14 15:28:22 +01:00
Jannes Höke 6166e7f07a Merge pull request #152 from python-telegram-bot/docstring_pep257_checker
Add docstring style checker and fixing some
2016-01-14 15:24:44 +01:00
Leandro Toledo 2a7b03e7c2 Fix travis - file_size is irrelevant for resend test 2016-01-13 19:15:11 -02:00
Jannes Höke da97c1741c merge 'urls' into 'inline' 2016-01-13 21:58:45 +01:00
Jannes Höke 70445dc054 Merge pull request #151 from python-telegram-bot/urls
enable sending by URL for all sendX methods
2016-01-13 21:49:04 +01:00
leandrotoledo d3a02405b2 pep8 2016-01-13 14:23:15 -02:00
leandrotoledo dfc75cc64e Add docstring style checker and fixing some 2016-01-13 14:09:35 -02:00
Jannes Höke 332667c98b flake8 2016-01-12 13:16:43 +01:00
Jannes Höke f71c40e0b8 use basename and check if filename has extension 2016-01-12 12:42:07 +01:00
Leandro Toledo 9f55c15cc7 Add sendPhoto tests, fix file_id casting to str instead unicode 2016-01-11 22:25:46 -02:00
Leandro Toledo a32ae8b895 Merge branch 'master' into urls 2016-01-11 22:12:06 -02:00
Leandro Toledo a539a0c3a5 Add data object for sendPhoto tests 2016-01-11 22:11:29 -02:00
Leandro Toledo b4abf75524 Fix data objects references for tests to raw files on Githup repo 2016-01-11 21:11:10 -02:00
Leandro Toledo 12d71d5a91 Fix file_size tests for send* by URL 2016-01-11 20:33:17 -02:00
Leandro Toledo 48bf6bfab0 Adding telegram.gif for testing purposes 2016-01-11 20:20:57 -02:00
Leandro Toledo 7227ca3aab Tests for send(Audio,Voice,Video) by URL 2016-01-11 20:19:55 -02:00
Jannes Höke 307d2621d7 removed support-restriction for sending by url 2016-01-10 22:08:01 +01:00
Jannes Höke 831a0a31e5 flake8 2016-01-10 15:20:05 +01:00
Jannes Höke d10b657521 enable sending by URL for all sendX methods 2016-01-10 15:12:42 +01:00
Jannes Höke ef1012b722 enable sending by URL for all sendX methods 2016-01-10 15:11:17 +01:00
Jannes Höke 5fd7a4fe0d release v3.3b1 2016-01-09 15:50:19 +01:00
Jannes Höke 85d20ba549 Merge branch 'master' into inlinebots 2016-01-09 15:44:18 +01:00
Jannes Höke 48c1673d7c fix additional args for inline queries 2016-01-09 15:30:47 +01:00
Jannes Höke af6eb457c1 Merge branch 'inlinebots' of github.com:python-telegram-bot/python-telegram-bot into inlinebots 2016-01-09 15:12:34 +01:00
Jannes Höke 6ece89bc56 update inline query results after api change 2016-01-09 15:09:48 +01:00
Jannes Höke c69cdfd184 Initial commit for inline bot support 2016-01-09 15:09:48 +01:00
Jannes Höke 6dab7068c3 Add Telegram Group link as badge 2016-01-09 14:57:46 +01:00
Jannes Höke fd90c16265 merge master into inlinebots 2016-01-09 14:51:24 +01:00
Jannes Höke 77ca036d02 update inline query results after api change 2016-01-09 14:48:27 +01:00
Jannes Höke e2e98e86db Initial commit for inline bot support 2016-01-09 14:48:27 +01:00
Leandro Toledo 71f82d57d9 Update CONTRIBUTING.rst 2016-01-06 17:09:19 -02:00
Jannes Höke 6a3d514ed1 Merge branch 'master' into inlinebots 2016-01-06 16:28:17 +01:00
Leandro Toledo 6aa2e510a3 Merge pull request #149 from python-telegram-bot/contribute-update
Expanding more subjects on CONTRIBUTING.rst
2016-01-06 13:04:59 -02:00
leandrotoledo 099deabf4e Removing if block to install unittest2 when running tests on Py2.6 2016-01-06 12:50:42 -02:00
Jannes Höke b78ceeed10 fix race condition in dispatcher 2016-01-06 15:36:14 +01:00
leandrotoledo a8240dca1f Adding unittest2, update travis to use requirements-dev.txt 2016-01-06 12:12:01 -02:00
leandrotoledo 7e207433cc Using flake8 instead pep8 2016-01-06 12:05:09 -02:00
leandrotoledo fc6d0f4f07 Expanding more subjects 2016-01-06 11:54:22 -02:00
Jannes Höke 4fef5bcceb Merge branch 'master' into inlinebots 2016-01-05 15:17:38 +01:00
Jannes Höke fc64cc0a4a Merge pull request #148 from mr-karan/patch-1
handle case of negative values of seconds
2016-01-05 14:37:26 +01:00
Karan Sharma 14a9962296 handle case of negative values of seconds 2016-01-05 19:06:28 +05:30
Jannes Höke 4197400853 remove token once again 2016-01-05 14:29:20 +01:00
Jannes Höke aa8966832b release 3.2 and update copyright notice to 2015-2016 2016-01-05 14:12:03 +01:00
Jannes Höke e27427676d fix jobqueue creation 2016-01-05 13:40:07 +01:00
Jannes Höke 8175fd7b53 update timerbot example 2016-01-05 13:39:51 +01:00
Jannes Höke 2875bae881 Integrate JobQueue with Updater 2016-01-05 13:32:19 +01:00
Jannes Höke c756aa1c02 remove error raising in dispatchType 2016-01-05 12:49:48 +01:00
Jannes Höke 6d5c3187fc Initial commit for inline bot support 2016-01-04 17:31:06 +01:00
Jannes Höke c2f04331f3 Merge pull request #145 from python-telegram-bot/jobqueue
JobQueue by @franciscod
2016-01-04 12:34:29 +01:00
Jannes Höke 5293ec49ff Add section about JobQueue to README 2016-01-04 11:34:47 +01:00
Jannes Höke 9319903343 rename testclass 2016-01-04 11:08:43 +01:00
Jannes Höke 95e2aad9bd fix sphinx build 2016-01-04 02:36:27 +01:00
Jannes Höke 73f4f26da5 more tests 2016-01-04 02:36:15 +01:00
Jannes Höke 24b2bf335c Increase time for travis testing 2016-01-04 02:12:24 +01:00
Jannes Höke fc3fa0f515 Increase time for travis testing 2016-01-04 02:11:42 +01:00
Jannes Höke 87657bcd70 flake8 and string formatting 2016-01-04 02:05:39 +01:00
Jannes Höke 81b58c7d00 remove bot token (once again...) 2016-01-04 01:58:50 +01:00
Jannes Höke dd7d1255d1 fixes, tests and examples for job queue 2016-01-04 01:56:22 +01:00
Jannes Höke f813d4f5ec improve docstring 2016-01-04 01:32:47 +01:00
Jannes Höke 623863cee1 fix exception logging 2016-01-04 01:32:00 +01:00
Jannes Höke aa125e59fb Merge branch 'master' into jobqueue 2016-01-04 00:01:27 +01:00
Jannes Höke 68c844df0c implement starting jobqueue in thread and fix errors 2016-01-04 00:01:00 +01:00
Jannes Höke 3779d454f3 Merge pull request #136 from tsnoam/master
consistent TelegramError exceptions
2016-01-03 23:58:14 +01:00
Noam Meltzer 5d168bd479 improve unitest coverage 2016-01-04 00:34:39 +02:00
Noam Meltzer 1c8bb21790 fix python 2.6 unitests which with the backport package unittest2 2016-01-04 00:32:17 +02:00
Noam Meltzer 054c976ad6 add tsnoam to AUTHORS 2016-01-04 00:32:17 +02:00
Noam Meltzer bc2679f2ae utils.request: provide HTTP error code with unknown errors 2016-01-04 00:32:17 +02:00
Noam Meltzer 17dae68654 gitignore: files generated by unitests 2016-01-04 00:32:17 +02:00
Noam Meltzer 7734c1d6a6 fix unitests to work with new token validator 2016-01-04 00:32:13 +02:00
Noam Meltzer aeca3ca174 basic token validation
refs #134
2016-01-04 00:31:40 +02:00
Noam Meltzer 21fdaa4ff7 utils.request: decorate functions with general try... except...
refs #134
2016-01-04 00:31:40 +02:00
Noam Meltzer 79f29c4b9e properly handle utf-8 server response & identify json parsing errors
refs #134
2016-01-04 00:31:40 +02:00
Noam Meltzer a2d8ca3663 some errors are prefixed with '[Error]: ' - strip that down
use custom _lstrip_str() func instead of regex. a little performance
improvment and (IMO) a bit more readable.
2016-01-04 00:31:40 +02:00
Jannes Höke 6f76bfc2de Merge branch 'master' into jobqueue 2015-12-31 15:45:19 +01:00
Jannes Höke 97ebebefc1 Merge branch 'Tengah-master' 2015-12-31 15:41:53 +01:00
Jannes Höke 119743433d merge Tengah-master into master 2015-12-31 15:41:37 +01:00
Bob Pasker b0ad07f30f remove traceback import 2015-12-31 09:29:02 -05:00
Jannes Höke 114cb787ea Merge branch 'master' into jobqueue 2015-12-31 15:22:08 +01:00
Jannes Höke 5d1ef673a3 flake8 2015-12-31 15:04:42 +01:00
Jannes Höke 3e1cb08567 flake8 2015-12-31 15:03:40 +01:00
Jannes Höke 29a4062945 properly lock updater and dispatcher start/stop methods 2015-12-31 14:58:01 +01:00
Jannes Höke 2ff6fe9901 initial commit for JobQueue by @franciscod 2015-12-31 14:56:48 +01:00
Jannes Höke 34b91f5062 properly lock updater and dispatcher start/stop methods 2015-12-31 14:52:28 +01:00
Bob Pasker cc6c4a6eb9 Change a print statement to use logger instead 2015-12-31 08:33:42 -05:00
Jannes Höke fc9456e1a8 release v3.1.2 2015-12-29 14:46:00 +01:00
Jannes Höke 41ba57f064 don't stop the dispatcher thread on uncaught errors 2015-12-29 14:28:39 +01:00
Jannes Höke b205751aee change default value for poll_interval to 0 2015-12-29 14:28:39 +01:00
Jannes Höke c4f13bd1bb Merge pull request #138 from Gems/master
Fix file.download with custom_path
2015-12-28 12:27:26 +01:00
Eduard Gomolyako 7d7397317e Fix file.download with custom_path 2015-12-27 04:01:13 +03:00
Jannes Höke 631954e5d9 Merge pull request #133 from rahiel/master
dedicate examples to the public domain (CC0)
2015-12-25 17:56:07 +01:00
Rahiel Kasim 90ed128a61 dedicate examples to the public domain (CC0) 2015-12-25 15:19:17 +01:00
Jannes Höke 2a2b679362 improved and renamed examples 2015-12-22 13:23:59 +01:00
Jannes Höke f75e329225 fix docstring 2015-12-21 21:40:41 +01:00
Jannes Höke ea7c54ba07 Release v3.1.1, change author email everywhere 2015-12-21 21:18:53 +01:00
Jannes Höke 3c7b037eaa add additional arguments 'groups' and 'groupdict' for regex handlers 2015-12-21 20:25:31 +01:00
Jannes Höke c15a1bc151 fix for #123 2015-12-21 19:36:17 +01:00
Jannes Höke 9e7314134e fix docstring 2015-12-17 14:55:20 +01:00
Jannes Höke 37271e4a02 Merge pull request #127 from python-telegram-bot/chatclass
API updates Oct and Nov
2015-12-16 16:32:19 +01:00
Jannes Höke 0e78606d37 Release v3.1 2015-12-16 16:25:14 +01:00
Jannes Höke cb0736fb3d update sphinx docs 2015-12-16 16:23:18 +01:00
Jannes Höke e0233a59a0 fix docstrings for sphinx 2015-12-16 16:18:48 +01:00
Jannes Höke 6e158042e1 API updates Oct and Nov 2015-12-16 15:31:02 +01:00
Jannes Höke d791a6ee89 Update group link 2015-12-16 02:57:33 +01:00
leandrotoledo 5a3e142358 Updating one more ref to old repo 2015-12-14 21:51:17 -02:00
leandrotoledo 37a58fe1ad Update TODO on README 2015-12-14 21:41:22 -02:00
leandrotoledo 80281cc66d Moving to python-telegram-bot organization 2015-12-14 21:36:22 -02:00
Jannes Höke fffa9d8a7c Update README.rst 2015-12-14 12:22:25 +01:00
Jannes Höke 806b71030f Update group link 2015-12-13 21:24:05 +01:00
Jannes Höke 764c5dac53 Add Logo to README 2015-12-13 21:18:59 +01:00
Jannes Höke 007dc5807a move error disables to .travis.yml 2015-12-11 18:52:23 +01:00
Jannes Höke 16534872a7 add pylintrc ignoring import-error,no-name-in-module to fix travis 2015-12-11 18:38:29 +01:00
Jannes Höke a13245dfbf change 'wb' to 'rb' in certificate open call 2015-12-09 12:59:34 +01:00
Jannes Höke 6622ea3ec0 Release version 3.0.0 2015-12-08 00:07:21 +01:00
Jannes Höke bcadfc5398 Release version 3.0.0 2015-12-07 23:49:19 +01:00
Jannes Höke 89ecb04a85 Catch URLError while getting updates 2015-12-07 23:45:21 +01:00
Jannes Höke 56ab40d94f increase time in test multiple messages 2015-12-01 21:58:39 +01:00
Jannes Höke f5ac1ae067 debug message after processing update 2015-12-01 21:45:12 +01:00
Jannes Höke 23507202e8 Merge branch 'Balduro-boteventhandler' 2015-12-01 18:08:38 +01:00
Jannes Höke 185bff7117 update example 2015-12-01 18:06:42 +01:00
Gerd Augsburg 9f07900d99 Added Balduro to AUTHORS.rst and fixed line length 2015-12-01 15:16:04 +01:00
Gerd Augsburg 809fe4b74f Updated tests for start_webhook 2015-12-01 14:48:55 +01:00
Gerd Augsburg 8a4d5c5de7 Separate start_webhook and setWebhook
I think starting and setting the webhook should be two different tasks.
Because the internal webhook and the adress you see from outside can be
quite diffrent through apache etc. It provides more flexibility.
2015-12-01 14:11:27 +01:00
Jannes Höke 1976822dd0 Add documentation for Updater and Dispatcher 2015-12-01 01:01:28 +01:00
Jannes Höke e60694a8cc update test_webhook and add test_webhook_no_ssl 2015-11-30 23:00:56 +01:00
Jannes Höke 14b4c1ac62 Allow starting webhook without SSL (issue #112) 2015-11-30 23:00:32 +01:00
Leandro Toledo d5890d403b Merge pull request #109 from leandrotoledo/boteventhandler
Indrucing "Updater" and "Dispatcher"
2015-11-30 08:22:36 -02:00
Jannes Höke ef569b68c6 update docs 2015-11-24 21:07:13 +01:00
Jannes Höke 628a4c4eac final renaming of files and flake8 2015-11-24 21:06:55 +01:00
Jannes Höke 83d2ca3aa7 assertIsNone(...) to assertTrue(None is ...) 2015-11-24 20:40:40 +01:00
Jannes Höke 29cdfe671e test removehandler methods 2015-11-24 20:34:38 +01:00
Jannes Höke f21b6046c5 test error in handler, other webhook server functionalites 2015-11-24 19:35:02 +01:00
Jannes Höke 8090658ab4 log warning 2015-11-24 19:33:41 +01:00
Jannes Höke f49f592f0d log warning 2015-11-24 19:33:03 +01:00
Jannes Höke c2853fa1ef WebhookServer: Lock serve_forever() and shutdown() 2015-11-24 15:39:00 +01:00
Jannes Höke e1f3f346bc Test for Update.idle() 2015-11-24 14:57:54 +01:00
Jannes Höke 1005ad57ce Improve signal handling 2015-11-23 17:40:39 +01:00
Jannes Höke 0b72acc7c8 handle SIGINT, SIGTERM and SIGABRT 2015-11-23 03:45:47 +01:00
Jannes Höke 8d267ed896 use logging 2015-11-22 19:20:16 +01:00
Jannes Höke 83812f3af6 rename boteventhandler.py to updater.py 2015-11-22 19:20:05 +01:00
Jannes Höke 658b5ff1c0 update tests 2015-11-22 19:16:49 +01:00
Jannes Höke 593153128c Update examples 2015-11-22 19:15:37 +01:00
Jannes Höke d91f210f7c refactor BotEventHandler to Updater, improve documentation, add idle() method 2015-11-22 19:15:17 +01:00
Jannes Höke 65177e791f raise error instead of quietly exiting on bad SSL cert 2015-11-22 16:46:17 +01:00
Jannes Höke 15501e185b renamed broadcaster.py to dispatcher.py 2015-11-22 14:52:41 +01:00
Jannes Höke 1782d0d19b refactor Broadcaster to Dispatcher 2015-11-22 14:47:38 +01:00
Jannes Höke 88fbf3b5cf remove broadcaster argument from __init__ 2015-11-22 14:27:05 +01:00
Jannes Höke c7a1d8dca3 test additional arguments 2015-11-22 14:08:33 +01:00
Jannes Höke 3e732a0736 fix multiple additional arguments 2015-11-22 14:07:20 +01:00
Jannes Höke 628e1b743a add bits of documentation 2015-11-22 13:58:40 +01:00
Jannes Höke e4de3f00b8 Add optional handler argument 'args' and documentation on handlers 2015-11-22 13:57:59 +01:00
Jannes Höke 32c021fdd5 Don't create new bot when broadcaster is passed 2015-11-22 13:30:23 +01:00
Jannes Höke a6e5a71e05 Check SSL-Certificate, if possible 2015-11-22 01:03:29 +01:00
Jannes Höke 4d87e236be Use random port for travis and py2&/py3 compability 2015-11-21 23:22:41 +01:00
Jannes Höke 29ab0556f0 test Webhook completed 2015-11-21 23:09:44 +01:00
Jannes Höke fca8aee177 improve logging 2015-11-21 23:09:19 +01:00
Jannes Höke 6a80a33aef test for error on getUpdates and began to test webhook 2015-11-21 21:22:58 +01:00
Jannes Höke 7c9928c58f Let shutdown return immediately if server is not running 2015-11-21 21:22:11 +01:00
Jannes Höke 0cd7aa92ae more logging 2015-11-21 21:21:09 +01:00
Jannes Höke 6626d4534e test @run_async 2015-11-21 19:35:24 +01:00
Jannes Höke 6b309397e8 send less messages in more time so travis can take its time 2015-11-21 16:18:19 +01:00
Jannes Höke 618df51811 flake8 2015-11-21 16:04:06 +01:00
Jannes Höke d38add1a1c really? 2015-11-21 15:50:39 +01:00
Jannes Höke 1c7e784662 add setWebhook to mock bot 2015-11-21 15:48:45 +01:00
Jannes Höke 0006294f29 update tests 2015-11-21 15:45:45 +01:00
Jannes Höke c1f194a310 change all start() to start_polling() 2015-11-21 15:31:23 +01:00
Jannes Höke cccd6e5baf Merge branch 'master' of github.com:leandrotoledo/python-telegram-bot into boteventhandler 2015-11-21 03:29:37 +01:00
Jannes Höke a0baa68cf3 Merge pull request #105 from rahiel/master
handle "Unauthorized" exceptions in echobot
2015-11-20 18:28:08 +01:00
Rahiel Kasim 62b79df0a4 handle "Unauthorized" exceptions in echobot 2015-11-20 14:41:12 +01:00
Jannes Höke 1246039872 Merge pull request #104 from mASOUDd/boteventhandler
remove trailing whitespaces
2015-11-17 16:05:41 +01:00
Masoud Naservand ed6dd76ae8 Corrected trailing whitespaces 2015-11-17 18:27:22 +03:30
Jannes Höke 70de2bd3f1 Merge pull request #102 from franciscod/patch-1
README: add link to TwitterForwarderBot
2015-11-17 09:08:38 +01:00
Francisco Demartino 8bde310ec7 README: add link to TwitterForwarderBot 2015-11-17 01:34:00 -03:00
Jannes Höke be368f7d74 add example for webhook 2015-11-17 00:30:21 +01:00
Jannes Höke 9defc41774 correct docstrings 2015-11-17 00:04:28 +01:00
Jannes Höke ee8b78aa0d pep8 and docs 2015-11-16 20:43:35 +01:00
Jannes Höke 0b8fd24771 fixed issues with python2 2015-11-16 20:35:27 +01:00
Jannes Höke 396dc6cd3c Implement webhook listener server 2015-11-16 13:05:57 +01:00
Jannes Höke ba3d174fde Change eh.start() to eh.start_polling() 2015-11-16 13:05:17 +01:00
Jannes Höke ab313488ad Usage instructions for bots 2015-11-15 20:13:03 +01:00
Jannes Höke d808462fb6 Simple bot 2015-11-15 20:02:09 +01:00
Jannes Höke 71e73c3999 logging 2015-11-15 19:21:35 +01:00
Jannes Höke a55df8b5e1 update example 2015-11-15 19:14:12 +01:00
Jannes Höke f59efe0f4b forward related update to errorhandlers 2015-11-15 19:12:42 +01:00
Jannes Höke 1b79a57673 Merge branch 'master' of github.com:leandrotoledo/python-telegram-bot into boteventhandler 2015-11-15 17:38:37 +01:00
Jannes Höke ae59a18e2d update example 2015-11-15 17:37:01 +01:00
Jannes Höke 12201f392d graceful stopping of threads, use logging, reuse of broadcaster 2015-11-15 17:36:38 +01:00
leandrotoledo 8f3fe123e3 Fix travis 2015-11-13 10:53:31 -02:00
Jannes Höke 04050ca883 Merge branch 'master' of github.com:leandrotoledo/python-telegram-bot into boteventhandler 2015-11-13 11:05:26 +01:00
Jannes Höke c3b3d51286 Merge pull request #99 from rahiel/readme
improve echobot with cleaner code and basic exception handling
2015-11-12 19:21:29 +01:00
Jannes Höke 10451509f1 fix for issue #79 2015-11-12 19:15:39 +01:00
Rahiel Kasim ff0d724f32 improve echobot with cleaner code and basic exception handling 2015-11-12 17:26:25 +01:00
Leandro Toledo c64e577049 Fixes pylint for Py2.6 2015-11-11 12:41:07 -02:00
Leandro Toledo f08dca0af6 Fixes pylint for Py2.6 2015-11-11 12:39:09 -02:00
Leandro Toledo 8c0bcbf5bb Fixes typo on .travis.yml 2015-11-11 12:28:34 -02:00
Leandro Toledo 596fc2aeda Adding OSX and lint/pep8 tests to Travis 2015-11-11 12:27:07 -02:00
Leandro Toledo 968b19e8b7 Rolling back travis settings 2015-11-11 12:07:43 -02:00
Leandro Toledo 7993328ff7 Enable travis for PRs 2015-11-11 12:04:23 -02:00
Leandro Toledo 16349ac69a Releasing v2.9.2 2015-11-11 11:31:20 -02:00
Jannes Höke 45712c52f1 Merge branch 'master' of github.com:leandrotoledo/python-telegram-bot into boteventhandler 2015-11-11 14:27:58 +01:00
Leandro Toledo 235dcd2ad2 Merge branch 'master' of https://github.com/leandrotoledo/python-telegram-bot 2015-11-11 11:25:05 -02:00
Leandro Toledo ed92d1c254 Adds requirements.txt to MANIFEST 2015-11-11 11:24:49 -02:00
Jannes Höke 0b4c23f50e improve error handling on timeouts 2015-11-11 14:06:10 +01:00
Jannes Höke 63c895c0a0 run_async moved to broadcaster and uses a thread pool now 2015-11-11 13:33:03 +01:00
Jannes Höke 3162bc60e9 cleaned up code 2015-11-11 13:32:11 +01:00
leandrotoledo 206802cf4d Minor fix on docs 2015-11-10 20:33:14 -02:00
leandrotoledo 5eb4f8e5cd Minor pep8 fix 2015-11-10 20:31:51 -02:00
Jannes Höke 0a27e3927b merge 2015-11-10 23:17:31 +01:00
Jannes Höke 401add78d3 fix big mistake 2015-11-10 23:15:37 +01:00
Jannes Höke af375eb402 improved code quality 2015-11-10 23:15:37 +01:00
Jannes Höke 2797111ced First tests for BotEventHandler and Broadcaster 2015-11-10 23:15:37 +01:00
Jannes Höke d7d4889c50 use run_async decorator in example 2015-11-10 23:15:37 +01:00
Jannes Höke bf356e124f add run_async decorator 2015-11-10 23:15:37 +01:00
Jannes Höke d7fd43ca79 Import BotEventHandler and Broadcaster 2015-11-10 23:15:37 +01:00
Jannes Höke 42e11d169e Update AUTHORS.rst 2015-11-10 23:15:37 +01:00
Jannes Höke c1fae0b5ee example bot for BotEventHandler 2015-11-10 23:15:37 +01:00
Jannes Höke ef99bab435 initial commit for BotEventHandler and Broadcaster 2015-11-10 23:15:37 +01:00
Jannes Höke 93afd3eabe remove check for network_delay 2015-11-10 23:12:20 +01:00
Jannes Höke 61dac76bee don't send network_delay to telegram servers 2015-11-10 22:40:19 +01:00
Jannes Höke 245f5abc45 further improved formatting 2015-11-10 21:32:54 +01:00
Jannes Höke 0f8f6584ce Fix for issue #81 2015-11-10 20:36:26 +01:00
Jannes Höke dd498ded00 Update to version 2.9.1 2015-11-10 20:22:58 +01:00
Jannes Höke 5d2999818b Update to version 2.9.1 2015-11-10 20:19:12 +01:00
Jannes Höke eb1f197ff4 2.9.1 release and generally improved formatting 2015-11-10 20:10:44 +01:00
Jannes Höke 4bc03ed56a Add parameter network_delay for slow connections and increase default to 2 seconds 2015-11-10 19:47:21 +01:00
Leandro Toledo 9191d333ca Adds future as requirement 2015-11-10 12:27:18 -02:00
Leandro Toledo c6533a2d69 Releasing v2.9 2015-11-10 12:21:04 -02:00
Leandro Toledo 6c13762c93 Fixes PEP8 and Lint minor issues 2015-11-10 12:10:50 -02:00
Leandro Toledo 06c09b96cf Fixes travis to support future module 2015-11-10 12:04:21 -02:00
Leandro Toledo 8a5ec3b2a1 Merge pull request #92 from jh0ker/emoticons
Decode Emoji byte strings into unicode strings if using Python 3 (Alternative)
2015-11-10 11:58:57 -02:00
Leandro Toledo 21c26aed2f Merge pull request #96 from leandrotoledo/revert-85-master
Revert 1879cff82d
2015-11-10 11:55:50 -02:00
Leandro Toledo 5fe1481ae9 Revert 1879cff82d 2015-11-10 11:55:42 -02:00
Leandro Toledo 1879cff82d Merge pull request #85 from jh0ker/master
Decode Emoji byte strings into unicode strings if using Python 3
2015-11-10 11:55:19 -02:00
Jannes Höke cd5e805692 added documentation 2015-11-10 05:16:16 +01:00
Jannes Höke 90a77ab7a1 Merge pull request #87 from franciscod/patch-1
Remove `.encode('utf-8')` from echobot
2015-11-10 04:58:21 +01:00
Jannes Höke 3928e27cf4 Merge pull request #90 from rahiel/master
raise exception if telegram times out on long-polling
2015-11-10 04:56:18 +01:00
Leandro Toledo 45b1124553 Merge pull request #95 from rahiel/readme
fix LGPLv3 badge
2015-11-09 16:53:47 -02:00
Rahiel Kasim 252b43dcb7 fix LGPLv3 badge 2015-11-09 19:06:30 +01:00
Jannes Höke c19a84ac05 improved code quality 2015-11-06 00:24:01 +01:00
Jannes Höke 404fdc2dd7 First tests for BotEventHandler and Broadcaster 2015-11-06 00:23:34 +01:00
Jannes Höke 2ec56abe7e use run_async decorator in example 2015-11-05 16:01:25 +01:00
Jannes Höke 63a8700258 add run_async decorator 2015-11-05 16:01:08 +01:00
Jannes Höke d363185031 Import BotEventHandler and Broadcaster 2015-11-05 15:22:13 +01:00
Jannes Höke aabaaa9049 Update AUTHORS.rst 2015-11-05 14:07:28 +01:00
Jannes Höke eb2be61eac example bot for BotEventHandler 2015-11-05 13:52:57 +01:00
Jannes Höke 0688691974 initial commit for BotEventHandler and Broadcaster 2015-11-05 13:52:33 +01:00
Leandro Toledo d3d5c1e907 Merge pull request #91 from jh0ker/useroptional
Make user_from optional to work with channels channels
2015-11-04 09:52:00 -02:00
Jannes Höke cbf66d411d add jh0ker to AUTHORS.rst 2015-11-03 14:47:26 +01:00
Jannes Höke 0e5b48f3b4 Add tests for Emoji class, since it now contains actual code 2015-11-03 14:47:13 +01:00
Jannes Höke df7cfdc8d0 create file requirements.txt and add 'future' 2015-11-03 14:42:16 +01:00
Jannes Höke 89015e5ecc fix for sending into a channel 2015-11-03 13:46:23 +01:00
Jannes Höke 025d4c9a75 fix emojis for python3 2015-11-03 12:24:44 +01:00
Jannes Höke d3bea4c3b4 make user_from optional, because of channels 2015-11-03 10:28:06 +01:00
Jannes Höke a6c12adda2 make user_from optional, because of channels 2015-11-03 10:20:45 +01:00
Rahiel Kasim dcb9129809 raise exception if telegram times out on long-polling 2015-11-02 20:30:37 +01:00
Francisco Demartino bd1f171f51 Remove .encode('utf-8') from echobot
This was making the bot throw TypeError on py3.

Closes #86
2015-10-23 16:48:26 -03:00
Jannes Höke 54efb034a4 add jh0ker to AUTHORS.rst 2015-10-23 01:18:05 +02:00
Jannes Höke fe94f146bb Add tests for Emoji class, since it now contains actual code 2015-10-23 01:16:10 +02:00
Jannes Höke 22b492762b Decode Emoji byte strings into unicode strings if using Python 3 (missed something) 2015-10-23 00:32:10 +02:00
Jannes Höke fea0c5cc2b Decode Emoji byte strings into unicode strings if using Python 3 2015-10-23 00:29:26 +02:00
Leandro Toledo 688d6af541 Releasing v2.8.7 2015-10-08 11:31:48 -03:00
Leandro Toledo bcbd32cdd3 Merge branch 'master' of https://github.com/leandrotoledo/python-telegram-bot 2015-10-08 11:30:16 -03:00
Leandro Toledo 3fa8b97ed2 Type as optional for GroupChat 2015-10-08 11:30:02 -03:00
Leandro Toledo 7cd4e2e205 Update README.rst 2015-10-08 10:40:27 -03:00
Leandro Toledo f2b0cb46a2 Releasing v2.8.6 2015-10-08 10:23:12 -03:00
Leandro Toledo cf5d184766 Add type to User and GroupChat classes 2015-10-08 10:19:05 -03:00
Leandro Toledo 5738dc553f Releasing v2.8.5 2015-09-24 09:29:23 -03:00
Leandro Toledo 386accab80 Merge pull request #74 from leandrotoledo/http_bad_gateway_as_except
Handles HTTP Bad Gateway error (503) on request module #63
2015-09-24 09:26:19 -03:00
Leandro Toledo e7686db759 Merge pull request #73 from leandrotoledo/stop_casting_unicode_fields
Fixes regression on Audio and Document models for unicode fields #65
2015-09-24 09:26:10 -03:00
Leandro Toledo 6c9490f2c6 Handles HTTP Bad Gateway error (503) on request module #63 2015-09-24 09:17:50 -03:00
Leandro Toledo 855ab19dea Fixes regression on Audio and Document models for unicode fields #65 2015-09-24 09:10:33 -03:00
Leandro Toledo 797a3e6ea4 Update README.rst 2015-09-22 09:41:31 -03:00
Leandro Toledo bbd443d397 Merge pull request #71 from zeehio/patch-1
[doc] fix "Telegram sticker" -> "Telegram user"
2015-09-22 09:39:19 -03:00
Sergio Oller 4e1597c614 [doc] fix "Telegram user" -> "telegram sticker" 2015-09-22 11:52:10 +02:00
Leandro Toledo 75e338d5df Releasing v2.8.4 2015-09-20 12:52:40 -03:00
Leandro Toledo 1919f873c0 Fix tests 2015-09-20 12:47:02 -03:00
Leandro Toledo a1f35355f6 Keep bleeding edge features on testing branch 2015-09-20 12:43:32 -03:00
Leandro Toledo c4c17e8036 Merge branch 'testing' 2015-09-20 12:34:34 -03:00
Leandro Toledo 3024c1ce3d Merge branch 'master' into testing 2015-09-20 12:34:02 -03:00
Leandro Toledo b79530b10c Adding File and its tests 2015-09-20 12:28:10 -03:00
Leandro Toledo 778c63a6d3 Merge pull request #68 from leandrotoledo/revert-67-feature/requests
Revert "Feature/requests"
2015-09-16 00:22:03 -03:00
Leandro Toledo f623db06ea Revert "Feature/requests" 2015-09-16 00:21:45 -03:00
Leandro Toledo 026673dc05 Merge pull request #67 from peczony/feature/requests
Feature/requests
2015-09-16 00:17:38 -03:00
Leandro Toledo 6893da5dd3 Update keywords for pip package 2015-09-16 00:15:51 -03:00
pecheny d5a9c185f0 use requests instead of urllib if possible; add timeout and decorator to get and post 2015-09-14 19:13:22 +03:00
Leandro Toledo cbdeacd22d Releasing v2.8.3 2015-09-10 21:00:05 -03:00
Leandro Toledo 1e2fdedc45 Removing command_handler from master (under dev) 2015-09-10 20:44:23 -03:00
Leandro Toledo c1c0e66233 Merge branch 'testing' 2015-09-10 20:37:41 -03:00
Leandro Toledo eb557e0eba Keeping features under development off this release 2015-09-10 20:37:25 -03:00
Leandro Toledo a7ac4193fe PEP8, lint and TelegramError class refactor 2015-09-10 20:08:24 -03:00
Leandro Toledo 354bfcad79 legacy tests now run using BaseTest 2015-09-10 20:06:27 -03:00
Leandro Toledo a1e12d424c Fix inverted lat/long 2015-09-10 16:59:08 -03:00
Leandro Toledo 38c6d002c8 Merge pull request #60 from ergoz/ISSUE-58
Add Markdown support for sendMessage method.[#58]
2015-09-10 15:25:01 -03:00
ErgoZ c8a14bf34d Merge branch 'testing' of https://github.com/leandrotoledo/python-telegram-bot into ISSUE-58
Conflicts:
	telegram/__init__.py
2015-09-10 20:42:56 +03:00
ErgoZ 53c44f14bd Add Markdown support for sendMessage method. 2015-09-10 20:15:20 +03:00
Leandro Toledo e75deea25c Merge pull request #59 from ergoz/PR57-Fix
Code cleanup for filename. Filename uses only for sendDocument.
2015-09-10 08:56:11 -03:00
ErgoZ 17b8bb4881 Code cleanup for filename. Filename uses only for sendDocument. 2015-09-10 14:46:49 +03:00
leandrotoledo 009862593b Fix Py3 2015-09-09 09:34:45 -03:00
leandrotoledo e2fa052f54 Send JSON requests over urlencoded post data 2015-09-09 09:29:23 -03:00
leandrotoledo dcfe08dbda Add sticker as an inputfile 2015-09-09 09:28:58 -03:00
leandrotoledo dc2dfa24ad Adding .sublime 2015-09-09 09:12:59 -03:00
leandrotoledo ce58f45c4f Adding .sublime 2015-09-09 09:12:35 -03:00
Leandro Toledo 7059930b5d Merge pull request #55 from njittam/testing
add a father command. and hide commands in help.
2015-09-09 09:08:39 -03:00
leandrotoledo 77977b99b1 Add tests to custom filename arg #56 2015-09-08 15:52:10 -03:00
Leandro Toledo ed77afaab9 Merge pull request #57 from ergoz/testing
Add ability for custom filename in send methods and InputFile
2015-09-08 15:22:58 -03:00
ErgoZ Riftbit Vaper c7f2add463 small pretty fix for self.data.pop('filename') 2015-09-08 21:17:54 +03:00
ErgoZ Riftbit Vaper 8a074fd719 Delete unused check (forget from previous local version) 2015-09-08 21:13:11 +03:00
leandrotoledo cfa5e8a6fe Using nose to run tests 2015-09-08 15:03:04 -03:00
leandrotoledo c6bf13e407 Using nose to test on travis 2015-09-08 15:02:28 -03:00
ErgoZ Riftbit Vaper 6237bb636c Fix InputFile class for python 3+ support 2015-09-08 20:54:50 +03:00
ErgoZ Riftbit Vaper 0496781501 Update AUTHORS.rst 2015-09-08 20:45:44 +03:00
ErgoZ 4a761d0611 Add ability to set custom filename (fix InputFile class)
For commands that uses InputFile class
2015-09-08 20:43:28 +03:00
ErgoZ 714adc13ee Add ability to set custom filename
For commands that uses InputFile class
2015-09-08 20:42:23 +03:00
leandrotoledo fa387d1821 Ignore coveralls token settings 2015-09-07 20:11:46 -03:00
leandrotoledo 073d43fd75 Improve tests for GroupChat and User 2015-09-07 20:11:02 -03:00
leandrotoledo 5c0eeac036 Fix coveralls 2015-09-07 20:06:34 -03:00
leandrotoledo 64ca4d7b82 Fix travis, this time for real 2015-09-07 16:53:01 -03:00
leandrotoledo 6d7542ce50 Fix travis 2015-09-07 16:33:00 -03:00
leandrotoledo 0cfaaa590c Fix travis 2015-09-07 16:29:39 -03:00
leandrotoledo 48bb8a2413 Fix travis 2015-09-07 16:28:00 -03:00
leandrotoledo 36dc1633f5 Move old tests to legacy dir until get new ones written 2015-09-07 15:54:50 -03:00
leandrotoledo e1edeb7bec Improve design of this class 2015-09-07 15:54:12 -03:00
leandrotoledo a409fc511d Improve raise of empty chat_id 2015-09-07 15:53:43 -03:00
leandrotoledo 69d705a99f strize raw String properties for Telegram Objects 2015-09-07 15:53:09 -03:00
leandrotoledo cdcf2481ba Update Makefile to support multiple tests 2015-09-07 15:47:50 -03:00
leandrotoledo 5c4f0f152a Much better, such wow Location tests 2015-09-07 14:31:08 -03:00
leandrotoledo f29a6f0e36 Update Document tests class 2015-09-07 14:17:41 -03:00
leandrotoledo 1b0c3731de Update Base tests class 2015-09-07 14:12:58 -03:00
leandrotoledo 4be946d116 Much better, such wow GroupChat tests 2015-09-07 14:10:57 -03:00
leandrotoledo 73e36e3b73 Much better, such wow User tests 2015-09-07 14:03:20 -03:00
leandrotoledo 6141e76693 Much better, such wow Update tests 2015-09-07 13:55:28 -03:00
leandrotoledo 61ef876532 Much better, such wow Contact tests 2015-09-07 13:42:51 -03:00
leandrotoledo 060442e0ae Much better, such wow Sticker tests 2015-09-07 12:10:29 -03:00
leandrotoledo 2254440671 Much better, such wow Document tests 2015-09-07 11:55:55 -03:00
leandrotoledo 65a224884f Much better, such wow Audio/Voice/Video tests 2015-09-07 11:22:25 -03:00
leandrotoledo 0218aa2f4e Much better, such wow Voice tests 2015-09-07 09:56:51 -03:00
leandrotoledo 28e81ee9f6 Much better, such wow Audio tests 2015-09-07 09:56:41 -03:00
mattijn 6ffcdcf2fe removed unused imports 2015-09-07 05:13:08 +02:00
mattijn 89bab207b6 pep8 2015-09-07 05:11:08 +02:00
mattijn 69aa1c252b added an easier way to get frequent commands from message. 2015-09-07 04:55:00 +02:00
mattijn 5b8f41b3c1 pep 8 command_handler.py 2015-09-07 04:17:43 +02:00
mattijn ea5c690e7a add a help for extra commands. 2015-09-07 03:38:07 +02:00
mattijn 9145f24efa added a father command. and some other a way to hide commands in the help. 2015-09-07 03:13:40 +02:00
leandrotoledo c590d9c2fd Moving _requestURL method to utils package 2015-09-05 11:56:06 -03:00
leandrotoledo cfd401f22b Moving _requestURL method to utils package 2015-09-05 11:55:55 -03:00
leandrotoledo 7f790c3cb2 Releasing v2.8.2 2015-09-04 23:23:41 -03:00
leandrotoledo 30749c3b66 Merging testing 2015-09-04 23:21:31 -03:00
leandrotoledo 8f0447156b Merge branch 'testing' 2015-09-04 23:20:31 -03:00
leandrotoledo df000f8086 Fix regression on ReplyMarkup and add certificate to is_inputfile method 2015-09-04 23:20:14 -03:00
Leandro Toledo 3d835527e0 Update README.rst 2015-09-04 23:07:03 -03:00
Leandro Toledo 323052a6c9 Update README.rst 2015-09-04 23:05:14 -03:00
Leandro Toledo ef4871cce1 Update README.rst 2015-09-04 19:14:54 -03:00
leandrotoledo f355af1d2b Restoring new features after rebase 2015-09-04 19:11:31 -03:00
leandrotoledo 121e365348 Oops, restoring file on testing 2015-09-04 19:07:20 -03:00
leandrotoledo 82f1d18f4b Releasing v2.8.1 2015-09-04 19:00:54 -03:00
leandrotoledo 79cdb6cafe Adding test to check if thumbs are PhotoSize instances 2015-09-04 18:58:48 -03:00
leandrotoledo 49ff02dcf4 Fix regression on Telegram objects with thumb properties 2015-09-04 18:50:26 -03:00
leandrotoledo be23ff5d29 Fix codeclimate 2015-09-04 18:35:35 -03:00
leandrotoledo 72a7355c2f Fix codeclimate 2015-09-04 18:33:51 -03:00
leandrotoledo 64cf9ed941 Fix codeclimate 2015-09-04 18:29:37 -03:00
leandrotoledo bb84113272 Releasing 2.8 2015-09-04 18:19:05 -03:00
266 changed files with 21635 additions and 2380 deletions
+5
View File
@@ -0,0 +1,5 @@
languages:
Python: true
exclude_paths:
- "telegram/emoji.py"
- "tests/*"
+8
View File
@@ -0,0 +1,8 @@
[run]
source = telegram
omit = telegram/vendor/*
[report]
omit =
tests/
telegram/vendor/*
+207
View File
@@ -0,0 +1,207 @@
How To Contribute
===================
Every open source project lives from the generous help by contributors that sacrifice their time and ``python-telegram-bot`` is no different. To make participation as pleasant as possible, this project adheres to the `Code of Conduct`_ by the Python Software Foundation.
Setting things up
-------------------
1. Fork the ``python-telegram-bot`` repository to your GitHub account.
2. Clone your forked repository of ``python-telegram-bot`` to your computer:
.. code-block:: bash
$ git clone https://github.com/<your username>/python-telegram-bot
$ cd python-telegram-bot
3. Add a track to the original repository:
.. code-block:: bash
$ git remote add upstream https://github.com/python-telegram-bot/python-telegram-bot
4. Install dependencies:
.. code-block:: bash
$ sudo pip install -r requirements.txt -r requirements-dev.txt
5. Install pre-commit hooks:
.. code-block:: bash
$ pre-commit install
Finding something to do
###################
If you already know what you'd like to work on, you can skip this section.
If you have an idea for something to do, first check if it's already been filed on the `issue tracker`_. If so, add a comment to the issue saying you'd like to work on it, and we'll help you get started! Otherwise, please file a new issue and assign yourself to it.
Another great way to start contributing is by writing tests. Tests are really important because they help prevent developers from accidentally breaking existing code, allowing them to build cool things faster. If you're interested in helping out, let the development team know by posting to the `developers' mailing list`_, and we'll help you get started.
Instructions for making a code change
####################
The central development branch is ``master``, which should be clean and ready for release at any time. In general, all changes should be done as feature branches based off of ``master``.
Here's how to make a one-off code change.
1. **Choose a descriptive branch name.** It should be lowercase, hyphen-separated, and a noun describing the change (so, ``fuzzy-rules``, but not ``implement-fuzzy-rules``). Also, it shouldn't start with ``hotfix`` or ``release``.
2. **Create a new branch with this name, starting from** ``master``. In other words, run:
.. code-block:: bash
$ git fetch upstream
$ git checkout master
$ git merge upstream/master
$ git checkout -b your-branch-name
3. **Make a commit to your feature branch**. Each commit should be self-contained and have a descriptive commit message that helps other developers understand why the changes were made.
- You can refer to relevant issues in the commit message by writing, e.g., "#105".
- Your code should adhere to the `PEP 8 Style Guide`_, with the exception that we have a maximum line length of 99.
- For consistency, please conform to `Google Python Style Guide`_ and `Google Python Style Docstrings`_. In addition, code should be formatted consistently with other code around it.
- The following exceptions to the above (Google's) style guides applies:
- Documenting types of global variables and complex types of class members can be done using the Sphinx docstring convention.
- Please ensure that the code you write is well-tested.
- Dont break backward compatibility.
- Add yourself to the AUTHORS.rst_ file in an alphabetical fashion.
- Before making a commit ensure that all automated tests still pass:
.. code-block::
$ make test
If you don't have ``make``, do:
.. code-block::
$ nosetests -v
- To actually make the commit (this will trigger tests for yapf, lint and pep8 automatically):
.. code-block:: bash
$ git add your-file-changed.py
- yapf may change code formatting, make sure to re-add them to your commit.
.. code-block:: bash
$ git commit -a -m "your-commit-message-here"
- Finally, push it to your GitHub fork, run:
.. code-block:: bash
$ git push origin your-branch-name
4. **When your feature is ready to merge, create a pull request.**
- Go to your fork on GitHub, select your branch from the dropdown menu, and click "New pull request".
- Add a descriptive comment explaining the purpose of the branch (e.g. "Add the new API feature to create inline bot queries."). This will tell the reviewer what the purpose of the branch is.
- Click "Create pull request". An admin will assign a reviewer to your commit.
5. **Address review comments until all reviewers give LGTM ('looks good to me').**
- When your reviewer has reviewed the code, you'll get an email. You'll need to respond in two ways:
- Make a new commit addressing the comments you agree with, and push it to the same branch. Ideally, the commit message would explain what the commit does (e.g. "Fix lint error"), but if there are lots of disparate review comments, it's fine to refer to the original commit message and add something like "(address review comments)".
- In addition, please reply to each comment. Each reply should be either "Done" or a response explaining why the corresponding suggestion wasn't implemented. All comments must be resolved before LGTM can be given.
- Resolve any merge conflicts that arise. To resolve conflicts between 'your-branch-name' (in your fork) and 'master' (in the ``python-telegram-bot`` repository), run:
.. code-block:: bash
$ git checkout your-branch-name
$ git fetch upstream
$ git merge upstream/master
$ ...[fix the conflicts]...
$ ...[make sure the tests pass before committing]...
$ git commit -a
$ git push origin your-branch-name
- At the end, the reviewer will merge the pull request.
6. **Tidy up!** Delete the feature branch from both your local clone and the GitHub repository:
.. code-block:: bash
$ git branch -D your-branch-name
$ git push origin --delete your-branch-name
7. **Celebrate.** Congratulations, you have contributed to ``python-telegram-bot``!
Style commandments
---------------------
Specific commandments
#####################
- Avoid using "double quotes" where you can reasonably use 'single quotes'.
AssertEqual argument order
######################
- assertEqual method's arguments should be in ('actual', 'expected') order.
Properly calling callables
#######################
Methods, functions and classes can specify optional parameters (with default
values) using Python's keyword arg syntax. When providing a value to such a
callable we prefer that the call also uses keyword arg syntax. For example:
.. code-block:: python
# GOOD
f(0, optional=True)
# BAD
f(0, True)
This gives us the flexibility to re-order arguments and more importantly
to add new required arguments. It's also more explicit and easier to read.
Properly defining optional arguments
########################
It's always good to not initialize optional arguments at class creation,
instead use ``**kwargs`` to get them. It's well known Telegram API can
change without notice, in that case if a new argument is added it won't
break the API classes. For example:
.. code-block:: python
# GOOD
def __init__(self, id, name, last_name=None, **kwargs):
self.last_name = last_name
# BAD
def __init__(self, id, name, last_name=None):
self.last_name = last_name
.. _`Code of Conduct`: https://www.python.org/psf/codeofconduct/
.. _`issue tracker`: https://github.com/python-telegram-bot/python-telegram-bot/issues
.. _`developers' mailing list`: mailto:devs@python-telegram-bot.org
.. _`PEP 8 Style Guide`: https://www.python.org/dev/peps/pep-0008/
.. _`Google Python Style Guide`: https://google-styleguide.googlecode.com/svn/trunk/pyguide.html
.. _`Google Python Style Docstrings`: http://sphinx-doc.org/latest/ext/example_google.html
.. _AUTHORS.rst: ../AUTHORS.rst
+31
View File
@@ -0,0 +1,31 @@
<!--
Thanks for reporting issues of python-telegram-bot!
To make it easier for us to help you please enter detailed information below.
Please note, we only support the latest version of python-telegram-bot and
master branch. Please make sure to upgrade & recreate the issue on the latest
version prior to opening an issue.
-->
### Steps to reproduce
1.
2.
3.
### Expected behaviour
Tell us what should happen
### Actual behaviour
Tell us what happens instead
### Configuration
**Operating System:**
**Version of Python, python-telegram-bot & dependencies:**
``$ python -m telegram``
### Logs
Insert logs here (if necessary)
+17
View File
@@ -43,6 +43,7 @@ htmlcov/
nosetests.xml
coverage.xml
*,cover
.coveralls.yml
# Translations
*.mo
@@ -57,3 +58,19 @@ docs/_build/
# PyBuilder
target/
.idea/
# Sublime Text 2
*.sublime*
# unitests files
telegram.mp3
telegram.mp4
telegram.ogg
telegram.png
telegram.webp
# original files from merges
*.orig
# Exclude .exrc file for Vim
.exrc
+4
View File
@@ -0,0 +1,4 @@
[submodule "telegram/vendor/urllib3"]
path = telegram/vendor/urllib3
url = https://github.com/python-telegram-bot/urllib3.git
branch = ptb
+18
View File
@@ -0,0 +1,18 @@
- repo: git://github.com/python-telegram-bot/mirrors-yapf
sha: v0.12.2
hooks:
- id: yapf
files: ^(telegram|tests)/.*\.py$
- repo: git://github.com/pre-commit/pre-commit-hooks
sha: 18d7035de5388cc7775be57f529c154bf541aab9
hooks:
- id: flake8
files: ^telegram/.*\.py$
- repo: git://github.com/pre-commit/mirrors-pylint
sha: v1.5.5
hooks:
- id: pylint
files: ^telegram/.*\.py$
args:
- --errors-only
- --disable=no-name-in-module,import-error
+10 -2
View File
@@ -1,14 +1,22 @@
language: python
python:
- "2.6"
- "2.7"
- "3.3"
- "3.4"
- "3.5"
- "3.6"
- "pypy"
- "pypy3"
branches:
only:
- master
install:
- pip install coveralls
- pip install -r requirements.txt
- pip install -r requirements-dev.txt
- if [[ $TRAVIS_PYTHON_VERSION != 'pypy'* ]]; then pip install ujson; fi
script:
coverage run tests/test_*.py
- nosetests -v --with-flaky --no-flaky-report --with-coverage --cover-package=telegram/ tests
- if [[ $TRAVIS_PYTHON_VERSION == 3.5 ]]; then pre-commit run --all-files; fi
after_success:
coveralls
+37 -1
View File
@@ -1,7 +1,14 @@
Credits
=======
``python-telegram-bot`` is written and maintained by `Leandro Toledo <https://github.com/leandrotoledo>`_.
``python-telegram-bot`` was originally created by
`Leandro Toledo <https://github.com/leandrotoledo>`_ and is now maintained by
`Jannes Höke <https://github.com/jh0ker>`_ (`@jh0ker <https://t.me/jh0ker>`_ on Telegram) and
`Noam Meltzer <https://github.com/tsnoam>`_.
We're vendoring urllib3 as part of ``python-telegram-bot`` which is distributed under the MIT
license. For more info, full credits & license terms, the sources can be found here:
`https://github.com/python-telegram-bot/urllib3`.
Contributors
------------
@@ -9,14 +16,43 @@ Contributors
The following wonderful people contributed directly or indirectly to this project:
- `Avanatiker <https://github.com/Avanatiker>`_
- `Anton Tagunov <https://github.com/anton-tagunov>`_
- `Balduro <https://github.com/Balduro>`_
- `bimmlerd <https://github.com/bimmlerd>`_
- `d-qoi <https://github.com/d-qoi>`_
- `daimajia <https://github.com/daimajia>`_
- `Eli Gao <https://github.com/eligao>`_
- `ErgoZ Riftbit Vaper <https://github.com/ergoz>`_
- `Eugene Lisitsky <https://github.com/lisitsky>`_
- `evgfilim1 <https://github.com/evgfilim1>`_
- `franciscod <https://github.com/franciscod>`_
- `Hugo Damer <https://github.com/HakimusGIT>`_
- `Jacob Bom <https://github.com/bomjacob>`_
- `JASON0916 <https://github.com/JASON0916>`_
- `jh0ker <https://github.com/jh0ker>`_
- `John Yong <https://github.com/whipermr5>`_
- `jossalgon <https://github.com/jossalgon>`_
- `JRoot3D <https://github.com/JRoot3D>`_
- `jlmadurga <https://github.com/jlmadurga>`_
- `Kjwon15 <https://github.com/kjwon15>`_
- `Li-aung Yip <https://github.com/LiaungYip>`_
- `macrojames <https://github.com/macrojames>`_
- `Michael Elovskikh <https://github.com/wronglink>`_
- `naveenvhegde <https://github.com/naveenvhegde>`_
- `neurrone <https://github.com/neurrone>`_
- `njittam <https://github.com/njittam>`_
- `Noam Meltzer <https://github.com/tsnoam>`_
- `Oleg Shlyazhko <https://github.com/ollmer>`_
- `overquota <https://github.com/overquota>`_
- `Patrick Hofmann <https://github.com/PH89>`_
- `Pieter Schutz <https://github.com/eldinnie>`_
- `Rahiel Kasim <https://github.com/rahiel>`_
- `Joscha Götzer <https://github.com/Rostgnom>`_
- `Shelomentsev D <https://github.com/shelomentsevd>`_
- `sooyhwang <https://github.com/sooyhwang>`_
- `thodnev <https://github.com/thodnev>`_
- `Valentijn <https://github.com/Faalentijn>`_
- `voider1 <https://github.com/voider1>`_
- `wjt <https://github.com/wjt>`_
Please add yourself here alphabetically when you submit your first pull request.
+452 -83
View File
@@ -1,138 +1,507 @@
2015-08-19
Released 2.7.1
Fixed JSON serialization for message
=======
Changes
=======
**2017-05-19**
*Released 6.0.0*
- Add support for Bot API 2.3.1
- Add support for ``deleteMessage`` API method
- New, simpler API for ``JobQueue`` - https://github.com/python-telegram-bot/python-telegram-bot/pull/484
- Download files into file-like objects - https://github.com/python-telegram-bot/python-telegram-bot/pull/459
- Use vendor ``urllib3`` to address issues with timeouts
- The default timeout for messages is now 5 seconds. For sending media, the default timeout is now 20 seconds.
- String attributes that are not set are now ``None`` by default, instead of empty strings
- Add ``text_markdown`` and ``text_html`` properties to ``Message`` - https://github.com/python-telegram-bot/python-telegram-bot/pull/507
- Add support for Socks5 proxy - https://github.com/python-telegram-bot/python-telegram-bot/pull/518
- Add support for filters in ``CommandHandler`` - https://github.com/python-telegram-bot/python-telegram-bot/pull/536
- Add the ability to invert (not) filters - https://github.com/python-telegram-bot/python-telegram-bot/pull/552
- Add ``Filters.group`` and ``Filters.private``
- Compatibility with GAE via ``urllib3.contrib`` package - https://github.com/python-telegram-bot/python-telegram-bot/pull/583
- Add equality rich comparision operators to telegram objects - https://github.com/python-telegram-bot/python-telegram-bot/pull/604
- Several bugfixes and other improvements
- Remove some deprecated code
**2017-04-17**
*Released 5.3.1*
- Hotfix release due to bug introduced by urllib3 version 1.21
**2016-12-11**
*Released 5.3*
- Implement API changes of November 21st (Bot API 2.3)
- ``JobQueue`` now supports ``datetime.timedelta`` in addition to seconds
- ``JobQueue`` now supports running jobs only on certain days
- New ``Filters.reply`` filter
- Bugfix for ``Message.edit_reply_markup``
- Other bugfixes
**2016-10-25**
*Released 5.2*
- Implement API changes of October 3rd (games update)
- Add ``Message.edit_*`` methods
- Filters for the ``MessageHandler`` can now be combined using bitwise operators (``& and |``)
- Add a way to save user- and chat-related data temporarily
- Other bugfixes and improvements
**2016-09-24**
*Released 5.1*
- Drop Python 2.6 support
- Deprecate ``telegram.Emoji``
- Use ``ujson`` if available
- Add instance methods to ``Message``, ``Chat``, ``User``, ``InlineQuery`` and ``CallbackQuery``
- RegEx filtering for ``CallbackQueryHandler`` and ``InlineQueryHandler``
- New ``MessageHandler`` filters: ``forwarded`` and ``entity``
- Add ``Message.get_entity`` to correctly handle UTF-16 codepoints and ``MessageEntity`` offsets
- Fix bug in ``ConversationHandler`` when first handler ends the conversation
- Allow multiple ``Dispatcher`` instances
- Add ``ChatMigrated`` Exception
- Properly split and handle arguments in ``CommandHandler``
**2016-07-15**
*Released 5.0*
- Rework ``JobQueue``
- Introduce ``ConversationHandler``
**2016-07-12**
*Released 4.3.4*
- Fix proxy support with ``urllib3`` when proxy requires auth
**2016-07-08**
*Released 4.3.3*
- Fix proxy support with ``urllib3``
**2016-07-04**
*Released 4.3.2*
- Fix: Use ``timeout`` parameter in all API methods
**2016-06-29**
*Released 4.3.1*
- Update wrong requirement: ``urllib3>=1.10``
**2016-06-28**
*Released 4.3*
- Use ``urllib3.PoolManager`` for connection re-use
- Rewrite ``run_async`` decorator to re-use threads
- New requirements: ``urllib3`` and ``certifi``
**2016-06-10**
*Released 4.2.1*
- Fix ``CallbackQuery.to_dict()`` bug (thanks to @jlmadurga)
- Fix ``editMessageText`` exception when receiving a ``CallbackQuery``
**2016-05-28**
*Released 4.2*
- Implement Bot API 2.1
- Move ``botan`` module to ``telegram.contrib``
- New exception type: ``BadRequest``
**2016-05-22**
*Released 4.1.2*
- Fix ``MessageEntity`` decoding with Bot API 2.1 changes
**2016-05-16**
*Released 4.1.1*
- Fix deprecation warning in ``Dispatcher``
**2016-05-15**
*Released 4.1*
- Implement API changes from May 6, 2016
- Fix bug when ``start_polling`` with ``clean=True``
- Methods now have snake_case equivalent, for example ``telegram.Bot.send_message`` is the same as ``telegram.Bot.sendMessage``
**2016-05-01**
*Released 4.0.3*
- Add missing attribute ``location`` to ``InlineQuery``
**2016-04-29**
*Released 4.0.2*
- Bugfixes
- ``KeyboardReplyMarkup`` now accepts ``str`` again
**2016-04-27**
*Released 4.0.1*
- Implement Bot API 2.0
- Almost complete recode of ``Dispatcher``
- Please read the `Transition Guide to 4.0 <https://github.com/python-telegram-bot/python-telegram-bot/wiki/Transition-guide-to-Version-4.0>`_
- **Changes from 4.0rc1**
- The syntax of filters for ``MessageHandler`` (upper/lower cases)
- Handler groups are now identified by ``int`` only, and ordered
- **Note:** v4.0 has been skipped due to a PyPI accident
**2016-04-22**
*Released 4.0rc1*
- Implement Bot API 2.0
- Almost complete recode of ``Dispatcher``
- Please read the `Transistion Guide to 4.0 <https://github.com/python-telegram-bot/python-telegram-bot/wiki/Transistion-guide-to-Version-4.0>`_
**2016-03-22**
*Released 3.4*
- Move ``Updater``, ``Dispatcher`` and ``JobQueue`` to new ``telegram.ext`` submodule (thanks to @rahiel)
- Add ``disable_notification`` parameter (thanks to @aidarbiktimirov)
- Fix bug where commands sent by Telegram Web would not be recognized (thanks to @shelomentsevd)
- Add option to skip old updates on bot startup
- Send files from ``BufferedReader``
**2016-02-28**
*Released 3.3*
- Inline bots
- Send any file by URL
- Specialized exceptions: ``Unauthorized``, ``InvalidToken``, ``NetworkError`` and ``TimedOut``
- Integration for botan.io (thanks to @ollmer)
- HTML Parsemode (thanks to @jlmadurga)
- Bugfixes and under-the-hood improvements
**Very special thanks to Noam Meltzer (@tsnoam) for all of his work!**
**2016-01-09**
*Released 3.3b1*
- Implement inline bots (beta)
**2016-01-05**
*Released 3.2.0*
- Introducing ``JobQueue`` (original author: @franciscod)
- Streamlining all exceptions to ``TelegramError`` (Special thanks to @tsnoam)
- Proper locking of ``Updater`` and ``Dispatcher`` ``start`` and ``stop`` methods
- Small bugfixes
**2015-12-29**
*Released 3.1.2*
- Fix custom path for file downloads
- Don't stop the dispatcher thread on uncaught errors in handlers
**2015-12-21**
*Released 3.1.1*
- Fix a bug where asynchronous handlers could not have additional arguments
- Add ``groups`` and ``groupdict`` as additional arguments for regex-based handlers
**2015-12-16**
*Released 3.1.0*
- The ``chat``-field in ``Message`` is now of type ``Chat``. (API update Oct 8 2015)
- ``Message`` now contains the optional fields ``supergroup_chat_created``, ``migrate_to_chat_id``, ``migrate_from_chat_id`` and ``channel_chat_created``. (API update Nov 2015)
**2015-12-08**
*Released 3.0.0*
- Introducing the ``Updater`` and ``Dispatcher`` classes
**2015-11-11**
*Released 2.9.2*
- Error handling on request timeouts has been improved
**2015-11-10**
*Released 2.9.1*
- Add parameter ``network_delay`` to Bot.getUpdates for slow connections
**2015-11-10**
*Released 2.9*
- Emoji class now uses ``bytes_to_native_str`` from ``future`` 3rd party lib
- Make ``user_from`` optional to work with channels
- Raise exception if Telegram times out on long-polling
*Special thanks to @jh0ker for all hard work*
2015-08-17
Released 2.7
Added support for Voice object and sendVoice method
Due backward compatibility performer or/and title will be required for sendAudio
Fixed JSON serialization when forwarded message
**2015-10-08**
*Released 2.8.7*
- Type as optional for ``GroupChat`` class
2015-08-15
Released 2.6.1
Fixed parsing image header issue on < Python 2.7.3
**2015-10-08**
*Released 2.8.6*
- Adds type to ``User`` and ``GroupChat`` classes (pre-release Telegram feature)
2015-08-14
Released 2.6.0
Depreciation of require_authentication and clearCredentials methods
Giving AUTHORS the proper credits for their contribution for this project
Message.date and Message.forward_date are now datetime objects
**2015-09-24**
*Released 2.8.5*
- Handles HTTP Bad Gateway (503) errors on request
- Fixes regression on ``Audio`` and ``Document`` for unicode fields
2015-08-12
Released 2.5.3
telegram.Bot now supports to be unpickled
**2015-09-20**
*Released 2.8.4*
- ``getFile`` and ``File.download`` is now fully supported
2015-08-11
Released 2.5.2
New changes from Telegram Bot API have been applied
telegram.Bot now supports to be pickled
Return empty str instead None when message.text is empty
**2015-09-10**
*Released 2.8.3*
- Moved ``Bot._requestURL`` to its own class (``telegram.utils.request``)
- Much better, such wow, Telegram Objects tests
- Add consistency for ``str`` properties on Telegram Objects
- Better design to test if ``chat_id`` is invalid
- Add ability to set custom filename on ``Bot.sendDocument(..,filename='')``
- Fix Sticker as ``InputFile``
- Send JSON requests over urlencoded post data
- Markdown support for ``Bot.sendMessage(..., parse_mode=ParseMode.MARKDOWN)``
- Refactor of ``TelegramError`` class (no more handling ``IOError`` or ``URLError``)
2015-08-10
Released 2.5.1
Moved from GPLv2 to LGPLv3
**2015-09-05**
*Released 2.8.2*
- Fix regression on Telegram ReplyMarkup
- Add certificate to ``is_inputfile`` method
2015-08-09
Released 2.5
Fixes logging calls in API
**2015-09-05**
*Released 2.8.1*
- Fix regression on Telegram objects with thumb properties
2015-08-08
Released 2.4
Fixes Emoji class for Python 3
PEP8 improvements
**2015-09-04**
*Released 2.8*
- TelegramError when ``chat_id`` is empty for send* methods
- ``setWebhook`` now supports sending self-signed certificate
- Huge redesign of existing Telegram classes
- Added support for PyPy
- Added docstring for existing classes
2015-08-08
Released 2.3
Fixes ForceReply class
Remove logging.basicConfig from library
**2015-08-19**
*Released 2.7.1*
- Fixed JSON serialization for ``message``
2015-07-25
Released 2.2
Allows debug=True when initializing telegram.Bot
**2015-08-17**
*Released 2.7*
- Added support for ``Voice`` object and ``sendVoice`` method
- Due backward compatibility performer or/and title will be required for ``sendAudio``
- Fixed JSON serialization when forwarded message
2015-07-20
Released 2.1
Fix to_dict for Document and Video
**2015-08-15**
*Released 2.6.1*
- Fixed parsing image header issue on < Python 2.7.3
2015-07-19
**2015-08-14**
Released 2.0
Fixes bugs
Improves __str__ over to_json()
Creates abstractclass TelegramObject
*Released 2.6.0*
- Depreciation of ``require_authentication`` and ``clearCredentials`` methods
- Giving ``AUTHORS`` the proper credits for their contribution for this project
- ``Message.date`` and ``Message.forward_date`` are now ``datetime`` objects
2015-07-15
**2015-08-12**
Released 1.9
Python 3 officially supported
PEP8 improvements
*Released 2.5.3*
- ``telegram.Bot`` now supports to be unpickled
2015-07-12
**2015-08-11**
Released 1.8
Fixes crash when replying an unicode text message (special thanks to JRoot3D)
*Released 2.5.2*
- New changes from Telegram Bot API have been applied
- ``telegram.Bot`` now supports to be pickled
- Return empty ``str`` instead ``None`` when ``message.text`` is empty
2015-07-11
**2015-08-10**
Released 1.7
Fixes crash when username is not defined on chat (special thanks to JRoot3D)
*Released 2.5.1*
- Moved from GPLv2 to LGPLv3
2015-07-10
**2015-08-09**
Released 1.6
Improvements for GAE support
*Released 2.5*
- Fixes logging calls in API
2015-07-10
**2015-08-08**
Released 1.5
Fixes randomly unicode issues when using InputFile
*Released 2.4*
- Fixes ``Emoji`` class for Python 3
- ``PEP8`` improvements
2015-07-10
**2015-08-08**
Released 1.4
requests lib is no longer required
Google App Engine (GAE) is supported
*Released 2.3*
- Fixes ``ForceReply`` class
- Remove ``logging.basicConfig`` from library
2015-07-10
**2015-07-25**
Released 1.3
Added support to setWebhook (special thanks to macrojames)
*Released 2.2*
- Allows ``debug=True`` when initializing ``telegram.Bot``
2015-07-09
**2015-07-20**
Released 1.2
CustomKeyboard classes now available
Emojis available
PEP8 improvements
*Released 2.1*
- Fix ``to_dict`` for ``Document`` and ``Video``
2015-07-08
**2015-07-19**
Released 1.1
PyPi package now available
*Released 2.0*
- Fixes bugs
- Improves ``__str__`` over ``to_json()``
- Creates abstract class ``TelegramObject``
2015-07-08
**2015-07-15**
Released 1.0
Initial checkin of python-telegram-bot
*Released 1.9*
- Python 3 officially supported
- ``PEP8`` improvements
**2015-07-12**
*Released 1.8*
- Fixes crash when replying an unicode text message (special thanks to JRoot3D)
**2015-07-11**
*Released 1.7*
- Fixes crash when ``username`` is not defined on ``chat`` (special thanks to JRoot3D)
**2015-07-10**
*Released 1.6*
- Improvements for GAE support
**2015-07-10**
*Released 1.5*
- Fixes randomly unicode issues when using ``InputFile``
**2015-07-10**
*Released 1.4*
- ``requests`` lib is no longer required
- Google App Engine (GAE) is supported
**2015-07-10**
*Released 1.3*
- Added support to ``setWebhook`` (special thanks to macrojames)
**2015-07-09**
*Released 1.2*
- ``CustomKeyboard`` classes now available
- Emojis available
- ``PEP8`` improvements
**2015-07-08**
*Released 1.1*
- PyPi package now available
**2015-07-08**
*Released 1.0*
- Initial checkin of python-telegram-bot
-39
View File
@@ -1,39 +0,0 @@
How To Contribute
=================
Every open source project lives from the generous help by contributors that sacrifice their time and ``python-telegram-bot`` is no different.
To make participation as pleasant as possible, this project adheres to the `Code of Conduct`_ by the Python Software Foundation.
Here are a few guidelines to get you started:
- Add yourself to the AUTHORS.rst_ file in an alphabetical fashion.
Every contribution is valuable and shall be credited.
- If your change is noteworthy, add an entry to the CHANGES_.
- No contribution is too small; please submit as many fixes for typos and grammar bloopers as you can!
- Dont break backward compatibility.
- *Always* add tests and docs for your code.
This is a hard rule; patches with missing tests or documentation wont be merged.
If a feature is not tested or documented, it doesnt exist.
- Obey `PEP 8`_ and `PEP 257`_.
- Follow `Google Python Style Guide`_ and `Google Python Style Docstrings`_.
- Write `good commit messages`_.
.. note::
If you have something great but arent sure whether it adheres -- or even can adhere -- to the rules above: **please submit a pull request anyway**!
In the best case, we can mold it into something, in the worst case the pull request gets politely closed.
Theres absolutely nothing to fear.
Thank you for considering to contribute to ``python-telegram-bot``!
If you have any question or concerns, feel free to reach out to me.
.. _`PEP 8`: https://www.python.org/dev/peps/pep-0008/
.. _`PEP 257`: https://www.python.org/dev/peps/pep-0257/
.. _`good commit messages`: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
.. _`Code of Conduct`: https://www.python.org/psf/codeofconduct/
.. _`Google Python Style Guide`: https://google-styleguide.googlecode.com/svn/trunk/pyguide.html
.. _`Google Python Style Docstrings`: http://sphinx-doc.org/latest/ext/example_google.html
.. _CHANGES: https://github.com/leandrotoledo/python-telegram-bot/blob/master/CHANGES
.. _AUTHORS.rst: https://github.com/leandrotoledo/python-telegram-bot/blob/master/AUTHORS.rst
+1 -1
View File
@@ -1 +1 @@
include LICENSE LICENSE.lesser Makefile
include LICENSE LICENSE.lesser Makefile requirements.txt
+32 -4
View File
@@ -1,4 +1,12 @@
.PHONY: clean pep8 lint test
.DEFAULT_GOAL := help
.PHONY: clean pep257 pep8 yapf lint test install
PYLINT := pylint
NOSETESTS := nosetests
PEP257 := pep257
PEP8 := flake8
YAPF := yapf
PIP := pip
clean:
rm -fr build
@@ -6,19 +14,39 @@ clean:
find . -name '*.pyc' -exec rm -f {} \;
find . -name '*.pyo' -exec rm -f {} \;
find . -name '*~' -exec rm -f {} \;
find . -regex "./telegram.\(mp3\|mp4\|ogg\|png\|webp\)" -exec rm {} \;
pep257:
$(PEP257) telegram
pep8:
flake8 telegram
$(PEP8) telegram
yapf:
$(YAPF) -r telegram
lint:
pylint -E telegram
$(PYLINT) -E telegram --disable=no-name-in-module,import-error
test:
@- $(foreach TEST, $(wildcard tests/test_*.py), python $(TEST))
$(NOSETESTS) -v
install:
$(PIP) install -r requirements.txt -r requirements-dev.txt
help:
@echo "Available targets:"
@echo "- clean Clean up the source directory"
@echo "- pep257 Check docstring style with pep257"
@echo "- pep8 Check style with flake8"
@echo "- lint Check style with pylint"
@echo "- yapf Check style with yapf"
@echo "- test Run tests"
@echo
@echo "Available variables:"
@echo "- PYLINT default: $(PYLINT)"
@echo "- NOSETESTS default: $(NOSETESTS)"
@echo "- PEP257 default: $(PEP257)"
@echo "- PEP8 default: $(PEP8)"
@echo "- YAPF default: $(YAPF)"
@echo "- PIP default: $(PIP)"
+117 -194
View File
@@ -1,36 +1,47 @@
Python Telegram Bot
.. image:: https://github.com/python-telegram-bot/logos/blob/master/logo-text/png/ptb-logo-text_768.png?raw=true
:align: center
:target: https://python-telegram-bot.org
:alt: python-telegram-bot Logo
A Python wrapper around the Telegram Bot API.
We have made you a wrapper you can't refuse
By `Leandro Toledo <leandrotoledodesouza@gmail.com>`_
*Stay tuned for library updates and new releases on our* `Telegram Channel <https://telegram.me/pythontelegrambotchannel>`_.
.. image:: https://img.shields.io/pypi/v/python-telegram-bot.svg
:target: https://pypi.python.org/pypi/python-telegram-bot
:alt: PyPi Package Version
.. image:: https://img.shields.io/pypi/dm/python-telegram-bot.svg
.. image:: https://img.shields.io/pypi/pyversions/python-telegram-bot.svg
:target: https://pypi.python.org/pypi/python-telegram-bot
:alt: PyPi Package Monthly Download
.. image:: https://readthedocs.org/projects/python-telegram-bot/badge/?version=latest
:target: https://readthedocs.org/projects/python-telegram-bot/?badge=latest
:alt: Supported python versions
.. image:: https://img.shields.io/badge/docs-latest-af1a97.svg
:target: https://python-telegram-bot.readthedocs.io/
:alt: Documentation Status
.. image:: https://img.shields.io/github/license/leandrotoledo/python-telegram-bot.svg
:target: http://www.gnu.org/licenses/lgpl-3.0.html
.. image:: https://img.shields.io/pypi/l/python-telegram-bot.svg
:target: https://www.gnu.org/licenses/lgpl-3.0.html
:alt: LGPLv3 License
.. image:: https://travis-ci.org/leandrotoledo/python-telegram-bot.svg?branch=master
:target: https://travis-ci.org/leandrotoledo/python-telegram-bot
.. image:: https://travis-ci.org/python-telegram-bot/python-telegram-bot.svg?branch=master
:target: https://travis-ci.org/python-telegram-bot/python-telegram-bot
:alt: Travis CI Status
.. image:: https://codeclimate.com/github/leandrotoledo/python-telegram-bot/badges/gpa.svg
:target: https://codeclimate.com/github/leandrotoledo/python-telegram-bot
.. image:: https://codeclimate.com/github/python-telegram-bot/python-telegram-bot/badges/gpa.svg
:target: https://codeclimate.com/github/python-telegram-bot/python-telegram-bot
:alt: Code Climate
.. image:: https://coveralls.io/repos/leandrotoledo/python-telegram-bot/badge.svg?branch=master&service=github
:target: https://coveralls.io/github/leandrotoledo/python-telegram-bot?branch=master
.. image:: https://coveralls.io/repos/python-telegram-bot/python-telegram-bot/badge.svg?branch=master&service=github
:target: https://coveralls.io/github/python-telegram-bot/python-telegram-bot?branch=master
:alt: Coveralls
.. image:: http://isitmaintained.com/badge/resolution/python-telegram-bot/python-telegram-bot.svg
:target: http://isitmaintained.com/project/python-telegram-bot/python-telegram-bot
:alt: Median time to resolve an issue
.. image:: https://img.shields.io/badge/Telegram-Group-blue.svg
:target: https://telegram.me/pythontelegrambotgroup
:alt: Telegram Group
=================
Table of contents
@@ -38,238 +49,150 @@ Table of contents
- `Introduction`_
- `Status`_
1. `Telegram API support`_
2. `Python Version support`_
- `Telegram API support`_
- `Installing`_
- `Getting the code`_
- `Getting started`_
1. `API`_
#. `Learning by example`_
2. `Logging`_
#. `Logging`_
3. `Examples`_
4. `Documentation`_
#. `Documentation`_
- `Getting help`_
- `Contributing`_
- `License`_
- `Contact`_
============
Introduction
============
- `TODO`_
This library provides a pure Python interface for the
`Telegram Bot API <https://core.telegram.org/bots/api>`_.
It's compatible with Python versions 2.7, 3.3+ and `PyPy <http://pypy.org/>`_.
It also works with `Google App Engine <https://cloud.google.com/appengine>`_.
===============
_`Introduction`
===============
In addition to the pure API implementation, this library features a number of high-level classes to
make the development of bots easy and straightforward. These classes are contained in the
``telegram.ext`` submodule.
This library provides a pure Python interface for the `Telegram Bot API <https://core.telegram.org/bots/api>`_. It works with Python versions from 2.6+. It also works with `Google App Engine <https://cloud.google.com/appengine>`_.
====================
Telegram API support
====================
=========
_`Status`
=========
As of **4. Dec 2016**, all types and methods of the Telegram Bot API are supported.
-----------------------
_`Telegram API support`
-----------------------
==========
Installing
==========
========================= ============
Telegram Bot API Method *Supported?*
========================= ============
getMe Yes
sendMessage Yes
forwardMessage Yes
sendPhoto Yes
sendAudio Yes
sendDocument Yes
sendSticker Yes
sendVideo Yes
sendVoice Yes
sendLocation Yes
sendChatAction Yes
getUpdates Yes
getUserProfilePhotos Yes
setWebhook Yes
========================= ============
You can install or upgrade python-telegram-bot with:
-------------------------
_`Python Version support`
-------------------------
============== ============
Python Version *Supported?*
============== ============
2.6 Yes
2.7 Yes
3.3 Yes
3.4 Yes
============== ============
=============
_`Installing`
=============
You can install python-telegram-bot using::
$ pip install python-telegram-bot
Or upgrade to the latest version::
.. code:: shell
$ pip install python-telegram-bot --upgrade
===================
_`Getting the code`
===================
Or you can install from source with:
The code is hosted at https://github.com/leandrotoledo/python-telegram-bot
.. code:: shell
Check out the latest development version anonymously with::
$ git clone https://github.com/leandrotoledo/python-telegram-bot
$ git clone https://github.com/python-telegram-bot/python-telegram-bot --recursive
$ cd python-telegram-bot
$ python setup.py install
In case you have a previously cloned local repository already, you should initialize the added urllib3 submodule before installing with:
Run tests:
.. code:: shell
$ make test
$ git submodule update --init --recursive
To see other options available, run:
===============
Getting started
===============
$ make help
Our Wiki contains a lot of resources to get you started with ``python-telegram-bot``:
==================
_`Getting started`
==================
- `Introduction to the API <https://github.com/python-telegram-bot/python-telegram-bot/wiki/Introduction-to-the-API>`_
- Tutorial: `Your first Bot <https://github.com/python-telegram-bot/python-telegram-bot/wiki/Extensions-%E2%80%93-Your-first-Bot>`_
View the last release API documentation at: https://core.telegram.org/bots/api
Other references:
------
_`API`
------
- `Telegram API documentation <https://core.telegram.org/bots/api>`_
- `python-telegram-bot documentation <https://python-telegram-bot.readthedocs.io/>`_
The API is exposed via the ``telegram.Bot`` class.
-------------------
Learning by example
-------------------
To generate an Access Token you have to talk to `BotFather <https://telegram.me/botfather>`_ and follow a few simple steps (described `here <https://core.telegram.org/bots#botfather>`_).
We believe that the best way to learn and understand this simple package is by example. So here
are some examples for you to review. Even if it's not your approach for learning, please take a
look at ``echobot2``, it is de facto the base for most of the bots out there. Best of all,
the code for these examples are released to the public domain, so you can start by grabbing the
code and building on top of it.
For full details see the `Bots: An introduction for developers <https://core.telegram.org/bots>`_.
Visit `this page <https://github.com/python-telegram-bot/python-telegram-bot/blob/master/examples/README.md>`_ to discover the official examples or look at the examples on the `wiki <https://github.com/python-telegram-bot/python-telegram-bot/wiki/Examples>`_ to see other bots the community has built.
To create an instance of the ``telegram.Bot``::
-------
Logging
-------
>>> import telegram
>>> bot = telegram.Bot(token='token')
This library uses the ``logging`` module. To set up logging to standard output, put:
To see if your credentials are successful::
.. code:: python
>>> print bot.getMe()
{"first_name": "Toledo's Palace Bot", "username": "ToledosPalaceBot"}
import logging
logging.basicConfig(level=logging.DEBUG,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
Bots can't initiate conversations with users. A user must either add them to a group or send them a message first. People can use ``telegram.me/<bot_username>`` links or username search to find your bot.
at the beginning of your script.
To fetch text messages sent to your Bot::
You can also use logs in your application by calling ``logging.getLogger()`` and setting the log level you want:
>>> updates = bot.getUpdates()
>>> print [u.message.text for u in updates]
.. code:: python
To fetch images sent to your Bot::
logger = logging.getLogger()
logger.setLevel(logging.INFO)
>>> updates = bot.getUpdates()
>>> print [u.message.photo for u in updates if u.message.photo]
If you want DEBUG logs instead:
To reply messages you'll always need the chat_id::
.. code:: python
>>> chat_id = bot.getUpdates()[-1].message.chat_id
logger.setLevel(logging.DEBUG)
To post a text message::
>>> bot.sendMessage(chat_id=chat_id, text="I'm sorry Dave I'm afraid I can't do that.")
=============
Documentation
=============
To post an Emoji (special thanks to `Tim Whitlock <http://apps.timwhitlock.info/emoji/tables/unicode>`_)::
``python-telegram-bot``'s documentation lives at `readthedocs.io <https://python-telegram-bot.readthedocs.io/>`_.
>>> bot.sendMessage(chat_id=chat_id, text=telegram.Emoji.PILE_OF_POO)
============
Getting help
============
To post an image file via URL (right now only sendPhoto supports this)::
You can get help in several ways:
>>> bot.sendPhoto(chat_id=chat_id, photo='https://telegram.org/img/t_logo.png')
1. We have a vibrant community of developers helping each other in our `Telegram group <https://telegram.me/pythontelegrambotgroup>`_. Join us!
To post a voice file::
2. Our `Wiki pages <https://github.com/python-telegram-bot/python-telegram-bot/wiki/>`_ offer a growing amount of resources.
>>> bot.sendVoice(chat_id=chat_id, voice=open('tests/telegram.ogg', 'rb'))
3. You can ask for help on Stack Overflow using the `python-telegram-bot tag <https://stackoverflow.com/questions/tagged/python-telegram-bot>`_.
To tell the user that something is happening on bot's side::
4. As last resort, the developers are ready to help you with `serious issues <https://github.com/python-telegram-bot/python-telegram-bot/issues/new>`_.
>>> bot.sendChatAction(chat_id=chat_id, action=telegram.ChatAction.TYPING)
To create `Custom Keyboards <https://core.telegram.org/bots#keyboards>`_::
============
Contributing
============
>>> custom_keyboard = [[ telegram.Emoji.THUMBS_UP_SIGN, telegram.Emoji.THUMBS_DOWN_SIGN ]]
>>> reply_markup = telegram.ReplyKeyboardMarkup(custom_keyboard)
>>> bot.sendMessage(chat_id=chat_id, text="Stay here, I'll be back.", reply_markup=reply_markup)
To hide `Custom Keyboards <https://core.telegram.org/bots#keyboards>`_::
>>> reply_markup = telegram.ReplyKeyboardHide()
>>> bot.sendMessage(chat_id=chat_id, text="I'm back.", reply_markup=reply_markup)
There are many more API methods, to read the full API documentation::
$ pydoc telegram.Bot
-----------
_`Logging`
-----------
You can get logs in your main application by calling `logging` and setting the log level you want::
>>> import logging
>>> logger = logging.getLogger()
>>> logger.setLevel(logging.INFO)
If you want DEBUG logs instead::
>>> logger.setLevel(logging.DEBUG)
-----------
_`Examples`
-----------
Here follows some examples to help you to get your own Bot up to speed:
- `echobot <https://github.com/leandrotoledo/python-telegram-bot/blob/master/examples/echobot.py>`_ replies back messages.
- `roboed <https://github.com/leandrotoledo/python-telegram-bot/blob/master/examples/roboed.py>`_ talks to `Robô Ed <http://www.ed.conpet.gov.br/br/converse.php>`_.
- `Simple-Echo-Telegram-Bot <https://github.com/sooyhwang/Simple-Echo-Telegram-Bot>`_ simple Python Telegram bot that echoes your input with Flask microframework, setWebhook method, and Google App Engine (optional) - by @sooyhwang.
- `DevOps Reaction Bot <https://github.com/leandrotoledo/gae-devops-reaction-telegram-bot>`_ sends latest or random posts from `DevOps Reaction <http://devopsreactions.tumblr.com/>`_. Running on `Google App Engine <https://cloud.google.com/appengine>`_ (billing has to be enabled for fully Socket API support).
================
_`Documentation`
================
``python-telegram-bot``'s documentation lives at `Read the Docs <http://python-telegram-bot.readthedocs.org/en/latest/>`_.
==========
_`License`
==========
You may copy, distribute and modify the software provided that modifications are described and licensed for free under `LGPL-3 <http://www.gnu.org/licenses/lgpl-3.0.html>`_. Derivatives works (including modifications or anything statically linked to the library) can only be redistributed under `LGPL-3 <http://www.gnu.org/licenses/lgpl-3.0.html>`_, but applications that use the library don't have to be.
==========
_`Contact`
==========
Feel free to join to our `Telegram group <https://telegram.me/joinchat/00b9c0f802509b94d52953d3fa1ec504>`_.
*If you face trouble joining in the group please ping me on Telegram (@leandrotoledo), I'll be glad to add you.*
Contributions of all sizes are welcome. Please review our `contribution guidelines <https://github.com/python-telegram-bot/python-telegram-bot/blob/master/.github/CONTRIBUTING.rst>`_ to get started. You can also help by `reporting bugs <https://github.com/python-telegram-bot/python-telegram-bot/issues/new>`_.
=======
_`TODO`
License
=======
Patches and bug reports are `welcome <https://github.com/leandrotoledo/python-telegram-bot/issues/new>`_, just please keep the style consistent with the original source.
- Add commands handler.
You may copy, distribute and modify the software provided that modifications are described and licensed for free under `LGPL-3 <https://www.gnu.org/licenses/lgpl-3.0.html>`_. Derivatives works (including modifications or anything statically linked to the library) can only be redistributed under LGPL-3, but applications that use the library don't have to be.
+1 -1
View File
@@ -189,4 +189,4 @@ xml:
pseudoxml:
$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
@echo
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
+13 -9
View File
@@ -15,6 +15,7 @@
import sys
import os
import shlex
# import telegram
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
@@ -50,7 +51,7 @@ master_doc = 'index'
# General information about the project.
project = u'Python Telegram Bot'
copyright = u'2015, Leandro Toledo'
copyright = u'2015-2017, Leandro Toledo'
author = u'Leandro Toledo'
# The version info for the project you're documenting, acts as replacement for
@@ -58,9 +59,9 @@ author = u'Leandro Toledo'
# built documents.
#
# The short X.Y version.
version = '2.5'
version = '6.0' # telegram.__version__[:3]
# The full version, including alpha/beta/rc tags.
release = '2.5.1'
release = '6.0.0' # telegram.__version__
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
@@ -130,7 +131,7 @@ html_theme = 'sphinx_rtd_theme'
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
#html_logo = None
html_logo = 'ptb-logo-orange.png'
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
@@ -208,14 +209,17 @@ htmlhelp_basename = 'PythonTelegramBotdoc'
# -- Options for LaTeX output ---------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#'papersize': 'letterpaper',
'papersize': 'a4paper',
# The font size ('10pt', '11pt' or '12pt').
#'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#'preamble': '',
'preamble': r'''\setcounter{tocdepth}{2}
\usepackage{enumitem}
\setlistdepth{99}''',
# Latex figure (float) alignment
#'figure_align': 'htbp',
@@ -226,12 +230,12 @@ latex_elements = {
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'PythonTelegramBot.tex', u'Python Telegram Bot Documentation',
u'Leandro Toledo', 'manual'),
author, 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
# the title page.
#latex_logo = None
latex_logo = 'ptb-logo_1024.png'
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
@@ -270,7 +274,7 @@ man_pages = [
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'PythonTelegramBot', u'Python Telegram Bot Documentation',
author, 'PythonTelegramBot', 'One line description of project.',
author, 'PythonTelegramBot', "We have made you a wrapper you can't refuse",
'Miscellaneous'),
]
+1 -4
View File
@@ -6,11 +6,8 @@
Welcome to Python Telegram Bot's documentation!
===============================================
Contents:
.. toctree::
:maxdepth: 2
telegram
Indices and tables
-7
View File
@@ -1,7 +0,0 @@
telegram
========
.. toctree::
:maxdepth: 4
telegram
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

@@ -1,7 +1,7 @@
telegram.groupchat module
telegram.animation module
=========================
.. automodule:: telegram.groupchat
.. automodule:: telegram.animation
:members:
:undoc-members:
:show-inheritance:
-1
View File
@@ -3,5 +3,4 @@ telegram.bot module
.. automodule:: telegram.bot
:members:
:undoc-members:
:show-inheritance:
+7
View File
@@ -0,0 +1,7 @@
telegram.callbackgame module
============================
.. automodule:: telegram.callbackgame
:members:
:undoc-members:
:show-inheritance:
+7
View File
@@ -0,0 +1,7 @@
telegram.callbackquery module
=============================
.. automodule:: telegram.callbackquery
:members:
:undoc-members:
:show-inheritance:
+7
View File
@@ -0,0 +1,7 @@
telegram.chat module
=========================
.. automodule:: telegram.chat
:members:
:undoc-members:
:show-inheritance:
+7
View File
@@ -0,0 +1,7 @@
telegram.chatmember module
==========================
.. automodule:: telegram.chatmember
:members:
:undoc-members:
:show-inheritance:
@@ -0,0 +1,7 @@
telegram.choseninlineresult module
==================================
.. automodule:: telegram.choseninlineresult
:members:
:undoc-members:
:show-inheritance:
+7
View File
@@ -0,0 +1,7 @@
telegram.constants module
=========================
.. automodule:: telegram.constants
:members:
:undoc-members:
:show-inheritance:
+7
View File
@@ -0,0 +1,7 @@
telegram.contrib.botan module
=============================
.. automodule:: telegram.contrib.botan
:members:
:undoc-members:
:show-inheritance:
+17
View File
@@ -0,0 +1,17 @@
telegram.contrib package
========================
Submodules
----------
.. toctree::
telegram.contrib.botan
Module contents
---------------
.. automodule:: telegram.contrib
:members:
:undoc-members:
:show-inheritance:
@@ -0,0 +1,7 @@
telegram.ext.callbackqueryhandler module
========================================
.. automodule:: telegram.ext.callbackqueryhandler
:members:
:undoc-members:
:show-inheritance:
@@ -0,0 +1,7 @@
telegram.ext.choseninlineresulthandler module
=============================================
.. automodule:: telegram.ext.choseninlineresulthandler
:members:
:undoc-members:
:show-inheritance:
@@ -0,0 +1,7 @@
telegram.ext.commandhandler module
==================================
.. automodule:: telegram.ext.commandhandler
:members:
:undoc-members:
:show-inheritance:
@@ -0,0 +1,7 @@
telegram.ext.conversationhandler module
=======================================
.. automodule:: telegram.ext.conversationhandler
:members:
:undoc-members:
:show-inheritance:
+7
View File
@@ -0,0 +1,7 @@
telegram.ext.dispatcher module
==============================
.. automodule:: telegram.ext.dispatcher
:members:
:undoc-members:
:show-inheritance:
@@ -1,7 +1,7 @@
telegram.nullhandler module
telegram.ext.filters module
===========================
.. automodule:: telegram.nullhandler
.. automodule:: telegram.ext.filters
:members:
:undoc-members:
:show-inheritance:
+7
View File
@@ -0,0 +1,7 @@
telegram.ext.handler module
===========================
.. automodule:: telegram.ext.handler
:members:
:undoc-members:
:show-inheritance:
@@ -0,0 +1,7 @@
telegram.ext.inlinequeryhandler module
======================================
.. automodule:: telegram.ext.inlinequeryhandler
:members:
:undoc-members:
:show-inheritance:
+7
View File
@@ -0,0 +1,7 @@
telegram.ext.jobqueue module
============================
.. automodule:: telegram.ext.jobqueue
:members:
:undoc-members:
:show-inheritance:
@@ -0,0 +1,7 @@
telegram.ext.messagehandler module
==================================
.. automodule:: telegram.ext.messagehandler
:members:
:undoc-members:
:show-inheritance:
@@ -0,0 +1,7 @@
telegram.ext.messagequeue module
================================
.. automodule:: telegram.ext.messagequeue
:members:
:undoc-members:
:show-inheritance:
@@ -0,0 +1,7 @@
telegram.ext.regexhandler module
================================
.. automodule:: telegram.ext.regexhandler
:members:
:undoc-members:
:show-inheritance:
+32
View File
@@ -0,0 +1,32 @@
telegram.ext package
====================
Submodules
----------
.. toctree::
telegram.ext.updater
telegram.ext.dispatcher
telegram.ext.jobqueue
telegram.ext.handler
telegram.ext.callbackqueryhandler
telegram.ext.choseninlineresulthandler
telegram.ext.conversationhandler
telegram.ext.commandhandler
telegram.ext.inlinequeryhandler
telegram.ext.messagehandler
telegram.ext.messagequeue
telegram.ext.filters
telegram.ext.regexhandler
telegram.ext.stringcommandhandler
telegram.ext.stringregexhandler
telegram.ext.typehandler
Module contents
---------------
.. automodule:: telegram.ext
:members:
:undoc-members:
:show-inheritance:
@@ -0,0 +1,7 @@
telegram.ext.stringcommandhandler module
========================================
.. automodule:: telegram.ext.stringcommandhandler
:members:
:undoc-members:
:show-inheritance:
@@ -0,0 +1,7 @@
telegram.ext.stringregexhandler module
======================================
.. automodule:: telegram.ext.stringregexhandler
:members:
:undoc-members:
:show-inheritance:
+7
View File
@@ -0,0 +1,7 @@
telegram.ext.typehandler module
===============================
.. automodule:: telegram.ext.typehandler
:members:
:undoc-members:
:show-inheritance:
+7
View File
@@ -0,0 +1,7 @@
telegram.ext.updater module
===========================
.. automodule:: telegram.ext.updater
:members:
:undoc-members:
:show-inheritance:
+7
View File
@@ -0,0 +1,7 @@
telegram.file module
====================
.. automodule:: telegram.file
:members:
:undoc-members:
:show-inheritance:
+7
View File
@@ -0,0 +1,7 @@
telegram.game module
====================
.. automodule:: telegram.game
:members:
:undoc-members:
:show-inheritance:
+7
View File
@@ -0,0 +1,7 @@
telegram.gamehighscore module
=============================
.. automodule:: telegram.gamehighscore
:members:
:undoc-members:
:show-inheritance:
@@ -0,0 +1,7 @@
telegram.inlinekeyboardbutton module
====================================
.. automodule:: telegram.inlinekeyboardbutton
:members:
:undoc-members:
:show-inheritance:
@@ -0,0 +1,7 @@
telegram.inlinekeyboardmarkup module
====================================
.. automodule:: telegram.inlinekeyboardmarkup
:members:
:undoc-members:
:show-inheritance:
+7
View File
@@ -0,0 +1,7 @@
telegram.inlinequery module
===========================
.. automodule:: telegram.inlinequery
:members:
:undoc-members:
:show-inheritance:
@@ -1,7 +1,7 @@
telegram.replykeyboardhide module
telegram.inlinequeryresult module
=================================
.. automodule:: telegram.replykeyboardhide
.. automodule:: telegram.inlinequeryresult
:members:
:undoc-members:
:show-inheritance:
@@ -0,0 +1,7 @@
telegram.inlinequeryresultarticle module
========================================
.. automodule:: telegram.inlinequeryresultarticle
:members:
:undoc-members:
:show-inheritance:
@@ -0,0 +1,7 @@
telegram.inlinequeryresultaudio module
======================================
.. automodule:: telegram.inlinequeryresultaudio
:members:
:undoc-members:
:show-inheritance:
@@ -0,0 +1,7 @@
telegram.inlinequeryresultcachedaudio module
============================================
.. automodule:: telegram.inlinequeryresultcachedaudio
:members:
:undoc-members:
:show-inheritance:
@@ -0,0 +1,7 @@
telegram.inlinequeryresultcacheddocument module
===============================================
.. automodule:: telegram.inlinequeryresultcacheddocument
:members:
:undoc-members:
:show-inheritance:
@@ -0,0 +1,7 @@
telegram.inlinequeryresultcachedgif module
==========================================
.. automodule:: telegram.inlinequeryresultcachedgif
:members:
:undoc-members:
:show-inheritance:
@@ -0,0 +1,7 @@
telegram.inlinequeryresultcachedmpeg4gif module
===============================================
.. automodule:: telegram.inlinequeryresultcachedmpeg4gif
:members:
:undoc-members:
:show-inheritance:
@@ -0,0 +1,7 @@
telegram.inlinequeryresultcachedphoto module
============================================
.. automodule:: telegram.inlinequeryresultcachedphoto
:members:
:undoc-members:
:show-inheritance:
@@ -0,0 +1,7 @@
telegram.inlinequeryresultcachedsticker module
==============================================
.. automodule:: telegram.inlinequeryresultcachedsticker
:members:
:undoc-members:
:show-inheritance:
@@ -0,0 +1,7 @@
telegram.inlinequeryresultcachedvideo module
============================================
.. automodule:: telegram.inlinequeryresultcachedvideo
:members:
:undoc-members:
:show-inheritance:
@@ -0,0 +1,7 @@
telegram.inlinequeryresultcachedvoice module
============================================
.. automodule:: telegram.inlinequeryresultcachedvoice
:members:
:undoc-members:
:show-inheritance:
@@ -0,0 +1,7 @@
telegram.inlinequeryresultcontact module
========================================
.. automodule:: telegram.inlinequeryresultcontact
:members:
:undoc-members:
:show-inheritance:
@@ -0,0 +1,7 @@
telegram.inlinequeryresultdocument module
=========================================
.. automodule:: telegram.inlinequeryresultdocument
:members:
:undoc-members:
:show-inheritance:
@@ -0,0 +1,7 @@
telegram.inlinequeryresultgame module
=====================================
.. automodule:: telegram.inlinequeryresultgame
:members:
:undoc-members:
:show-inheritance:
@@ -0,0 +1,7 @@
telegram.inlinequeryresultgif module
====================================
.. automodule:: telegram.inlinequeryresultgif
:members:
:undoc-members:
:show-inheritance:
@@ -0,0 +1,7 @@
telegram.inlinequeryresultlocation module
=========================================
.. automodule:: telegram.inlinequeryresultlocation
:members:
:undoc-members:
:show-inheritance:
@@ -0,0 +1,7 @@
telegram.inlinequeryresultmpeg4gif module
=========================================
.. automodule:: telegram.inlinequeryresultmpeg4gif
:members:
:undoc-members:
:show-inheritance:
@@ -0,0 +1,7 @@
telegram.inlinequeryresultphoto module
======================================
.. automodule:: telegram.inlinequeryresultphoto
:members:
:undoc-members:
:show-inheritance:
@@ -0,0 +1,7 @@
telegram.inlinequeryresultvenue module
======================================
.. automodule:: telegram.inlinequeryresultvenue
:members:
:undoc-members:
:show-inheritance:
@@ -0,0 +1,7 @@
telegram.inlinequeryresultvideo module
======================================
.. automodule:: telegram.inlinequeryresultvideo
:members:
:undoc-members:
:show-inheritance:
@@ -0,0 +1,7 @@
telegram.inlinequeryresultvoice module
======================================
.. automodule:: telegram.inlinequeryresultvoice
:members:
:undoc-members:
:show-inheritance:
@@ -0,0 +1,7 @@
telegram.inputcontactmessagecontent module
==========================================
.. automodule:: telegram.inputcontactmessagecontent
:members:
:undoc-members:
:show-inheritance:
@@ -0,0 +1,7 @@
telegram.inputlocationmessagecontent module
===========================================
.. automodule:: telegram.inputlocationmessagecontent
:members:
:undoc-members:
:show-inheritance:
@@ -0,0 +1,7 @@
telegram.inputmessagecontent module
===================================
.. automodule:: telegram.inputmessagecontent
:members:
:undoc-members:
:show-inheritance:
@@ -0,0 +1,7 @@
telegram.inputtextmessagecontent module
=======================================
.. automodule:: telegram.inputtextmessagecontent
:members:
:undoc-members:
:show-inheritance:
@@ -0,0 +1,7 @@
telegram.inputvenuemessagecontent module
========================================
.. automodule:: telegram.inputvenuemessagecontent
:members:
:undoc-members:
:show-inheritance:
+7
View File
@@ -0,0 +1,7 @@
telegram.keyboardbutton module
==============================
.. automodule:: telegram.keyboardbutton
:members:
:undoc-members:
:show-inheritance:
+7
View File
@@ -0,0 +1,7 @@
telegram.messageentity module
=============================
.. automodule:: telegram.messageentity
:members:
:undoc-members:
:show-inheritance:
+7
View File
@@ -0,0 +1,7 @@
telegram.parsemode module
=========================
.. automodule:: telegram.parsemode
:members:
:undoc-members:
:show-inheritance:
@@ -0,0 +1,7 @@
telegram.replykeyboardremove module
===================================
.. automodule:: telegram.replykeyboardremove
:members:
:undoc-members:
:show-inheritance:
+47 -4
View File
@@ -6,30 +6,73 @@ Submodules
.. toctree::
telegram.contrib
telegram.ext
telegram.animation
telegram.audio
telegram.base
telegram.bot
telegram.callbackgame
telegram.callbackquery
telegram.chat
telegram.chataction
telegram.chatmember
telegram.choseninlineresult
telegram.constants
telegram.contact
telegram.document
telegram.emoji
telegram.error
telegram.file
telegram.forcereply
telegram.groupchat
telegram.game
telegram.gamehighscore
telegram.inlinekeyboardbutton
telegram.inlinekeyboardmarkup
telegram.inlinequery
telegram.inlinequeryresult
telegram.inlinequeryresultarticle
telegram.inlinequeryresultaudio
telegram.inlinequeryresultcachedaudio
telegram.inlinequeryresultcacheddocument
telegram.inlinequeryresultcachedgif
telegram.inlinequeryresultcachedmpeg4gif
telegram.inlinequeryresultcachedphoto
telegram.inlinequeryresultcachedsticker
telegram.inlinequeryresultcachedvideo
telegram.inlinequeryresultcachedvoice
telegram.inlinequeryresultcontact
telegram.inlinequeryresultdocument
telegram.inlinequeryresultgame
telegram.inlinequeryresultgif
telegram.inlinequeryresultlocation
telegram.inlinequeryresultmpeg4gif
telegram.inlinequeryresultphoto
telegram.inlinequeryresultvenue
telegram.inlinequeryresultvideo
telegram.inlinequeryresultvoice
telegram.inputcontactmessagecontent
telegram.inputfile
telegram.inputlocationmessagecontent
telegram.inputmessagecontent
telegram.inputtextmessagecontent
telegram.inputvenuemessagecontent
telegram.keyboardbutton
telegram.location
telegram.message
telegram.nullhandler
telegram.messageentity
telegram.parsemode
telegram.photosize
telegram.replykeyboardhide
telegram.replykeyboardremove
telegram.replykeyboardmarkup
telegram.replymarkup
telegram.sticker
telegram.update
telegram.user
telegram.userprofilephotos
telegram.venue
telegram.video
telegram.voice
telegram.webhookinfo
Module contents
---------------
@@ -1,7 +1,7 @@
telegram.emoji module
telegram.venue module
=====================
.. automodule:: telegram.emoji
.. automodule:: telegram.venue
:members:
:undoc-members:
:show-inheritance:
+7
View File
@@ -0,0 +1,7 @@
telegram.webhookinfo module
===========================
.. automodule:: telegram.webhookinfo
:members:
:undoc-members:
:show-inheritance:
+116
View File
@@ -0,0 +1,116 @@
CC0 1.0 Universal
Statement of Purpose
The laws of most jurisdictions throughout the world automatically confer
exclusive Copyright and Related Rights (defined below) upon the creator and
subsequent owner(s) (each and all, an "owner") of an original work of
authorship and/or a database (each, a "Work").
Certain owners wish to permanently relinquish those rights to a Work for the
purpose of contributing to a commons of creative, cultural and scientific
works ("Commons") that the public can reliably and without fear of later
claims of infringement build upon, modify, incorporate in other works, reuse
and redistribute as freely as possible in any form whatsoever and for any
purposes, including without limitation commercial purposes. These owners may
contribute to the Commons to promote the ideal of a free culture and the
further production of creative, cultural and scientific works, or to gain
reputation or greater distribution for their Work in part through the use and
efforts of others.
For these and/or other purposes and motivations, and without any expectation
of additional consideration or compensation, the person associating CC0 with a
Work (the "Affirmer"), to the extent that he or she is an owner of Copyright
and Related Rights in the Work, voluntarily elects to apply CC0 to the Work
and publicly distribute the Work under its terms, with knowledge of his or her
Copyright and Related Rights in the Work and the meaning and intended legal
effect of CC0 on those rights.
1. Copyright and Related Rights. A Work made available under CC0 may be
protected by copyright and related or neighboring rights ("Copyright and
Related Rights"). Copyright and Related Rights include, but are not limited
to, the following:
i. the right to reproduce, adapt, distribute, perform, display, communicate,
and translate a Work;
ii. moral rights retained by the original author(s) and/or performer(s);
iii. publicity and privacy rights pertaining to a person's image or likeness
depicted in a Work;
iv. rights protecting against unfair competition in regards to a Work,
subject to the limitations in paragraph 4(a), below;
v. rights protecting the extraction, dissemination, use and reuse of data in
a Work;
vi. database rights (such as those arising under Directive 96/9/EC of the
European Parliament and of the Council of 11 March 1996 on the legal
protection of databases, and under any national implementation thereof,
including any amended or successor version of such directive); and
vii. other similar, equivalent or corresponding rights throughout the world
based on applicable law or treaty, and any national implementations thereof.
2. Waiver. To the greatest extent permitted by, but not in contravention of,
applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and
unconditionally waives, abandons, and surrenders all of Affirmer's Copyright
and Related Rights and associated claims and causes of action, whether now
known or unknown (including existing as well as future claims and causes of
action), in the Work (i) in all territories worldwide, (ii) for the maximum
duration provided by applicable law or treaty (including future time
extensions), (iii) in any current or future medium and for any number of
copies, and (iv) for any purpose whatsoever, including without limitation
commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes
the Waiver for the benefit of each member of the public at large and to the
detriment of Affirmer's heirs and successors, fully intending that such Waiver
shall not be subject to revocation, rescission, cancellation, termination, or
any other legal or equitable action to disrupt the quiet enjoyment of the Work
by the public as contemplated by Affirmer's express Statement of Purpose.
3. Public License Fallback. Should any part of the Waiver for any reason be
judged legally invalid or ineffective under applicable law, then the Waiver
shall be preserved to the maximum extent permitted taking into account
Affirmer's express Statement of Purpose. In addition, to the extent the Waiver
is so judged Affirmer hereby grants to each affected person a royalty-free,
non transferable, non sublicensable, non exclusive, irrevocable and
unconditional license to exercise Affirmer's Copyright and Related Rights in
the Work (i) in all territories worldwide, (ii) for the maximum duration
provided by applicable law or treaty (including future time extensions), (iii)
in any current or future medium and for any number of copies, and (iv) for any
purpose whatsoever, including without limitation commercial, advertising or
promotional purposes (the "License"). The License shall be deemed effective as
of the date CC0 was applied by Affirmer to the Work. Should any part of the
License for any reason be judged legally invalid or ineffective under
applicable law, such partial invalidity or ineffectiveness shall not
invalidate the remainder of the License, and in such case Affirmer hereby
affirms that he or she will not (i) exercise any of his or her remaining
Copyright and Related Rights in the Work or (ii) assert any associated claims
and causes of action with respect to the Work, in either case contrary to
Affirmer's express Statement of Purpose.
4. Limitations and Disclaimers.
a. No trademark or patent rights held by Affirmer are waived, abandoned,
surrendered, licensed or otherwise affected by this document.
b. Affirmer offers the Work as-is and makes no representations or warranties
of any kind concerning the Work, express, implied, statutory or otherwise,
including without limitation warranties of title, merchantability, fitness
for a particular purpose, non infringement, or the absence of latent or
other defects, accuracy, or the present or absence of errors, whether or not
discoverable, all to the greatest extent permissible under applicable law.
c. Affirmer disclaims responsibility for clearing rights of other persons
that may apply to the Work or any use thereof, including without limitation
any person's Copyright and Related Rights in the Work. Further, Affirmer
disclaims responsibility for obtaining any necessary consents, permissions
or other rights required for any use of the Work.
d. Affirmer understands and acknowledges that Creative Commons is not a
party to this document and has no duty or obligation with respect to this
CC0 or use of the Work.
For more information, please see
<http://creativecommons.org/publicdomain/zero/1.0/>
+26
View File
@@ -0,0 +1,26 @@
# Examples
The examples in this folder are small bots meant to show you how a bot that is written with `python-telegram-bot` looks like. Some bots focus on one specific aspect of the Telegram Bot API while others focus on one of the mechanics of this library. Except for the `echobot.py` example, they all use the high-level framework this library provides with the `telegram.ext` submodule.
All examples are licensed under the [CC0 License](https://github.com/python-telegram-bot/python-telegram-bot/blob/master/examples/LICENSE.txt) and are therefore fully dedicated to the public domain. You can use them as the base for your own bots without worrying about copyrights.
### [`echobot2.py`](https://github.com/python-telegram-bot/python-telegram-bot/blob/master/examples/echobot2.py)
This is probably the base for most of the bots made with `python-telegram-bot`. It simply replies to each text message with a message that contains the same text.
### [`timerbot.py`](https://github.com/python-telegram-bot/python-telegram-bot/blob/master/examples/timerbot.py)
This bot uses the [`JobQueue`](https://python-telegram-bot.readthedocs.io/en/latest/telegram.ext.jobqueue.html) class to send timed messages. The user sets a timer by using `/set` command with a specific time, for example `/set 30`. The bot then sets up a job to send a message to that user after 30 seconds. The user can also cancel the timer by sending `/unset`. To learn more about the `JobQueue`, read [this wiki article](https://github.com/python-telegram-bot/python-telegram-bot/wiki/Extensions-%E2%80%93-JobQueue).
### [`conversationbot.py`](https://github.com/python-telegram-bot/python-telegram-bot/blob/master/examples/conversationbot.py)
A common task for a bot is to ask information from the user. In v5.0 of this library, we introduced the [`ConversationHandler`](https://python-telegram-bot.readthedocs.io/en/latest/telegram.ext.conversationhandler.html) for that exact purpose. This example uses it to retrieve user-information in a conversation-like style. To get a better understanding, take a look at the [state diagram](https://github.com/python-telegram-bot/python-telegram-bot/blob/master/examples/conversationbot.png).
### [`conversationbot2.py`](https://github.com/python-telegram-bot/python-telegram-bot/blob/master/examples/conversationbot2.py)
A more complex example of a bot that uses the `ConversationHandler`. It is also more confusing. Good thing there is a [fancy state diagram](https://github.com/python-telegram-bot/python-telegram-bot/blob/master/examples/conversationbot2.png) for this one, too!
### [`inlinekeyboard.py`](https://github.com/python-telegram-bot/python-telegram-bot/blob/master/examples/inlinekeyboard.py)
This example sheds some light on inline keyboards, callback queries and message editing.
### [`inlinebot.py`](https://github.com/python-telegram-bot/python-telegram-bot/blob/master/examples/inlinebot.py)
A basic example of an [inline bot](https://core.telegram.org/bots/inline). Don't forget to enable inline mode with [@BotFather](https://telegram.me/BotFather).
## Pure API
The [`echobot.py`](https://github.com/python-telegram-bot/python-telegram-bot/blob/master/examples/echobot.py) example uses only the pure, "bare-metal" API wrapper.
Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

+159
View File
@@ -0,0 +1,159 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Simple Bot to reply to Telegram messages
# This program is dedicated to the public domain under the CC0 license.
"""
This Bot uses the Updater class to handle the bot.
First, a few callback functions are defined. Then, those functions are passed to
the Dispatcher and registered at their respective places.
Then, the bot is started and runs until we press Ctrl-C on the command line.
Usage:
Example of a bot-user conversation using ConversationHandler.
Send /start to initiate the conversation.
Press Ctrl-C on the command line or send a signal to the process to stop the
bot.
"""
from telegram import (ReplyKeyboardMarkup, ReplyKeyboardRemove)
from telegram.ext import (Updater, CommandHandler, MessageHandler, Filters, RegexHandler,
ConversationHandler)
import logging
# Enable logging
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
level=logging.INFO)
logger = logging.getLogger(__name__)
GENDER, PHOTO, LOCATION, BIO = range(4)
def start(bot, update):
reply_keyboard = [['Boy', 'Girl', 'Other']]
update.message.reply_text(
'Hi! My name is Professor Bot. I will hold a conversation with you. '
'Send /cancel to stop talking to me.\n\n'
'Are you a boy or a girl?',
reply_markup=ReplyKeyboardMarkup(reply_keyboard, one_time_keyboard=True))
return GENDER
def gender(bot, update):
user = update.message.from_user
logger.info("Gender of %s: %s" % (user.first_name, update.message.text))
update.message.reply_text('I see! Please send me a photo of yourself, '
'so I know what you look like, or send /skip if you don\'t want to.',
reply_markup=ReplyKeyboardRemove())
return PHOTO
def photo(bot, update):
user = update.message.from_user
photo_file = bot.get_file(update.message.photo[-1].file_id)
photo_file.download('user_photo.jpg')
logger.info("Photo of %s: %s" % (user.first_name, 'user_photo.jpg'))
update.message.reply_text('Gorgeous! Now, send me your location please, '
'or send /skip if you don\'t want to.')
return LOCATION
def skip_photo(bot, update):
user = update.message.from_user
logger.info("User %s did not send a photo." % user.first_name)
update.message.reply_text('I bet you look great! Now, send me your location please, '
'or send /skip.')
return LOCATION
def location(bot, update):
user = update.message.from_user
user_location = update.message.location
logger.info("Location of %s: %f / %f"
% (user.first_name, user_location.latitude, user_location.longitude))
update.message.reply_text('Maybe I can visit you sometime! '
'At last, tell me something about yourself.')
return BIO
def skip_location(bot, update):
user = update.message.from_user
logger.info("User %s did not send a location." % user.first_name)
update.message.reply_text('You seem a bit paranoid! '
'At last, tell me something about yourself.')
return BIO
def bio(bot, update):
user = update.message.from_user
logger.info("Bio of %s: %s" % (user.first_name, update.message.text))
update.message.reply_text('Thank you! I hope we can talk again some day.')
return ConversationHandler.END
def cancel(bot, update):
user = update.message.from_user
logger.info("User %s canceled the conversation." % user.first_name)
update.message.reply_text('Bye! I hope we can talk again some day.',
reply_markup=ReplyKeyboardRemove())
return ConversationHandler.END
def error(bot, update, error):
logger.warn('Update "%s" caused error "%s"' % (update, error))
def main():
# Create the EventHandler and pass it your bot's token.
updater = Updater("TOKEN")
# Get the dispatcher to register handlers
dp = updater.dispatcher
# Add conversation handler with the states GENDER, PHOTO, LOCATION and BIO
conv_handler = ConversationHandler(
entry_points=[CommandHandler('start', start)],
states={
GENDER: [RegexHandler('^(Boy|Girl|Other)$', gender)],
PHOTO: [MessageHandler(Filters.photo, photo),
CommandHandler('skip', skip_photo)],
LOCATION: [MessageHandler(Filters.location, location),
CommandHandler('skip', skip_location)],
BIO: [MessageHandler(Filters.text, bio)]
},
fallbacks=[CommandHandler('cancel', cancel)]
)
dp.add_handler(conv_handler)
# log all errors
dp.add_error_handler(error)
# Start the Bot
updater.start_polling()
# Run the bot until you press Ctrl-C or the process receives SIGINT,
# SIGTERM or SIGABRT. This should be used most of the time, since
# start_polling() is non-blocking and will stop the bot gracefully.
updater.idle()
if __name__ == '__main__':
main()
Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

+152
View File
@@ -0,0 +1,152 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Simple Bot to reply to Telegram messages
# This program is dedicated to the public domain under the CC0 license.
"""
This Bot uses the Updater class to handle the bot.
First, a few callback functions are defined. Then, those functions are passed to
the Dispatcher and registered at their respective places.
Then, the bot is started and runs until we press Ctrl-C on the command line.
Usage:
Example of a bot-user conversation using ConversationHandler.
Send /start to initiate the conversation.
Press Ctrl-C on the command line or send a signal to the process to stop the
bot.
"""
from telegram import ReplyKeyboardMarkup
from telegram.ext import (Updater, CommandHandler, MessageHandler, Filters, RegexHandler,
ConversationHandler)
import logging
# Enable logging
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
level=logging.INFO)
logger = logging.getLogger(__name__)
CHOOSING, TYPING_REPLY, TYPING_CHOICE = range(3)
reply_keyboard = [['Age', 'Favourite colour'],
['Number of siblings', 'Something else...'],
['Done']]
markup = ReplyKeyboardMarkup(reply_keyboard, one_time_keyboard=True)
def facts_to_str(user_data):
facts = list()
for key, value in user_data.items():
facts.append('%s - %s' % (key, value))
return "\n".join(facts).join(['\n', '\n'])
def start(bot, update):
update.message.reply_text(
"Hi! My name is Doctor Botter. I will hold a more complex conversation with you. "
"Why don't you tell me something about yourself?",
reply_markup=markup)
return CHOOSING
def regular_choice(bot, update, user_data):
text = update.message.text
user_data['choice'] = text
update.message.reply_text('Your %s? Yes, I would love to hear about that!' % text.lower())
return TYPING_REPLY
def custom_choice(bot, update):
update.message.reply_text('Alright, please send me the category first, '
'for example "Most impressive skill"')
return TYPING_CHOICE
def received_information(bot, update, user_data):
text = update.message.text
category = user_data['choice']
user_data[category] = text
del user_data['choice']
update.message.reply_text("Neat! Just so you know, this is what you already told me:"
"%s"
"You can tell me more, or change your opinion on something."
% facts_to_str(user_data),
reply_markup=markup)
return CHOOSING
def done(bot, update, user_data):
if 'choice' in user_data:
del user_data['choice']
update.message.reply_text("I learned these facts about you:"
"%s"
"Until next time!" % facts_to_str(user_data))
user_data.clear()
return ConversationHandler.END
def error(bot, update, error):
logger.warn('Update "%s" caused error "%s"' % (update, error))
def main():
# Create the Updater and pass it your bot's token.
updater = Updater("TOKEN")
# Get the dispatcher to register handlers
dp = updater.dispatcher
# Add conversation handler with the states GENDER, PHOTO, LOCATION and BIO
conv_handler = ConversationHandler(
entry_points=[CommandHandler('start', start)],
states={
CHOOSING: [RegexHandler('^(Age|Favourite colour|Number of siblings)$',
regular_choice,
pass_user_data=True),
RegexHandler('^Something else...$',
custom_choice),
],
TYPING_CHOICE: [MessageHandler(Filters.text,
regular_choice,
pass_user_data=True),
],
TYPING_REPLY: [MessageHandler(Filters.text,
received_information,
pass_user_data=True),
],
},
fallbacks=[RegexHandler('^Done$', done, pass_user_data=True)]
)
dp.add_handler(conv_handler)
# log all errors
dp.add_error_handler(error)
# Start the Bot
updater.start_polling()
# Run the bot until you press Ctrl-C or the process receives SIGINT,
# SIGTERM or SIGABRT. This should be used most of the time, since
# start_polling() is non-blocking and will stop the bot gracefully.
updater.idle()
if __name__ == '__main__':
main()
+28 -43
View File
@@ -1,65 +1,50 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Simple Bot to reply Telegram messages
# Copyright (C) 2015 Leandro Toledo de Souza <leandrotoeldodesouza@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see [http://www.gnu.org/licenses/].
# Simple Bot to reply to Telegram messages. This is built on the API wrapper, see
# echobot2.py to see the same example built on the telegram.ext bot framework.
# This program is dedicated to the public domain under the CC0 license.
import logging
import telegram
from telegram.error import NetworkError, Unauthorized
from time import sleep
LAST_UPDATE_ID = None
update_id = None
def main():
global LAST_UPDATE_ID
logging.basicConfig(
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
global update_id
# Telegram Bot Authorization Token
bot = telegram.Bot('TOKEN')
# This will be our global variable to keep the latest update_id when requesting
# for updates. It starts with the latest update_id if available.
# get the first pending update_id, this is so we can skip over it in case
# we get an "Unauthorized" exception.
try:
LAST_UPDATE_ID = bot.getUpdates()[-1].update_id
update_id = bot.get_updates()[0].update_id
except IndexError:
LAST_UPDATE_ID = None
update_id = None
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
while True:
echo(bot)
try:
echo(bot)
except NetworkError:
sleep(1)
except Unauthorized:
# The user has removed or blocked the bot.
update_id += 1
def echo(bot):
global LAST_UPDATE_ID
global update_id
# Request updates after the last update_id
for update in bot.get_updates(offset=update_id, timeout=10):
update_id = update.update_id + 1
# Request updates after the last updated_id
for update in bot.getUpdates(offset=LAST_UPDATE_ID, timeout=10):
# chat_id is required to reply any message
chat_id = update.message.chat_id
message = update.message.text.encode('utf-8')
if (message):
# Reply the message
bot.sendMessage(chat_id=chat_id,
text=message)
# Updates global offset to get the new updates
LAST_UPDATE_ID = update.update_id + 1
if update.message: # your bot can receive updates without messages
# Reply to the message
update.message.reply_text(update.message.text)
if __name__ == '__main__':
+74
View File
@@ -0,0 +1,74 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Simple Bot to reply to Telegram messages
# This program is dedicated to the public domain under the CC0 license.
"""
This Bot uses the Updater class to handle the bot.
First, a few handler functions are defined. Then, those functions are passed to
the Dispatcher and registered at their respective places.
Then, the bot is started and runs until we press Ctrl-C on the command line.
Usage:
Basic Echobot example, repeats messages.
Press Ctrl-C on the command line or send a signal to the process to stop the
bot.
"""
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters
import logging
# Enable logging
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
level=logging.INFO)
logger = logging.getLogger(__name__)
# Define a few command handlers. These usually take the two arguments bot and
# update. Error handlers also receive the raised TelegramError object in error.
def start(bot, update):
update.message.reply_text('Hi!')
def help(bot, update):
update.message.reply_text('Help!')
def echo(bot, update):
update.message.reply_text(update.message.text)
def error(bot, update, error):
logger.warn('Update "%s" caused error "%s"' % (update, error))
def main():
# Create the EventHandler and pass it your bot's token.
updater = Updater("TOKEN")
# Get the dispatcher to register handlers
dp = updater.dispatcher
# on different commands - answer in Telegram
dp.add_handler(CommandHandler("start", start))
dp.add_handler(CommandHandler("help", help))
# on noncommand i.e message - echo the message on Telegram
dp.add_handler(MessageHandler(Filters.text, echo))
# log all errors
dp.add_error_handler(error)
# Start the Bot
updater.start_polling()
# Run the bot until you press Ctrl-C or the process receives SIGINT,
# SIGTERM or SIGABRT. This should be used most of the time, since
# start_polling() is non-blocking and will stop the bot gracefully.
updater.idle()
if __name__ == '__main__':
main()
+105
View File
@@ -0,0 +1,105 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Simple Bot to reply to Telegram messages
# This program is dedicated to the public domain under the CC0 license.
"""
This Bot uses the Updater class to handle the bot.
First, a few handler functions are defined. Then, those functions are passed to
the Dispatcher and registered at their respective places.
Then, the bot is started and runs until we press Ctrl-C on the command line.
Usage:
Basic inline bot example. Applies different text transformations.
Press Ctrl-C on the command line or send a signal to the process to stop the
bot.
"""
from uuid import uuid4
import re
from telegram import InlineQueryResultArticle, ParseMode, \
InputTextMessageContent
from telegram.ext import Updater, InlineQueryHandler, CommandHandler
import logging
# Enable logging
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
level=logging.INFO)
logger = logging.getLogger(__name__)
# Define a few command handlers. These usually take the two arguments bot and
# update. Error handlers also receive the raised TelegramError object in error.
def start(bot, update):
update.message.reply_text('Hi!')
def help(bot, update):
update.message.reply_text('Help!')
def escape_markdown(text):
"""Helper function to escape telegram markup symbols"""
escape_chars = '\*_`\['
return re.sub(r'([%s])' % escape_chars, r'\\\1', text)
def inlinequery(bot, update):
query = update.inline_query.query
results = list()
results.append(InlineQueryResultArticle(id=uuid4(),
title="Caps",
input_message_content=InputTextMessageContent(
query.upper())))
results.append(InlineQueryResultArticle(id=uuid4(),
title="Bold",
input_message_content=InputTextMessageContent(
"*%s*" % escape_markdown(query),
parse_mode=ParseMode.MARKDOWN)))
results.append(InlineQueryResultArticle(id=uuid4(),
title="Italic",
input_message_content=InputTextMessageContent(
"_%s_" % escape_markdown(query),
parse_mode=ParseMode.MARKDOWN)))
update.inline_query.answer(results)
def error(bot, update, error):
logger.warning('Update "%s" caused error "%s"' % (update, error))
def main():
# Create the Updater and pass it your bot's token.
updater = Updater("TOKEN")
# Get the dispatcher to register handlers
dp = updater.dispatcher
# on different commands - answer in Telegram
dp.add_handler(CommandHandler("start", start))
dp.add_handler(CommandHandler("help", help))
# on noncommand i.e message - echo the message on Telegram
dp.add_handler(InlineQueryHandler(inlinequery))
# log all errors
dp.add_error_handler(error)
# Start the Bot
updater.start_polling()
# Block until the user presses Ctrl-C or the process receives SIGINT,
# SIGTERM or SIGABRT. This should be used most of the time, since
# start_polling() is non-blocking and will stop the bot gracefully.
updater.idle()
if __name__ == '__main__':
main()
+55
View File
@@ -0,0 +1,55 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Basic example for a bot that uses inline keyboards.
# This program is dedicated to the public domain under the CC0 license.
import logging
from telegram import InlineKeyboardButton, InlineKeyboardMarkup
from telegram.ext import Updater, CommandHandler, CallbackQueryHandler
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
level=logging.INFO)
def start(bot, update):
keyboard = [[InlineKeyboardButton("Option 1", callback_data='1'),
InlineKeyboardButton("Option 2", callback_data='2')],
[InlineKeyboardButton("Option 3", callback_data='3')]]
reply_markup = InlineKeyboardMarkup(keyboard)
update.message.reply_text('Please choose:', reply_markup=reply_markup)
def button(bot, update):
query = update.callback_query
bot.edit_message_text(text="Selected option: %s" % query.data,
chat_id=query.message.chat_id,
message_id=query.message.message_id)
def help(bot, update):
update.message.reply_text("Use /start to test this bot.")
def error(bot, update, error):
logging.warning('Update "%s" caused error "%s"' % (update, error))
# Create the Updater and pass it your bot's token.
updater = Updater("TOKEN")
updater.dispatcher.add_handler(CommandHandler('start', start))
updater.dispatcher.add_handler(CallbackQueryHandler(button))
updater.dispatcher.add_handler(CommandHandler('help', help))
updater.dispatcher.add_error_handler(error)
# Start the Bot
updater.start_polling()
# Run the bot until the user presses Ctrl-C or the process receives SIGINT,
# SIGTERM or SIGABRT
updater.idle()
-54
View File
@@ -1,54 +0,0 @@
#!/usr/bin/env python
# encoding: utf-8
#
# Robô Ed Telegram Bot
# Copyright (C) 2015 Leandro Toledo de Souza <leandrotoeldodesouza@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see [http://www.gnu.org/licenses/].
__author__ = 'leandrotoledodesouza@gmail.com'
import logging
import telegram
import urllib
def main():
logging.basicConfig(
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
bot = telegram.Bot('TOKEN') # Telegram Bot Authorization Token
LAST_UPDATE_ID = bot.getUpdates()[-1].update_id # Get lastest update
while True:
for update in bot.getUpdates(offset=LAST_UPDATE_ID, timeout=10):
text = update.message.text
chat_id = update.message.chat.id
update_id = update.update_id
if text:
roboed = ed(text) # Ask something to Robô Ed
bot.sendMessage(chat_id=chat_id, text=roboed)
LAST_UPDATE_ID = update_id + 1
def ed(text):
url = 'http://www.ed.conpet.gov.br/mod_perl/bot_gateway.cgi?server=0.0.0.0%3A8085&charset_post=utf-8&charset=utf-8&pure=1&js=0&tst=1&msg=' + text
data = urllib.urlopen(url).read()
return data.strip()
if __name__ == '__main__':
main()
+107
View File
@@ -0,0 +1,107 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Simple Bot to send timed Telegram messages
# This program is dedicated to the public domain under the CC0 license.
"""
This Bot uses the Updater class to handle the bot and the JobQueue to send
timed messages.
First, a few handler functions are defined. Then, those functions are passed to
the Dispatcher and registered at their respective places.
Then, the bot is started and runs until we press Ctrl-C on the command line.
Usage:
Basic Alarm Bot example, sends a message after a set time.
Press Ctrl-C on the command line or send a signal to the process to stop the
bot.
"""
from telegram.ext import Updater, CommandHandler, Job
import logging
# Enable logging
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
level=logging.INFO)
logger = logging.getLogger(__name__)
# Define a few command handlers. These usually take the two arguments bot and
# update. Error handlers also receive the raised TelegramError object in error.
def start(bot, update):
update.message.reply_text('Hi! Use /set <seconds> to set a timer')
def alarm(bot, job):
"""Function to send the alarm message"""
bot.send_message(job.context, text='Beep!')
def set(bot, update, args, job_queue, chat_data):
"""Adds a job to the queue"""
chat_id = update.message.chat_id
try:
# args[0] should contain the time for the timer in seconds
due = int(args[0])
if due < 0:
update.message.reply_text('Sorry we can not go back to future!')
return
# Add job to queue
job = job_queue.run_once(alarm, due, context=chat_id)
chat_data['job'] = job
update.message.reply_text('Timer successfully set!')
except (IndexError, ValueError):
update.message.reply_text('Usage: /set <seconds>')
def unset(bot, update, chat_data):
"""Removes the job if the user changed their mind"""
if 'job' not in chat_data:
update.message.reply_text('You have no active timer')
return
job = chat_data['job']
job.schedule_removal()
del chat_data['job']
update.message.reply_text('Timer successfully unset!')
def error(bot, update, error):
logger.warning('Update "%s" caused error "%s"' % (update, error))
def main():
updater = Updater("TOKEN")
# Get the dispatcher to register handlers
dp = updater.dispatcher
# on different commands - answer in Telegram
dp.add_handler(CommandHandler("start", start))
dp.add_handler(CommandHandler("help", start))
dp.add_handler(CommandHandler("set", set,
pass_args=True,
pass_job_queue=True,
pass_chat_data=True))
dp.add_handler(CommandHandler("unset", unset, pass_chat_data=True))
# log all errors
dp.add_error_handler(error)
# Start the Bot
updater.start_polling()
# Block until you press Ctrl-C or the process receives SIGINT, SIGTERM or
# SIGABRT. This should be used most of the time, since start_polling() is
# non-blocking and will stop the bot gracefully.
updater.idle()
if __name__ == '__main__':
main()
+8
View File
@@ -0,0 +1,8 @@
flake8
nose
pep257
pylint
flaky
yapf
pre-commit
pre-commit-hooks
+2
View File
@@ -0,0 +1,2 @@
future>=0.15.2
certifi

Some files were not shown because too many files have changed in this diff Show More