Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error #158

Closed
KeimaSenpai opened this issue Jun 6, 2024 · 8 comments
Closed

Error #158

KeimaSenpai opened this issue Jun 6, 2024 · 8 comments

Comments

@KeimaSenpai
Copy link

KeimaSenpai commented Jun 6, 2024

This only happens to me with new channels created

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

Error: Peer id invalid: -1002213281111

@timgahmen
Copy link

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

@timgahmen
Copy link

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

@Ali777666
Copy link

Please add pull requests

@Ali777666
Copy link

Two answer peer id invalid
And fix version post

timgahmen added a commit to timgahmen/SaveRestrictedContentBot_vasusen-code_Tim that referenced this issue Jun 24, 2024
 Error vasusen-code#158 
*quick-and-dirty*-fix
@Ali777666
Copy link

Thanks 😊

@timgahmen
Copy link

timgahmen commented Jun 29, 2024

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
#167

@KeimaSenpai
Copy link
Author

En que parte agrego eso arriba abajo en que lao

@KeimaSenpai
Copy link
Author

Muy buena tu solución me funcionó

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants