Jacob Bom
3244417f61
Add docs for filters.
2016-09-25 00:30:04 +02:00
Jacob Bom
61596400e1
__call__ should return the result
...
Also add tests with both & and |.
2016-09-24 18:56:54 +02:00
Jacob Bom
be0f5bc519
Merge branch 'master' into bitwise-filters
...
# Conflicts:
# telegram/ext/messagehandler.py
# tests/test_filters.py
2016-09-24 18:30:58 +02:00
Jacob Bom
2161681131
Use filter method instead of __call__
...
__call__ is scary looking for users wanted to create their own filters.
Also allows us to put additional logic in __call__ if we want in the future.
2016-09-24 18:20:32 +02:00
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
Eli Gao
a91fe5f8f6
Properly split and handle arguments in CommandHandler ( #414 )
...
* Properly split and handle arguments in CommandHandler
* Update the docstring for pass_args in CommandHandler
* Properly split and handle arguments in StringCommandHandler
2016-09-20 06:38:49 +02:00
Jannes Höke
5116a77221
Class methods ( #362 )
...
* bot.py: add create_references method
* create bot reference in webhook handler, use create_references on new updates
* message.py: implement reply_text
* echobot2.py: use Message.reply_text
* fix create_references in webhook handler
* add some more instance methods
* Chat.kick_member and unban_member
* bot.py: Create bot references in outgoing messages
* add tests for everything testable
* test_updater.py: add create_references method to MockBot
* remove Bot.create_references and refactor TelegramObject.de_json to take the additional parameter bot
* List bot as named kwarg where used
* file.py: Use Bot.request property instead of Bot._request attr
2016-09-20 06:36:55 +02:00
Jannes Höke
1efd330e59
ConversationHandler: Fix #373
2016-09-20 05:00:39 +02:00
Jannes Höke
af3e8c6440
Merge branch 'master' of https://github.com/LiaungYip/python-telegram-bot into LiaungYip-master
2016-09-20 04:10:39 +02:00
Jacob Bom
71e74da0a2
Make filters and/or-able using bitwise operators.
...
See associated PR for more info.
2016-09-14 19:29:15 +02:00
Jacob Bom
97bb04cd38
Faulty example was faulty.
2016-09-13 20:50:25 +02:00
Jacob Bom
f7b497c1b4
Fix in keyword ordering
...
We're testing for a string in list, not the other way around :P
2016-09-13 20:45:42 +02:00
Jacob Bom
4e60008086
Add entities filter
...
Should ideally superseed #375 .
2016-09-13 20:09:46 +02:00
Noam Meltzer
e4a132c0e4
Reusable dispatcher ( #402 )
...
* Create a Request class which maintains its own connection pool
* When creating a Bot instance a new Request instance will be created if one wasn't supplied.
* Updater is responsible for creating a Request instance if a Bot instance wasn't provided.
* Dispatcher: add method to run async functions without decorator
* Dispatcher can now run as a singleton (allowing run_async decorator to work) as it always did and as multiple instances (where run_async decorator will raise RuntimeError)
2016-09-06 16:38:07 +03:00
Rahiel Kasim
da87d4ba78
fix yapf
2016-08-26 11:17:05 +02:00
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
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
Jacob Bom
32268597d9
Wrap long lines
2016-08-06 14:19:41 +02:00
Jacob Bom
cd2f956e56
Also fix linebreak ^^
2016-08-06 13:35:58 +02:00
Jacob Bom
18fdb5ed13
Fix weird indent.
2016-08-06 13:35:06 +02:00
Jacob Bom
8c698caa12
Add Regex handling to CallbackQueryHandler and InlineQueryHandler.
...
Mostly a copy-paste from RegexHandler.
Not fully tested! Also needs yapf - sorry.
2016-08-06 13:33:38 +02:00
Jannes Höke
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
Noam Meltzer
d192b385ea
dispatcher: add comment to describe the reason for conpool size
2016-07-12 21:58:27 +03:00
Jannes Höke
31073101a3
yapf
2016-06-24 19:22:49 +02:00
Noam Meltzer
1e0ebe89f3
JobQueue: minimize the amount of places changing self.__tick state
...
- start the jobqueue (by default) during __init__() instead of during
put()
- protect self._next_peek and self.__tick with a Lock
- rename self._start() to self._main_loop()
- stop() is now blocking until the event loop thread exits
2016-06-24 19:35:54 +03:00
Noam Meltzer
f65b6911ea
JobQueue: use class name for the logger name
2016-06-24 19:13:40 +03:00
Noam Meltzer
02af1ea803
jobqueue: cosmetic fixes
2016-06-24 19:13:40 +03:00
Jannes Höke
c4a8ee5175
Merge branch 'master' into jobqueue-rework
...
Conflicts:
tests/test_jobqueue.py
2016-06-20 05:32:15 +02:00
Jannes Höke
7635bc0eec
comments, lock thread pool, while 1 and snake_case everywhere
2016-06-19 23:46:34 +02:00
Noam Meltzer
5b91194cc7
new yapf version, new cosmetic fixes
2016-06-18 20:05:10 +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
bda0244ed8
updater: fix print in log
2016-06-17 16:52:25 +03:00
Noam Meltzer
3608c2bbe5
dispatcher: if connection pool is already initialized raise exception
...
this will better protect the user from wrong usage
2016-06-01 22:30:34 +03:00
Noam Meltzer
c28763c5be
dispatcher: cosmetic fix
2016-06-01 22:30:33 +03:00
Noam Meltzer
dd8b6219b9
dispatcher: a little performance improvment
2016-06-01 22:30:33 +03:00
Noam Meltzer
78f9bdcac9
dispatcher: pep8 style fix
...
globals are supposed to be upper case
2016-06-01 22:30:09 +03:00
Jannes Höke
b08d41d0ff
formatting
2016-05-31 15:35:40 +02:00
Jannes Höke
de2d732135
Merge branch 'master' into jobqueue-rework
...
Conflicts:
README.rst
telegram/ext/commandhandler.py
telegram/ext/messagehandler.py
2016-05-31 15:34:36 +02:00
Jannes Höke
1ff348adbb
issue warning if connection pool was initialized before Dispatcher
2016-05-31 13:47:43 +02:00
Jannes Höke
41f6591ac6
more sensible logging
2016-05-30 17:12:27 +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
7e7acdeb23
set default network_delay to 5 seconds
...
fixes #309
2016-05-28 19:34:16 +03: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
Jannes Höke
a0bb5730c6
add allow_edited parameter to MessageHandler and CommandHandler
2016-05-27 11:07:06 +02:00
Jannes Höke
bb165b6acf
add pass_job_queue parameter to all handler classes
2016-05-26 14:39:11 +02:00
Jannes Höke
41daccce07
minor comments and formatting
2016-05-26 14:02:52 +02:00
Jannes Höke
786216305c
Add context parameter in Job class #281
2016-05-26 13:55:56 +02:00
Jannes Höke
b3142d2974
yapf
2016-05-25 23:57:29 +02:00
Jannes Höke
3aedd78e29
make job queue API similar to the dispatcher, add new functionality
2016-05-25 23:36:41 +02:00
leandrotoledo
c7db9a96cd
Set split_before_logical_operator to True
2016-05-23 17:19:35 -03:00
Jannes Höke
4d770843cc
use non-deprecated methods
2016-05-16 15:02:51 +02:00
Leandro Toledo
d445d35ceb
Running yapf for codebase #259
2016-05-14 22:46:40 -03:00
Leandro Toledo
56b1d4f5ce
Merge pull request #265 from python-telegram-bot/snakes
...
rename methods to snake_case
2016-05-14 10:56:24 -03:00
Jannes Höke
6ec81dd552
move cleaning updates to bootstrapping phase ( #282 )
2016-05-11 00:58:55 +03: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
ec15e866be
add snake_case aliases for CamelCase methods
2016-04-28 12:20:42 +02: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
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
05a90dc3bc
regexhandler/stringregexhandler: python2 utf8 support
2016-04-26 17:47:37 +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
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
Jannes Höke
c0dd9c6ffc
always set webhook_url
2016-04-21 12:57:03 +02:00
Jannes Höke
1db337fe2b
Merge branch 'master' into dispatcher-rework
2016-04-18 21:23:14 +02:00
Jannes Höke
0d9d5032ef
exit immediately if receiving second interrupt #224
2016-04-18 19:21:57 +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
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
b2045717d6
Merge branch 'bot-api-2.0' into dispatcher-rework
2016-04-16 18:18:37 +02:00
Jannes Höke
d2f2b74bdb
imports and classname fix
2016-04-16 16:54:07 +02:00
Jannes Höke
0d0ad1334c
add documentation and minor stuff
2016-04-16 16:36:12 +02:00
Jannes Höke
95fde0c6c4
create missing handler types and minor fixes
2016-04-16 15:21:19 +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
Rahiel Kasim
01b90e7ede
small improvements
2016-04-02 23:13:49 +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
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
Jannes Höke
63a83d4cc2
fix imports of updatequeue
2016-03-22 02:48:56 +01:00
Jannes Höke
45a47d54bd
move updatequeue to telegram.utils
2016-03-22 02:42:19 +01: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
1e4ae6546f
Changing INFO logs to DEBUG and minor fixes
2016-03-14 22:56:20 -03: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