Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Checking that reply_to_message was reply to bot #19

Open
ightingale opened this issue Jun 30, 2022 · 1 comment
Open

Checking that reply_to_message was reply to bot #19

ightingale opened this issue Jun 30, 2022 · 1 comment

Comments

@ightingale
Copy link

if user_id:
    context.bot.copy_message(
        message_id=update.message.message_id,
        chat_id=user_id,
        from_chat_id=update.message.chat_id
    )
else:
    if update.message.reply_to_message.from_user.is_bot:      #Checking that reply_to_message was reply to bot 
        context.bot.send_message(
            chat_id=update.message.chat_id,
            text=WRONG_REPLY
        )

WRONG_REPLY will be send only for a bot's messages

@rus-ai
Copy link
Contributor

rus-ai commented Feb 2, 2024

Thanks
I make more reliable

def forward_to_user(update, context):
    if update.message.reply_to_message.from_user.id == context.bot.id:

If many bots presents in support chat - that reply to this bot messages only will triggered, not other bots

I coded this in my fork already

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants