コード例 #1
0
 def collect_additional_context(
     self,
     context: CCT,
     update: Update,
     application: "Application",
     check_result: Optional[Union[bool, Dict[str, object]]],
 ) -> None:
     """Adds possible output of data filters to the :class:`CallbackContext`."""
     if isinstance(check_result, dict):
         context.update(check_result)
コード例 #2
0
 def collect_additional_context(
     self,
     context: CCT,
     update: Update,
     application: "Application",
     check_result: Optional[Union[bool, Tuple[List[str], Optional[bool]]]],
 ) -> None:
     """Add text after the command to :attr:`CallbackContext.args` as list, split on single
     whitespaces and add output of data filters to :attr:`CallbackContext` as well.
     """
     if isinstance(check_result, tuple):
         context.args = check_result[0]
         if isinstance(check_result[1], dict):
             context.update(check_result[1])
コード例 #3
0
 def collect_additional_context(
     self,
     context: CCT,
     update: str,
     application: "Application",
     check_result: Optional[List[str]],
 ) -> None:
     """Add text after the command to :attr:`CallbackContext.args` as list, split on single
     whitespaces.
     """
     context.args = check_result
コード例 #4
0
 def collect_additional_context(
     self,
     context: CCT,
     update: str,
     application: "Application",
     check_result: Optional[Match],
 ) -> None:
     """Add the result of ``re.match(pattern, update)`` to :attr:`CallbackContext.matches` as
     list with one element.
     """
     if self.pattern and check_result:
         context.matches = [check_result]
コード例 #5
0
 def collect_additional_context(
     self,
     context: CCT,
     update: Update,
     application: "Application",
     check_result: Optional[Union[bool, Match]],
 ) -> None:
     """Add the result of ``re.match(pattern, update.inline_query.query)`` to
     :attr:`CallbackContext.matches` as list with one element.
     """
     if self.pattern:
         check_result = cast(Match, check_result)
         context.matches = [check_result]
 def collect_additional_context(
     self,
     context: CCT,
     update: Update,
     application: "Application",
     check_result: Union[bool, Match],
 ) -> None:
     """This function adds the matched regex pattern result to
     :attr:`telegram.ext.CallbackContext.matches`.
     """
     if self.pattern:
         check_result = cast(Match, check_result)
         context.matches = [check_result]