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

Bot Code Issues #11

Open
wutlah opened this issue Sep 21, 2021 · 1 comment
Open

Bot Code Issues #11

wutlah opened this issue Sep 21, 2021 · 1 comment

Comments

@wutlah
Copy link

wutlah commented Sep 21, 2021

When bot forwarded to a Telegram Group that have been set up to receive, it work normally.

Bot function normally by forwarding messages to the group.
This include "From: @sadvibealone
User above don't allow forward his messages.
Reply to this message."

However , when reply to the "bot reply under user forwarded message" , it shows WRONG_REPLY error.

Much Thx

@rus-ai
Copy link
Contributor

rus-ai commented Sep 26, 2021

This is wrong in your fork:

text=f'From: @{update.message.from_user.username}\n{REPLY_TO_THIS_MESSAGE}'
Username not always available in user security policy, only friendly display name.

You must use numeric userID instead of username

But if you want use username, rewrite this user_id extraction

elif REPLY_TO_THIS_MESSAGE in update.message.reply_to_message.text:
        try:
            user_id = int(update.message.reply_to_message.text.split('\n')[0])
        except ValueError:
            user_id = None
    if user_id:
        context.bot.copy_message(
            message_id=update.message.message_id,
            chat_id=user_id,
            from_chat_id=update.message.chat_id
        )

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