Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Discussion options

Hi,
I am trying to create a simple python script that I can deploy in some serverless env like AWS lambda where I continously listen to telegram messages incoming in a private telegram channel and forward the received message instantly to my personal channel or to another telegram user.

I came across this article which uses an older version of python-telegram-bot to listen to messages and forward it.
https://stackoverflow.com/questions/74910268/how-can-i-make-a-telegram-bot-listen-to-messages-from-a-different-chat-with-pyth

But this no longer works in the newer version of the library. I am new to python-telegram-bot library and the wiki page is a bit overwhelming. Can anyone please suggest some simple code to get started for this requirement?

Best Regards,
Dilip

You must be logged in to vote

Replies: 4 comments · 4 replies

Comment options

Hey, thanks for reaching out.

I would recommend looking at "Your First Bot" to get the understanding of how the new version works. Then you can use the simple Echobot example, but instead of just echoing the message back to the user, use Message.forward() to forward it.

You must be logged in to vote
2 replies
@diliprk
Comment options

Thanks @lemontree210 I am assuming to do all this, the bot I created from BotFather needs to be added as an administrator to the private channel right?
But what If I am just a subscriber to a closed private channel and I can only read incoming messages and don't have admin access to add my bot as an admin to this closed private channel or copy messages from this private channel? What is the solution in that case to read this incoming message in private closed channel and then forward it to my own channel?

@lemontree210
Comment options

Thanks @lemontree210 I am assuming to do all this, the bot I created from BotFather needs to be added as an administrator to the private channel right? But what If I am just a subscriber to a closed private channel and I can only read incoming messages and don't have admin access to add my bot as an admin to this closed private channel or copy messages from this private channel?

Hmm, I don't think the bot must be an administrator for this action (there's nothing about it in Bot API)

Comment options

You must be logged in to vote
2 replies
@lemontree210
Comment options

I think that that's how it is, yes. The bot doesn't need to be an admin but you do need to be to add it :)

@Poolitzer
Comment options

No the bot very much needs to be an admin to be in a channel

Comment options

you can use https://github.com/iyear/tdl to read/export protected channel message, but import not support in this tool

You must be logged in to vote
0 replies
Comment options

Can someone teach me all this please

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
⁉️
Q&A
Labels
None yet
5 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.