Skip to content

Send text from return statement of decorated function as reply from bot #1768

@alparo

Description

@alparo

Please answer these questions before submitting your issue. Thanks!

  1. What version of pyTelegramBotAPI are you using?
    4.7.0
  2. What OS are you using?
    Win10
  3. What version of python are you using?
    3.8.10

I have a proposal. Maybe it will be possible to implement following scenario:

  1. you decorate function with message_handler decorator;
  2. you use in the decorated function return statement with e.g. some text;
  3. this text is sent as a reply to the user, who triggered the decorated function by his/her message.

It will help to decrease code nesting in bots, which main purpose is to send something back to the user for each bot command.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions