LonamiWebs / Telethon

Pure Python 3 MTProto API Telegram client library, for bots too!
https://docs.telethon.dev
MIT License
9.97k stars 1.4k forks source link

AddStickerToSetRequest api failed #4387

Open GodFatherClover opened 5 months ago

GodFatherClover commented 5 months ago

Code that causes the issue


        for attr in message.sticker.attributes:
            if isinstance(attr, types.DocumentAttributeSticker):
                if type(attr.stickerset) is InputStickerSetID:
                    sticker_id = attr.stickerset.id
                    sticker_access_hash = attr.stickerset.access_hash

                    result = await client(functions.stickers.AddStickerToSetRequest(
                        stickerset=types.InputStickerSetID(
                            id=sticker_id, access_hash=sticker_access_hash,
                        ),
                        sticker=types.InputStickerSetItem(
                            document=types.InputDocument(
                                id=message.sticker.id, access_hash=message.sticker.access_hash,
                                file_reference=message.sticker.file_reference
                            ),
                            emoji='some string here',

                        )
                    ))
                    print(result.stringify())

Expected behavior

AddStickerToSetRequest success

Actual behavior

The provided sticker set is invalid (caused by AddStickerToSetRequest)

Traceback

No response

Telethon version

1.35

Python version

3.11

Operating system (including distribution name and version)

windows 11

Other details

No response

Checklist

GodFatherClover commented 5 months ago

QQ截图20240602131152

the message.sticker is above picture show