ohld / telegram-support-bot

Easy way to use Telegram bot to hide your identity. Useful for support, anonymous channel management. Free clone of Livegram Bot.
https://t.me/danokhlopkov
MIT License
334 stars 273 forks source link

Bot Code Issues #11

Open wutlah opened 3 years ago

wutlah commented 3 years ago

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 commented 3 years ago

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
        )