Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Simple script to read and forward incoming messages in a private telegram channel#3701

Unanswered
diliprk asked this question inQ&A
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 messageinstantly to my personal channel or to another telegram user.

I came across this article which uses an older version ofpython-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 topython-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 simpleEchobot example, but instead of just echoing the message back to the user, useMessage.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 fromBotFather 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 fromBotFather 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 inBot API)

Comment options

You can't add your bot to a private channel where you only have read onlyaccess.I only see paid options to do thishttps://docs.junction.space/forwarding/but no tutorial or documentation anywhere.Same situation here:https://stackoverflow.com/questions/67343166/how-to-allow-telegram-bot-to-read-messages-in-a-private-channel-that-im-in-not
On Thu, 11 May, 2023, 10:55 pm Dmitry Kolomatskiy, ***@***.***> wrote: Thanks@lemontree210 <https://github.com/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 <https://core.telegram.org/bots/api#forwardmessage>) — Reply to this email directly, view it on GitHub <#3701 (reply in thread)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AE3DPA5RRNOF3UKZYMQMACTXFUOHDANCNFSM6AAAAAAX6LRIBQ> . You are receiving this because you authored the thread.Message ID: <python-telegram-bot/python-telegram-bot/repo-discussions/3701/comments/5876065 @github.com>
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 usehttps://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 freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
Q&A
Labels
None yet
5 participants
@diliprk@kuhytitusdlz@Poolitzer@lemontree210@Ayax-BTC

[8]ページ先頭

©2009-2025 Movatter.jp