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

The new file IDs from the bot API aren't working #370

Closed
AdmAlexus opened this issue Feb 19, 2020 · 6 comments
Closed

The new file IDs from the bot API aren't working #370

AdmAlexus opened this issue Feb 19, 2020 · 6 comments

Comments

@AdmAlexus
Copy link

@AdmAlexus AdmAlexus commented Feb 19, 2020

Checklist

  • I am sure the error is coming from Pyrogram's code and not elsewhere.
  • I have searched in the issue tracker for similar bug reports, including closed ones.
  • I ran pip3 install -U https://github.com/pyrogram/pyrogram/archive/develop.zip and reproduced the issue using the latest development version.

Description

In stable and develop version sticker is not send. Version Pyrogram: 0.16.0

Steps to Reproduce

app.send_sticker('me', 'CAACAgIAAxkBAAIpEl5MpSuhB_3dLRB-1sztf9FQ4N4qAAKAAQACgD8HKBYReKQerq-PGAQ')

Traceback

Pyrogram v0.16.0, Copyright (C) 2017-2019 Dan <https://github.com/delivrance>
Licensed under the terms of the GNU Lesser General Public License v3 or later (LGPLv3+)

Failed to decode file_id: CAACAgIAAxkBAAIpEl5MpSuhB_3dLRB-1sztf9FQ4N4qAAKAAQACgD8HKBYReKQerq-PGAQ
Traceback (most recent call last):
  File "C:\Users\Alexus\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pyrogram\client\ext\utils.py", line 35, in decode_file_id
    assert s[-1] == 2
AssertionError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Alexus\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pyrogram\client\ext\utils.py", line 100, in get_input_media_from_file_id
    decoded = decode_file_id(file_id_str)
  File "C:\Users\Alexus\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pyrogram\client\ext\utils.py", line 38, in decode_file_id
    assert s[-2] == 22
AssertionError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Alexus\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pyrogram\client\ext\dispatcher.py", line 199, in update_worker
    handler.callback(self.client, *args)
  File "pufon.py", line 24, in mes_handler
    client.send_sticker('me', 'CAACAgIAAxkBAAIpEl5MpSuhB_3dLRB-1sztf9FQ4N4qAAKAAQACgD8HKBYReKQerq-PGAQ')
  File "C:\Users\Alexus\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pyrogram\client\methods\messages\send_sticker.py", line 130, in send_sticker

    media = utils.get_input_media_from_file_id(sticker, file_ref, 8)
  File "C:\Users\Alexus\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pyrogram\client\ext\utils.py", line 102, in get_input_media_from_file_id
    raise ValueError("Failed to decode file_id: {}".format(file_id_str))
ValueError: Failed to decode file_id: CAACAgIAAxkBAAIpEl5MpSuhB_3dLRB-1sztf9FQ4N4qAAKAAQACgD8HKBYReKQerq-PGAQ```
@ColinTheShark
Copy link
Member

@ColinTheShark ColinTheShark commented Feb 19, 2020

Firstly I suggest wrapping the whole traceback in triple backticks

```
your traceback here
```

or indent everything by 4 spaces

    like this

Secondly, that is not a valid FileID anyway. FileIDs are shorter than that.
An example would be CAADBAADyg4AAvLQYAEYD4F7vcZ43BYE.
Could you explain how you acquired your "FileID"?

@AdmAlexus
Copy link
Author

@AdmAlexus AdmAlexus commented Feb 19, 2020

Firstly I suggest wrapping the whole traceback in triple backticks

your traceback here

or indent everything by 4 spaces

    like this

Secondly, that is not a valid FileID anyway. FileIDs are shorter than that.
An example would be CAADBAADyg4AAvLQYAEYD4F7vcZ43BYE.
Could you explain how you acquired your "FileID"?

I got the sticker ID using the @idstickerbot bot
If you can tell me how you can get the id in the correct format - I will be very grateful.

@ColinTheShark
Copy link
Member

@ColinTheShark ColinTheShark commented Feb 19, 2020

If you can tell me how you can get the id in the correct format - I will be very grateful.

I have been wrong. Sorry.

@delivrance explained me, that you have one of the newer file_ids that has the file_ref embedded. He can explain you more about it.

@AdmAlexus
Copy link
Author

@AdmAlexus AdmAlexus commented Feb 19, 2020

@delivrance explained me, that you have one of the newer file_ids that has the file_ref embedded. He can explain you more about it.

Ok, thx. I'll wait for a response from @deliverance

@delivrance
Copy link
Member

@delivrance delivrance commented Feb 19, 2020

@AdmAlexus Thanks for pointing this out. Unfortunately Telegram changed the file IDs format again (and without prior clear notice) and Pyrogram cannot yet understand the one you passed, which I assume you obtained from the bot API. However, I have already successfully reverse engineered the new file id format in order to create a compatible and working version using the older one for a popular bot I'm running. I will embed changes as well as (probably) a way to convert new to old file IDs into the library once I have some little free time.

@delivrance delivrance changed the title Don't send sticker The new file IDs from the bot API aren't working Feb 19, 2020
@delivrance
Copy link
Member

@delivrance delivrance commented Nov 28, 2020

Fixed. Old and new file ids are now fully working and can be used in Pyrogram from the Bot API and vice-versa.

@delivrance delivrance closed this Nov 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.