in my code below:
sticer = "0.webm"
upload_sticker = await client.upload_file(sticker)
my_Stickers = InputStickerSetItem(document=InputDocument(id=upload_sticker.id,access_hash=upload_sticker.access_hash,file_reference=upload_sticker.file_reference),emoji="💀")
result = await client(CreateStickerSetRequest(user_id=user, title="testset", short_name="jjkakschan_by_cool_bot", stickers=[my_Stickers]))
I'm trying to get the access_hash and file_reference but I don't know what returns them
I have webm files in the right format and encoding and I want to create a video sticker set using them, here I only used 1 for demonstration.
my question is do I get the access hash and file reference of my uploaded webm files ?
the client.upload only returns:
InputFile(id=-67133921635690008, parts=1, name='0.webm', md5_checksum='5188d68feebc242395e98819582bac29')
but I believe I need InputDocument
file_reference
is a temporary random bytestring used to access media (such as download). This means the media must've been sent or saved previously, and you accessed it through (most likely) a message.
If the media hasn't been set, you need to use the InputMedia
constructors with Uploaded
in their name. There is only two of these: InputMediaUploadedDocument
and InputMediaUploadedPhoto
.
Photos are only intended to be image files that will be compressed by the server.
So that leaves you with just InputMediaUploadedDocument
. And that's what you must create, since it takes an InputFile
as a parameter.
InputMediaUploadedDocument(file=input_file, mime_type='application/octet-stream', attributes=[])`
Adjust as needed.
To go from an uploaded document to a document, you must upload the media (not the file, which you've already uploaded) using UploadMediaRequest
.
This will likely return a MessageMediaDocument
, which you can use with utils.get_input_media
.
This is extremely confusing, but it's how the API works.