Skip to content

Add listener matchers guide in documents #372

Description

@seratch

The document website is missing the guide for listener matchers. We can have a simple guide with an example code as part of the "Listener Middleware" section.

target_user_id = "U03E94MK0"

def is_allowed_user(context) -> bool:
    return context.user_id == target_user_id

@app.event(
   "app_mention",
   matchers=[
     lambda context: context.user_id == target_user_id # or is_allowed_user
  ],
)
def event_test(event, say):
    say(f"Hi there, <@{event['user']}>!")

The page URLs

Requirements

Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.

Activity

  1. added
    docsImprovements or additions to documentation
    on Jun 7, 2021
  2. added this to the 1.7.0 milestone on Jun 7, 2021
  3. self-assigned this
    on Jun 7, 2021
  4. added a commit that references this issue on Jul 15, 2021
    1b4eefc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

docsImprovements or additions to documentation

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions