Commit graph

197 commits

Author SHA1 Message Date
Ihor Polyakov
08d298eb60 TelegramObject.de_json became classmethod (#737)
Fixes #734
2017-07-23 22:14:38 +03:00
Jacob Bom
5a37af6f89 Bot api 3.2 (#732)
NOTE: Currently not testing StickerSet in terms of bot methods (interaction with telegrams servers) as there's no delete operations.
2017-07-22 14:34:51 +03:00
Jacob Bom
94ed4cb38d Bot api 3.1 (#698) + minor improvements
- Added all the new and shiny features from API 3.1.
 - Not API 3.1 changes:
   - Use future.utils.string_types for string isinstance checks.
   - Stall between retries of test_set_webhook_get_webhook_info() &
     test_delete_webhook().
2017-07-01 18:08:45 +03:00
Jacob Bom
0afe83ac30 Merge branch 'master' into official-test 2017-06-20 21:42:33 +02:00
Jacob Bom
faddb92395 Clean up Bot code a bit (#673)
* Clean up Bot code a bit

- Move decorators to module. It really wasn't clear how decorators inside classes work, and why they didn't have a self parameter, but still wasn't static. This also makes them effectively private without having to underscore them, which I think we should have done long time ago atm. Note that this might break backwards compatibility slightly (only if people are daft enough to have used the decorators themselves)
- Don't call _message_wrapper directly. Ever. Instead always use the message decorator, since it's what it's there for. Closes #627
- Don't use the message decorator if the method isn't supposed to return a message. The decorator could handle values like True (which is often the return value), but to someone reading the code, it seems like it's a message returning method even when it wasn't.
- Always document timeout and **kwargs
- Log all methods

* Add test to make sure timeout propagates properly despite decorators
2017-06-18 12:14:24 +02:00
saschalalala
9b5e014a0a Simplification of boolean checks (#662)
* Simplification of boolean checks

* Cast ok to bool for Telegram API json encoding
2017-06-18 12:09:32 +02:00
Jacob Bom
9b84a558fb Fix width+height in sendVideo + game in Message
First errors found by the official test thingy
2017-06-14 13:48:45 +02:00
saschalalala
3863b4f371 Rename shortcut functions to snake_case (#661)
* Rename shortcut functions to snake_case

* More function renaming

* Example function rewrite

* Add myself to authors.rst

* More function renaming

* Rename mockbot test functions

* Break comment line for flake max line length
2017-06-14 00:07:03 +02:00
alateas
6877886f7d Change hard-coded 20. to timeout parameter (#663)
* Change hard-coded 20. to timeout paramter

Passing timeout parameter to _message_wrapper in send_audio instead of hard-coded 20 seconds

* add myself to contributors
2017-06-14 00:01:38 +02:00
Jeff
a68e0ad044 bugfixes on error in answer_shipping_query and answer_precheckout_query 2017-06-11 03:45:48 +08:00
Jeff
4247dc0e21 tiny changes upon PR review 2017-06-08 09:47:19 +08:00
Jeff
e9d08c6f7a Merge branch 'master' into paymenthandlers-new
# Conflicts:
#	telegram/bot.py
#	telegram/message.py
#	telegram/precheckoutquery.py
#	telegram/shippingquery.py
2017-06-03 01:09:17 +08:00
Noam Meltzer
137ffe2e73 Merge remote-tracking branch 'origin/master' into payment 2017-06-01 22:01:04 +03:00
Noam Meltzer
cd24bb4ba5 payment: Small fixes
- Semantic fixes bot.py (if XXX is not None: ...).
 - Documentation fixes (arguments which are optional).
2017-05-26 20:02:18 +03:00
Noam Meltzer
a5bfc52326 videonote: Semantic fix according to CR 2017-05-26 18:36:21 +03:00
Jacob Bom
a7044562af Fix stuff as per @tsnoam's comments 2017-05-25 14:16:53 +02:00
Jeff
f314915954 fix typo again 2017-05-23 16:26:04 +08:00
Jeff
1bf0078573 add missing "need_email" in sendInvoice, fix pep8/flake 2017-05-23 16:21:45 +08:00
Jeff
43f4128b31 fix answer* methods not sending api requests 2017-05-22 22:55:19 +08:00
Jeff
1142953108 add checks for answer* methods 2017-05-22 22:47:35 +08:00
Jeff
1e250f2415 add kwargs to answer* methods 2017-05-22 21:37:15 +08:00
Jeff
8f2f29c7d4 fix typo, add bot and kwargs to class init 2017-05-22 21:32:42 +08:00
Jacob Bom
48fa3d975b Merge branch 'videonote' into beta
# Conflicts:
#	telegram/__init__.py
#	telegram/message.py
2017-05-21 15:45:20 +02:00
Jacob Bom
2746ab77e5 Add sendVideoNote to Bot 2017-05-20 19:35:55 +02:00
Jacob Bom
76db279624 We have to send and array... that's new... 2017-05-20 18:46:39 +02:00
Jacob Bom
834c1ab3c5 Merge branch 'master' into payment 2017-05-19 20:25:46 +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
Jacob Bom
8be57198b4 New payment bot methods
sendInvoice, answerShippingQuery, and answerPreCheckoutQuery
2017-05-19 19:46:42 +02:00
evgfilim1
578627feca Fixed and added some type hints in docstrings 2017-05-17 21:41:08 +05: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
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
Rahiel Kasim
9f3afa5fa2 prefer snake_case for telegram.Bot methods 2017-05-07 16:09:58 +02:00
Noam Meltzer
4c8d1c9a5e Fix Bot.sendDocument 2017-03-11 23:55:26 +02:00
Noam Meltzer
2b930c221d Sane default for sending files timeout 2017-03-11 16:23:43 +02: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
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
Jacob Bom
27b2fd64b7 More IDE friendliness 2017-01-09 19:29:05 +01:00
Noam Meltzer
bd96771a7a Fix typo 2017-01-07 23:05:58 +02:00
Noam Meltzer
58dddfd9c3 Control the read timeout from telegram servers
refs #495
refs #364
2017-01-07 20:13:08 +02: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
92dc9b81ce bot.py: implement changes of december 04 (bot api 2.3.1) 2016-12-14 00:50:34 +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
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
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
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
b610316667 Use explicit kwargs for all bot methods.
This improves support for many IDEs' autocompletion.
2016-10-16 15:54:48 +02:00