SaveRestrictedContentBot icon indicating copy to clipboard operation
SaveRestrictedContentBot copied to clipboard

Error

Open KeimaSenpai opened this issue 1 year ago • 6 comments

This only happens to me with new channels created

Failed to save: https://t.me/c/2213281111/72

Error: Peer id invalid: -1002213281111

KeimaSenpai avatar Jun 06 '24 09:06 KeimaSenpai

same here ... but it is not only a problem of this bot, other bots have this problem too

timgahmen avatar Jun 06 '24 15:06 timgahmen

Fix, add this to pyroplug.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

timgahmen avatar Jun 12 '24 22:06 timgahmen

Please add pull requests

Ali777666 avatar Jun 19 '24 21:06 Ali777666

Two answer peer id invalid And fix version post

Ali777666 avatar Jun 19 '24 21:06 Ali777666

Thanks 😊

Ali777666 avatar Jun 24 '24 16:06 Ali777666

Fix, add this to pyroplug.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

better solution (no garantee -> works for me):

use this pyrogram version: https://github.com/timgahmen/pyrogram/archive/refs/tags/v2.0.106+ID_Fix).zip

updated requirements.txt https://github.com/vasusen-code/SaveRestrictedContentBot/pull/167

timgahmen avatar Jun 29 '24 06:06 timgahmen

En que parte agrego eso arriba abajo en que lao

KeimaSenpai avatar Jul 14 '24 04:07 KeimaSenpai

Muy buena tu solución me funcionó

KeimaSenpai avatar Jul 14 '24 04:07 KeimaSenpai