python-telegram-bot replying to specific user in group chat

Question:

I am working on a telegram bot project for local people in my area, I would like to know is it possible for bot to reply back to same user that send the command in group chat, but not have the rest of the group see it. I thought I saw this as a possibility, but I cannot find it on python-telegram-bot github.

I am not looking for a copy/pastable code, I just need help in the right direction, I haven’t received any responses in the telegram group chat on the matter.

Any help is appreciated.

Asked By: andyADD

||

Answers:

You have some options

  1. Reply in private chat
    Send a message directly to the users id. The problem is, the user have to unlock you before, by sending your bot /start. This may be practical for small groups.
  2. Guide the user to a private chat
    Send a link like t.me/your_bot?start=XXXX. The user starts your bot in a private chat and sends the parameter (XXXX). Then you can evalute if its the right keyword and user and then send your message. Even more elegant is to use a InlineKeyBoardButton with this url.
  3. Use a button with an alert
    Reply with an InlineKeyBoardButton and use answerCallbackQuery with show_alert=True to show a text when the right user clicks it like @nnbbot does it. The drawback of this method is, you can only use up to 200 charachters.
Answered By: Andre0512
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.