We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
RegexHandler error with stickers, voices, images...
RegexHandler does not check if update.effective_message.text exists.

### Steps to reproduce
1. Add a RegexHandler
2. Run the bot
3. Send a sticker

### Expected behaviour
The handler should not capture the sticker

### Actual behaviour
The handler capture the sticker and gives an error

### Configuration
Does not matter


**Version of Python, python-telegram-bot & dependencies:**

``python-telegram-bot 7.0.0``

### Logs
2017-07-26 14:02:47,301 - telegram.ext.dispatcher - ERROR - An uncaught error was raised while processing the update
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/telegram/ext/dispatcher.py", line 269, in process_update
    if handler.check_update(update):
  File "/usr/local/lib/python3.5/dist-packages/telegram/ext/regexhandler.py", line 150, in check_update
    match = re.match(self.pattern, update.effective_message.text)
  File "/usr/lib/python3.5/re.py", line 163, in match
    return _compile(pattern, flags).match(string)
TypeError: expected string or bytes-like object


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `telegram/ext/regexhandler.py`
Content:
```
1 #!/usr/bin/env python
2 #
3 # A library that provides a Python interface to the Telegram Bot API
4 # Copyright (C) 2015-2017
5 # Leandro Toledo de Souza <devs@python-telegram-bot.org>
6 #
7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU Lesser Public License as published by
9 # the Free Software Foundation, either version 3 of the License, or
10 # (at your option) any later version.
11 #
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 # GNU Lesser Public License for more details.
16 #
17 # You should have received a copy of the GNU Lesser Public License
18 # along with this program.  If not, see [http://www.gnu.org/licenses/].
19 # TODO: Remove allow_edited
20 """ This module contains the RegexHandler class """
21 
22 import re
23 import warnings
24 
25 from future.utils import string_types
26 
27 from telegram import Update
28 from .handler import Handler
29 
30 
31 class RegexHandler(Handler):
32     """
33     Handler class to handle Telegram updates based on a regex. It uses a
34     regular expression to check text messages. Read the documentation of the
35     ``re`` module for more information. The ``re.match`` function is used to
36     determine if an update should be handled by this handler.
37 
38     Attributes:
39         pattern (:obj:`str` | :obj:`Pattern`): The regex pattern.
40         callback (:obj:`callable`): The callback function for this handler.
41         pass_groups (:obj:`bool`): Optional. Determines whether ``groups`` will be passed to the
42             callback function.
43         pass_groupdict (:obj:`bool`): Optional. Determines whether ``groupdict``. will be passed to
44             the callback function.
45         pass_update_queue (:obj:`bool`): Optional. Determines whether ``update_queue`` will be
46             passed to the callback function.
47         pass_job_queue (:obj:`bool`): Optional. Determines whether ``job_queue`` will be passed to
48             the callback function.
49         pass_user_data (:obj:`bool`): Optional. Determines whether ``user_data`` will be passed to
50             the callback function.
51         pass_chat_data (:obj:`bool`): Optional. Determines whether ``chat_data`` will be passed to
52             the callback function.
53 
54     Note:
55         :attr:`pass_user_data` and :attr:`pass_chat_data` determine whether a ``dict`` you
56         can use to keep any data in will be sent to the :attr:`callback` function.. Related to
57         either the user or the chat that the update was sent in. For each update from the same user
58         or in the same chat, it will be the same ``dict``.
59 
60     Args:
61         pattern (:obj:`str` | :obj:`Pattern`): The regex pattern.
62         callback (:obj:`callable`): A function that takes ``bot, update`` as positional arguments.
63             It will be called when the :attr:`check_update` has determined that an update should be
64             processed by this handler.
65         pass_groups (:obj:`bool`, optional): If the callback should be passed the result of
66             ``re.match(pattern, data).groups()`` as a keyword argument called ``groups``.
67             Default is ``False``
68         pass_groupdict (:obj:`bool`, optional): If the callback should be passed the result of
69             ``re.match(pattern, data).groupdict()`` as a keyword argument called ``groupdict``.
70             Default is ``False``
71         pass_update_queue (:obj:`bool`, optional): If set to ``True``, a keyword argument called
72             ``update_queue`` will be passed to the callback function. It will be the ``Queue``
73             instance used by the :class:`telegram.ext.Updater` and :class:`telegram.ext.Dispatcher`
74             that contains new updates which can be used to insert updates. Default is ``False``.
75         pass_job_queue (:obj:`bool`, optional): If set to ``True``, a keyword argument called
76             ``job_queue`` will be passed to the callback function. It will be a
77             :class:`telegram.ext.JobQueue` instance created by the :class:`telegram.ext.Updater`
78             which can be used to schedule new jobs. Default is ``False``.
79         pass_user_data (:obj:`bool`, optional): If set to ``True``, a keyword argument called
80             ``user_data`` will be passed to the callback function. Default is ``False``.
81         pass_chat_data (:obj:`bool`, optional): If set to ``True``, a keyword argument called
82             ``chat_data`` will be passed to the callback function. Default is ``False``.
83         message_updates (:obj:`bool`, optional): Should "normal" message updates be handled?
84             Default is ``True``.
85         channel_post_updates (:obj:`bool`, optional): Should channel posts updates be handled?
86             Default is ``True``.
87         edited_updates (:obj:`bool`, optional): Should "edited" message updates be handled? Default
88             is ``False``.
89         allow_edited (:obj:`bool`, optional): If the handler should also accept edited messages.
90             Default is ``False`` - Deprecated. use edited_updates instead.
91 
92     Raises:
93         ValueError
94     """
95 
96     def __init__(self,
97                  pattern,
98                  callback,
99                  pass_groups=False,
100                  pass_groupdict=False,
101                  pass_update_queue=False,
102                  pass_job_queue=False,
103                  pass_user_data=False,
104                  pass_chat_data=False,
105                  allow_edited=False,
106                  message_updates=True,
107                  channel_post_updates=False,
108                  edited_updates=False
109                  ):
110         if not message_updates and not channel_post_updates and not edited_updates:
111             raise ValueError(
112                 'message_updates, channel_post_updates and edited_updates are all False')
113         if allow_edited:
114             warnings.warn('allow_edited is getting deprecated, please use edited_updates instead')
115             edited_updates = allow_edited
116 
117         super(RegexHandler, self).__init__(
118             callback,
119             pass_update_queue=pass_update_queue,
120             pass_job_queue=pass_job_queue,
121             pass_user_data=pass_user_data,
122             pass_chat_data=pass_chat_data)
123 
124         if isinstance(pattern, string_types):
125             pattern = re.compile(pattern)
126 
127         self.pattern = pattern
128         self.pass_groups = pass_groups
129         self.pass_groupdict = pass_groupdict
130         self.allow_edited = allow_edited
131         self.message_updates = message_updates
132         self.channel_post_updates = channel_post_updates
133         self.edited_updates = edited_updates
134 
135     def check_update(self, update):
136         """
137         Determines whether an update should be passed to this handlers :attr:`callback`.
138 
139         Args:
140             update (:class:`telegram.Update`): Incoming telegram update.
141 
142         Returns:
143             :obj:`bool`
144         """
145 
146         if any([(self.message_updates and update.message),
147                 (self.edited_updates and update.edited_message),
148                 (self.channel_post_updates and update.channel_post)]) and (
149                 isinstance(update, Update)):
150             match = re.match(self.pattern, update.effective_message.text)
151             return bool(match)
152         return False
153 
154     def handle_update(self, update, dispatcher):
155         """
156         Send the update to the :attr:`callback`.
157 
158         Args:
159             update (:class:`telegram.Update`): Incoming telegram update.
160             dispatcher (:class:`telegram.ext.Dispatcher`): Dispatcher that originated the Update.
161         """
162 
163         optional_args = self.collect_optional_args(dispatcher, update)
164         match = re.match(self.pattern, update.effective_message.text)
165 
166         if self.pass_groups:
167             optional_args['groups'] = match.groups()
168         if self.pass_groupdict:
169             optional_args['groupdict'] = match.groupdict()
170 
171         return self.callback(dispatcher.bot, update, **optional_args)
172
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/telegram/ext/regexhandler.py b/telegram/ext/regexhandler.py
--- a/telegram/ext/regexhandler.py
+++ b/telegram/ext/regexhandler.py
@@ -142,11 +142,12 @@
         Returns:
             :obj:`bool`
         """
-
+        if not isinstance(update, Update) and not update.effective_message:
+            return False
         if any([(self.message_updates and update.message),
                 (self.edited_updates and update.edited_message),
-                (self.channel_post_updates and update.channel_post)]) and (
-                isinstance(update, Update)):
+                (self.channel_post_updates and update.channel_post)]) and \
+                update.effective_message.text:
             match = re.match(self.pattern, update.effective_message.text)
             return bool(match)
         return False

{"golden_diff": "diff --git a/telegram/ext/regexhandler.py b/telegram/ext/regexhandler.py\n--- a/telegram/ext/regexhandler.py\n+++ b/telegram/ext/regexhandler.py\n@@ -142,11 +142,12 @@\n         Returns:\n             :obj:`bool`\n         \"\"\"\n-\n+        if not isinstance(update, Update) and not update.effective_message:\n+            return False\n         if any([(self.message_updates and update.message),\n                 (self.edited_updates and update.edited_message),\n-                (self.channel_post_updates and update.channel_post)]) and (\n-                isinstance(update, Update)):\n+                (self.channel_post_updates and update.channel_post)]) and \\\n+                update.effective_message.text:\n             match = re.match(self.pattern, update.effective_message.text)\n             return bool(match)\n         return False\n", "issue": "RegexHandler error with stickers, voices, images...\nRegexHandler does not check if update.effective_message.text exists.\r\n\r\n### Steps to reproduce\r\n1. Add a RegexHandler\r\n2. Run the bot\r\n3. Send a sticker\r\n\r\n### Expected behaviour\r\nThe handler should not capture the sticker\r\n\r\n### Actual behaviour\r\nThe handler capture the sticker and gives an error\r\n\r\n### Configuration\r\nDoes not matter\r\n\r\n\r\n**Version of Python, python-telegram-bot & dependencies:**\r\n\r\n``python-telegram-bot 7.0.0``\r\n\r\n### Logs\r\n2017-07-26 14:02:47,301 - telegram.ext.dispatcher - ERROR - An uncaught error was raised while processing the update\r\nTraceback (most recent call last):\r\n  File \"/usr/local/lib/python3.5/dist-packages/telegram/ext/dispatcher.py\", line 269, in process_update\r\n    if handler.check_update(update):\r\n  File \"/usr/local/lib/python3.5/dist-packages/telegram/ext/regexhandler.py\", line 150, in check_update\r\n    match = re.match(self.pattern, update.effective_message.text)\r\n  File \"/usr/lib/python3.5/re.py\", line 163, in match\r\n    return _compile(pattern, flags).match(string)\r\nTypeError: expected string or bytes-like object\r\n\n", "before_files": [{"content": "#!/usr/bin/env python\n#\n# A library that provides a Python interface to the Telegram Bot API\n# Copyright (C) 2015-2017\n# Leandro Toledo de Souza <devs@python-telegram-bot.org>\n#\n# This program is free software: you can redistribute it and/or modify\n# it under the terms of the GNU Lesser Public License as published by\n# the Free Software Foundation, either version 3 of the License, or\n# (at your option) any later version.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU Lesser Public License for more details.\n#\n# You should have received a copy of the GNU Lesser Public License\n# along with this program.  If not, see [http://www.gnu.org/licenses/].\n# TODO: Remove allow_edited\n\"\"\" This module contains the RegexHandler class \"\"\"\n\nimport re\nimport warnings\n\nfrom future.utils import string_types\n\nfrom telegram import Update\nfrom .handler import Handler\n\n\nclass RegexHandler(Handler):\n    \"\"\"\n    Handler class to handle Telegram updates based on a regex. It uses a\n    regular expression to check text messages. Read the documentation of the\n    ``re`` module for more information. The ``re.match`` function is used to\n    determine if an update should be handled by this handler.\n\n    Attributes:\n        pattern (:obj:`str` | :obj:`Pattern`): The regex pattern.\n        callback (:obj:`callable`): The callback function for this handler.\n        pass_groups (:obj:`bool`): Optional. Determines whether ``groups`` will be passed to the\n            callback function.\n        pass_groupdict (:obj:`bool`): Optional. Determines whether ``groupdict``. will be passed to\n            the callback function.\n        pass_update_queue (:obj:`bool`): Optional. Determines whether ``update_queue`` will be\n            passed to the callback function.\n        pass_job_queue (:obj:`bool`): Optional. Determines whether ``job_queue`` will be passed to\n            the callback function.\n        pass_user_data (:obj:`bool`): Optional. Determines whether ``user_data`` will be passed to\n            the callback function.\n        pass_chat_data (:obj:`bool`): Optional. Determines whether ``chat_data`` will be passed to\n            the callback function.\n\n    Note:\n        :attr:`pass_user_data` and :attr:`pass_chat_data` determine whether a ``dict`` you\n        can use to keep any data in will be sent to the :attr:`callback` function.. Related to\n        either the user or the chat that the update was sent in. For each update from the same user\n        or in the same chat, it will be the same ``dict``.\n\n    Args:\n        pattern (:obj:`str` | :obj:`Pattern`): The regex pattern.\n        callback (:obj:`callable`): A function that takes ``bot, update`` as positional arguments.\n            It will be called when the :attr:`check_update` has determined that an update should be\n            processed by this handler.\n        pass_groups (:obj:`bool`, optional): If the callback should be passed the result of\n            ``re.match(pattern, data).groups()`` as a keyword argument called ``groups``.\n            Default is ``False``\n        pass_groupdict (:obj:`bool`, optional): If the callback should be passed the result of\n            ``re.match(pattern, data).groupdict()`` as a keyword argument called ``groupdict``.\n            Default is ``False``\n        pass_update_queue (:obj:`bool`, optional): If set to ``True``, a keyword argument called\n            ``update_queue`` will be passed to the callback function. It will be the ``Queue``\n            instance used by the :class:`telegram.ext.Updater` and :class:`telegram.ext.Dispatcher`\n            that contains new updates which can be used to insert updates. Default is ``False``.\n        pass_job_queue (:obj:`bool`, optional): If set to ``True``, a keyword argument called\n            ``job_queue`` will be passed to the callback function. It will be a\n            :class:`telegram.ext.JobQueue` instance created by the :class:`telegram.ext.Updater`\n            which can be used to schedule new jobs. Default is ``False``.\n        pass_user_data (:obj:`bool`, optional): If set to ``True``, a keyword argument called\n            ``user_data`` will be passed to the callback function. Default is ``False``.\n        pass_chat_data (:obj:`bool`, optional): If set to ``True``, a keyword argument called\n            ``chat_data`` will be passed to the callback function. Default is ``False``.\n        message_updates (:obj:`bool`, optional): Should \"normal\" message updates be handled?\n            Default is ``True``.\n        channel_post_updates (:obj:`bool`, optional): Should channel posts updates be handled?\n            Default is ``True``.\n        edited_updates (:obj:`bool`, optional): Should \"edited\" message updates be handled? Default\n            is ``False``.\n        allow_edited (:obj:`bool`, optional): If the handler should also accept edited messages.\n            Default is ``False`` - Deprecated. use edited_updates instead.\n\n    Raises:\n        ValueError\n    \"\"\"\n\n    def __init__(self,\n                 pattern,\n                 callback,\n                 pass_groups=False,\n                 pass_groupdict=False,\n                 pass_update_queue=False,\n                 pass_job_queue=False,\n                 pass_user_data=False,\n                 pass_chat_data=False,\n                 allow_edited=False,\n                 message_updates=True,\n                 channel_post_updates=False,\n                 edited_updates=False\n                 ):\n        if not message_updates and not channel_post_updates and not edited_updates:\n            raise ValueError(\n                'message_updates, channel_post_updates and edited_updates are all False')\n        if allow_edited:\n            warnings.warn('allow_edited is getting deprecated, please use edited_updates instead')\n            edited_updates = allow_edited\n\n        super(RegexHandler, self).__init__(\n            callback,\n            pass_update_queue=pass_update_queue,\n            pass_job_queue=pass_job_queue,\n            pass_user_data=pass_user_data,\n            pass_chat_data=pass_chat_data)\n\n        if isinstance(pattern, string_types):\n            pattern = re.compile(pattern)\n\n        self.pattern = pattern\n        self.pass_groups = pass_groups\n        self.pass_groupdict = pass_groupdict\n        self.allow_edited = allow_edited\n        self.message_updates = message_updates\n        self.channel_post_updates = channel_post_updates\n        self.edited_updates = edited_updates\n\n    def check_update(self, update):\n        \"\"\"\n        Determines whether an update should be passed to this handlers :attr:`callback`.\n\n        Args:\n            update (:class:`telegram.Update`): Incoming telegram update.\n\n        Returns:\n            :obj:`bool`\n        \"\"\"\n\n        if any([(self.message_updates and update.message),\n                (self.edited_updates and update.edited_message),\n                (self.channel_post_updates and update.channel_post)]) and (\n                isinstance(update, Update)):\n            match = re.match(self.pattern, update.effective_message.text)\n            return bool(match)\n        return False\n\n    def handle_update(self, update, dispatcher):\n        \"\"\"\n        Send the update to the :attr:`callback`.\n\n        Args:\n            update (:class:`telegram.Update`): Incoming telegram update.\n            dispatcher (:class:`telegram.ext.Dispatcher`): Dispatcher that originated the Update.\n        \"\"\"\n\n        optional_args = self.collect_optional_args(dispatcher, update)\n        match = re.match(self.pattern, update.effective_message.text)\n\n        if self.pass_groups:\n            optional_args['groups'] = match.groups()\n        if self.pass_groupdict:\n            optional_args['groupdict'] = match.groupdict()\n\n        return self.callback(dispatcher.bot, update, **optional_args)\n", "path": "telegram/ext/regexhandler.py"}], "after_files": [{"content": "#!/usr/bin/env python\n#\n# A library that provides a Python interface to the Telegram Bot API\n# Copyright (C) 2015-2017\n# Leandro Toledo de Souza <devs@python-telegram-bot.org>\n#\n# This program is free software: you can redistribute it and/or modify\n# it under the terms of the GNU Lesser Public License as published by\n# the Free Software Foundation, either version 3 of the License, or\n# (at your option) any later version.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU Lesser Public License for more details.\n#\n# You should have received a copy of the GNU Lesser Public License\n# along with this program.  If not, see [http://www.gnu.org/licenses/].\n# TODO: Remove allow_edited\n\"\"\" This module contains the RegexHandler class \"\"\"\n\nimport re\nimport warnings\n\nfrom future.utils import string_types\n\nfrom telegram import Update\nfrom .handler import Handler\n\n\nclass RegexHandler(Handler):\n    \"\"\"\n    Handler class to handle Telegram updates based on a regex. It uses a\n    regular expression to check text messages. Read the documentation of the\n    ``re`` module for more information. The ``re.match`` function is used to\n    determine if an update should be handled by this handler.\n\n    Attributes:\n        pattern (:obj:`str` | :obj:`Pattern`): The regex pattern.\n        callback (:obj:`callable`): The callback function for this handler.\n        pass_groups (:obj:`bool`): Optional. Determines whether ``groups`` will be passed to the\n            callback function.\n        pass_groupdict (:obj:`bool`): Optional. Determines whether ``groupdict``. will be passed to\n            the callback function.\n        pass_update_queue (:obj:`bool`): Optional. Determines whether ``update_queue`` will be\n            passed to the callback function.\n        pass_job_queue (:obj:`bool`): Optional. Determines whether ``job_queue`` will be passed to\n            the callback function.\n        pass_user_data (:obj:`bool`): Optional. Determines whether ``user_data`` will be passed to\n            the callback function.\n        pass_chat_data (:obj:`bool`): Optional. Determines whether ``chat_data`` will be passed to\n            the callback function.\n\n    Note:\n        :attr:`pass_user_data` and :attr:`pass_chat_data` determine whether a ``dict`` you\n        can use to keep any data in will be sent to the :attr:`callback` function.. Related to\n        either the user or the chat that the update was sent in. For each update from the same user\n        or in the same chat, it will be the same ``dict``.\n\n    Args:\n        pattern (:obj:`str` | :obj:`Pattern`): The regex pattern.\n        callback (:obj:`callable`): A function that takes ``bot, update`` as positional arguments.\n            It will be called when the :attr:`check_update` has determined that an update should be\n            processed by this handler.\n        pass_groups (:obj:`bool`, optional): If the callback should be passed the result of\n            ``re.match(pattern, data).groups()`` as a keyword argument called ``groups``.\n            Default is ``False``\n        pass_groupdict (:obj:`bool`, optional): If the callback should be passed the result of\n            ``re.match(pattern, data).groupdict()`` as a keyword argument called ``groupdict``.\n            Default is ``False``\n        pass_update_queue (:obj:`bool`, optional): If set to ``True``, a keyword argument called\n            ``update_queue`` will be passed to the callback function. It will be the ``Queue``\n            instance used by the :class:`telegram.ext.Updater` and :class:`telegram.ext.Dispatcher`\n            that contains new updates which can be used to insert updates. Default is ``False``.\n        pass_job_queue (:obj:`bool`, optional): If set to ``True``, a keyword argument called\n            ``job_queue`` will be passed to the callback function. It will be a\n            :class:`telegram.ext.JobQueue` instance created by the :class:`telegram.ext.Updater`\n            which can be used to schedule new jobs. Default is ``False``.\n        pass_user_data (:obj:`bool`, optional): If set to ``True``, a keyword argument called\n            ``user_data`` will be passed to the callback function. Default is ``False``.\n        pass_chat_data (:obj:`bool`, optional): If set to ``True``, a keyword argument called\n            ``chat_data`` will be passed to the callback function. Default is ``False``.\n        message_updates (:obj:`bool`, optional): Should \"normal\" message updates be handled?\n            Default is ``True``.\n        channel_post_updates (:obj:`bool`, optional): Should channel posts updates be handled?\n            Default is ``True``.\n        edited_updates (:obj:`bool`, optional): Should \"edited\" message updates be handled? Default\n            is ``False``.\n        allow_edited (:obj:`bool`, optional): If the handler should also accept edited messages.\n            Default is ``False`` - Deprecated. use edited_updates instead.\n\n    Raises:\n        ValueError\n    \"\"\"\n\n    def __init__(self,\n                 pattern,\n                 callback,\n                 pass_groups=False,\n                 pass_groupdict=False,\n                 pass_update_queue=False,\n                 pass_job_queue=False,\n                 pass_user_data=False,\n                 pass_chat_data=False,\n                 allow_edited=False,\n                 message_updates=True,\n                 channel_post_updates=False,\n                 edited_updates=False\n                 ):\n        if not message_updates and not channel_post_updates and not edited_updates:\n            raise ValueError(\n                'message_updates, channel_post_updates and edited_updates are all False')\n        if allow_edited:\n            warnings.warn('allow_edited is getting deprecated, please use edited_updates instead')\n            edited_updates = allow_edited\n\n        super(RegexHandler, self).__init__(\n            callback,\n            pass_update_queue=pass_update_queue,\n            pass_job_queue=pass_job_queue,\n            pass_user_data=pass_user_data,\n            pass_chat_data=pass_chat_data)\n\n        if isinstance(pattern, string_types):\n            pattern = re.compile(pattern)\n\n        self.pattern = pattern\n        self.pass_groups = pass_groups\n        self.pass_groupdict = pass_groupdict\n        self.allow_edited = allow_edited\n        self.message_updates = message_updates\n        self.channel_post_updates = channel_post_updates\n        self.edited_updates = edited_updates\n\n    def check_update(self, update):\n        \"\"\"\n        Determines whether an update should be passed to this handlers :attr:`callback`.\n\n        Args:\n            update (:class:`telegram.Update`): Incoming telegram update.\n\n        Returns:\n            :obj:`bool`\n        \"\"\"\n        if not isinstance(update, Update) and not update.effective_message:\n            return False\n        if any([(self.message_updates and update.message),\n                (self.edited_updates and update.edited_message),\n                (self.channel_post_updates and update.channel_post)]) and \\\n                update.effective_message.text:\n            match = re.match(self.pattern, update.effective_message.text)\n            return bool(match)\n        return False\n\n    def handle_update(self, update, dispatcher):\n        \"\"\"\n        Send the update to the :attr:`callback`.\n\n        Args:\n            update (:class:`telegram.Update`): Incoming telegram update.\n            dispatcher (:class:`telegram.ext.Dispatcher`): Dispatcher that originated the Update.\n        \"\"\"\n\n        optional_args = self.collect_optional_args(dispatcher, update)\n        match = re.match(self.pattern, update.effective_message.text)\n\n        if self.pass_groups:\n            optional_args['groups'] = match.groups()\n        if self.pass_groupdict:\n            optional_args['groupdict'] = match.groupdict()\n\n        return self.callback(dispatcher.bot, update, **optional_args)\n", "path": "telegram/ext/regexhandler.py"}]}