Bibo-Joshi · GitHub

This example does three things:

  1. Teach me that windows defender blocks you from accessing webservers on your machine if your current network is marked as "public" 🤦
  2. add parameters chat/user_id to CallbackContext.__init__, which allows users to associate custom updates with users/chats
  3. Add an example on how to set up a custom webhook thingy in combination with Application. This also showcases a health endpoint and how to handle custom updates. Thus closes Add health endpoint - 405 Method not allowed #1438 and closes Make it easier to handle webhooks manually, by providing a convience setup method for dispatcher #1258.

I chose starlette + uvicorn for the example b/c i recently worked with those for a private project, so I recalled the mechanics. Pool suggested to use tornado because PTB requires that anyway. However, we are already considereding to switching to a different library (#2966) and in the end the example is basically independent of which webserver framework is used. If both harshil and pool strongly disagree with using starlette + uvicorn in the example, I'm open to rewriting.

Checklist for PRs

  • Added .. versionadded:: version, .. versionchanged:: version or .. deprecated:: version to the docstrings for user facing changes (for methods/class descriptions, arguments and attributes)
  • Created new or adapted existing unit tests - no need
  • Documented code changes according to the CSI standard
  • Added myself alphabetically to AUTHORS.rst (optional)
  • Added new classes & modules to the docs and all suitable __all__ s

Read the original on github.com ↗