Commit graph

33 commits

Author SHA1 Message Date
Noam Meltzer
470ee86497 Merge pull request #677 from evgfilim1/new-filters
New filters for handling messages from specific chat/user id
2017-06-22 21:25:39 +03:00
evgfilim1
7e81a1510d Added ability to process list of ids/usernames 2017-06-22 15:19:49 +05:00
evgfilim1
ca9068f2b5 Simplified if statement, fixed docs 2017-06-22 13:39:41 +05:00
Jacob Bom
04acbc4117 Remove the need for calling super() in filters 2017-06-21 13:46:03 +02:00
Jacob Bom
6cc84b2c32 Only write repr as str will invoke it implicitly 2017-06-20 21:41:23 +02:00
evgfilim1
9bccbdab2a Added ability to filter by username 2017-06-20 12:43:07 +05:00
Jacob Bom
a964b7bfd0 Okay, so not even *args followed by a kwarg is allowed on py2...
So just remove it for now. Better than doing annoying stuff with parsing a **kwargs dict in my opinion. It didn't even *really* need to be kwarg only anyways I guess...
2017-06-19 21:46:34 +02:00
evgfilim1
5a62255675 Added new filters for handling specific chat id and user id 2017-06-19 22:50:44 +05:00
Jacob Bom
2b871e6f93 * for keyword only arguments isn't supported on py2 it seems... 2017-06-18 16:22:59 +02:00
Jacob Bom
788b9dab0c Fill in super() calls 2017-06-18 16:03:32 +02:00
Jacob Bom
4c41f3870c Allow filters to have a name.
So their string representation is user friendly.
2017-06-18 15:28:48 +02:00
Noam Meltzer
137ffe2e73 Merge remote-tracking branch 'origin/master' into payment 2017-06-01 22:01:04 +03:00
evgfilim1
5b1252ac2d Perfomance optimizations
Using `or` instead of `|`
2017-06-01 16:36:32 +05:00
evgfilim1
d98b18d1e3 Added new status_update filters 2017-06-01 07:09:30 +05:00
Jacob Bom
f4c6197c5f Update filters to new_chat_members instead of new_chat_member 2017-05-25 14:45:47 +02:00
Jacob Bom
630b63ec10 Add payment filters 2017-05-22 12:13:00 +02:00
Jannes Höke
1c4c228cf1 add support for User.language_code (#624)
* add support for User.language_code

* Add language filter

Useful is you wanna do something like restrict your shop to a single or a few locales or something like that.
2017-05-21 14:00:53 +02: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
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
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
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
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
c626044a30 Add "all" filter
Since and empty list cannot (in the future, currently only deprecated) be used.
2016-10-15 22:58:55 +02:00
Jacob Bom
ca5e3146c6 Fix docstring according to Jannes' commentns. 2016-10-14 10:32:12 +02:00
Jacob Bom
79e065a730 Add __str__ and __repr__ to MergedFilter. 2016-09-25 16:31:06 +02:00
Jacob Bom
3244417f61 Add docs for filters. 2016-09-25 00:30:04 +02:00
Jacob Bom
61596400e1 __call__ should return the result
Also add tests with both & and |.
2016-09-24 18:56:54 +02:00
Jacob Bom
be0f5bc519 Merge branch 'master' into bitwise-filters
# Conflicts:
#	telegram/ext/messagehandler.py
#	tests/test_filters.py
2016-09-24 18:30:58 +02:00
Jacob Bom
2161681131 Use filter method instead of __call__
__call__ is scary looking for users wanted to create their own filters.
Also allows us to put additional logic in __call__ if we want in the future.
2016-09-24 18:20:32 +02:00
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
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
Jannes Höke
0d0ad1334c add documentation and minor stuff 2016-04-16 16:36:12 +02: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