apenasrr / clonechat

Clone all posts from the history of a Telegram Channel/Group to another Channel/Group.
MIT License
333 stars 83 forks source link

ERRO trying again... Due to: Peer id invalid #44

Open RoissonSilva opened 1 month ago

RoissonSilva commented 1 month ago

Can anyone help me with this error, I already searched the internet but I didn't find anything to solve it.

Enter the number(s) of the file type to clone, separating by comma. For example, to copy photos and documents type: 1,3 Your answer: 0 New cloning or continuation? 1 = new 2 = resume Your answer: 1 trying again... Due to: Peer id invalid: -1002166654067 trying again... Due to: Peer id invalid: -1002166654067 trying again... Due to: Peer id invalid: -1002166654067 trying again... Due to: Peer id invalid: -1002166654067 trying again... Due to: Peer id invalid: -1002166654067 trying again... Due to: Peer id invalid: -1002166654067 trying again... Due to: Peer id invalid: -1002166654067 trying again... Due to: Peer id invalid: -1002166654067 trying again... Due to: Peer id invalid: -1002166654067 trying again... Due to: Peer id invalid: -1002166654067 trying again... Due to: Peer id invalid: -1002166654067 trying again... Due to: Peer id invalid: -1002166654067 trying again... Due to: Peer id invalid: -1002166654067 trying again... Due to: Peer id invalid: -1002166654067 trying again... Due to: Peer id invalid: -1002166654067 trying again... Due to: Peer id invalid: -1002166654067 trying again... Due to: Peer id invalid: -1002166654067 trying again... Due to: Peer id invalid: -1002166654067 trying again... Due to: Peer id invalid: -1002166654067 trying again... Due to: Peer id invalid: -1002166654067

xcodezads commented 1 month ago

o mesmo por aqui

timgahmen commented 1 month ago

here too saldy.... also tryed some "older versions of the bot" but all the same erroe

LucasDanielSFF commented 3 weeks ago

Use the chat link over the id

timgahmen commented 3 weeks ago

Use the chat link over the id

like this?

ID....: -1002166654067 Link: https://t.me/c/2166654067/

timgahmen commented 3 weeks ago

Fix, add this to clonechat.py:

# Fix: Error: Peer id invalid

import pyrogram.utils as utils

def get_peer_type(peer_id: int) -> str:
    print('get_peer_type call')
    peer_id_str = str(peer_id)
    if not peer_id_str.startswith("-"):
        return "user"
    elif peer_id_str.startswith("-100"):
        return "channel"
    else:
        return "chat"

utils.get_peer_type = get_peer_type
LucasDanielSFF commented 3 weeks ago

Use the chat link over the id

like this?

ID....: -1002166654067 Link: https://t.me/c/2166654067/

Mine was something like this https://t.me/+W1H4XTO7h3o1Z (not a true link). All of my created channels for destination of the clone always starts with "+" for me. On Telegram Web you can find the link easily, on Kotatogram you need to click on invite link

I did needed to change my destination channel to public to start the clone process, but changed back to provate as soon as the first massage started downloading on the cmd

timgahmen commented 3 weeks ago

Use the chat link over the id

like this? ID....: -1002166654067 Link: https://t.me/c/2166654067/

Mine was something like this https://t.me/+W1H4XTO7h3o1Z (not a true link). All of my created channels for destination of the clone always starts with "+" for me. On Telegram Web you can find the link easily, on Kotatogram you need to click on invite link

This is the invite link 😊 like this it work for sure too

the Channel ID is a different thing 😊

I did needed to change my destination channel to public to start the clone process, but changed back to provate as soon as the first massage started downloading on the cmd

If you have Access to the channel (or if you set to Bot -> the bot has access) you should not have to set public ...

Fix, add this to clonechat.py:

# Fix: Error: Peer id invalid

import pyrogram.utils as utils

def get_peer_type(peer_id: int) -> str:
    print('get_peer_type call')
    peer_id_str = str(peer_id)
    if not peer_id_str.startswith("-"):
        return "user"
    elif peer_id_str.startswith("-100"):
        return "channel"
    else:
        return "chat"

utils.get_peer_type = get_peer_type

for me it works with this "Fix" now.... is a pyrogram problem ...

rosciobrito commented 3 weeks ago

Perfect. It's working.