def register(<EOL>self,<EOL>pattern: str,<EOL>handler: Any,<EOL>flags: int = <NUM_LIT:0>,<EOL>channel: str = "<STR_LIT:*>",<EOL>subtype: Optional[str] = None,<EOL>) -> None:
LOG.debug('<STR_LIT>', pattern, handler)<EOL>match = re.compile(pattern, flags)<EOL>if subtype not in self._routes[channel]:<EOL><INDENT>self._routes[channel][subtype] = dict()<EOL><DEDENT>if match in self._routes[channel][subtype]:<EOL><INDENT>self._routes[channel][subtype][match].append(handler)<EOL><DEDENT>else:<EOL><INDENT>self._routes[channel][subtype][match] = [handler]<EOL><DEDENT>
Register a new handler for a specific :class:`slack.events.Message`.

The routing is based on regex pattern matching the message text and the incoming slack channel.

Args:
    pattern: Regex pattern matching the message text.
    handler: Callback
    flags: Regex flags.
    channel: Slack channel ID. Use * for any.
    subtype: Message subtype