Closed lit34 closed 3 years ago
from
and to
fields can be either chat id or visible nameNEW FEATURE: :tada: You may use the chat_id instead of the visible name. To get the chat id of a particular chat/group/channel run get_chat_id.py
and then enter the user-name/phone/link of the chat.
An example is here:
the integer you get in the second line of output is the chat id
After getting the chat id you can use this in the config.ini
file:
[my config]
from = 90984098590
to = My Channel
offset = 0
; the from and to fields can be either chat id or visible name
@lit34 Please test the new feature, and give your feedback.
Thank you for your quick response. I tried again with the new chat ids but I receive an error "ValueError: Could not find the input entity for <telethon.tl.types.PeerUser object at 0x000002700F7EFEE0>"
After I research a little on internet I found a solution here https://www.xspdf.com/resolution/53139794.html "Every channel id is a 13 characters negative integer. So the id for this channel is -1001035716040 and not 1035716040 as printed."
So I modified chat ids by putting -100 in front of them. It worked! Now the only problem I encounter is the flood messages that forces the script to take 5 min pause. If there are many files to be copied the pause is getting bigger, 60 minutes. I guess there are some limits that Telegram enforces. Are these known? Maybe an option to copy at a slower pace will not trigger these bans? A nice enhancement could be the option to copy only some types of posts and exclude others (video, audio, photos, links, excluding posts that contain certain words etc).
Thank you again for your effort, your script is the only one that worked for me, and I tried quite a few of them.
hi @lit34 you can easily get chat ids by running get_chat_id.py
. And it works, directly, I have tested.
You don't need to add -100
in front.
I think you made some kind of error.
I highly recommend using visible names
. If visible names collide, then take the link of the channel/group and generate the chat id.
FloodWait is caused by Telegram, because it puts some limitations on the no. of messages you can send in a given time.
Sending messages slowly is a bad idea, in my opinion. That will take more total time, for a person who has fewer messages.
Waiting when we encounter FloodLimits is better.
A nice enhancement could be the option to copy only some types of posts and exclude others (video, audio, photos, links, excluding posts that contain certain words etc).
Thats a good idea, but I am currently busy with other work. You are most welcome to contribute the new feature.
@lit34 From now on, you can directly use username in from
and to
I deleted all and setup a fresh configuration. Now it works! Keep up the good work!
Hello and thank you for your work. I've been using your script and is working really good. But i encountered a problem. Telegram allows identical names for chats visible names, only their user-names are unique. So i wanted to copy files from 3 public channels to my private channel, but these public channels names are the same. So the script only copied files from one of this channels.
How does your script differentiate between channels that have identical visible names? There must be a way to separate them and uniquely identify them. Is there a possibility to use user-names of channels instead of visible names?