CreateStickerSetRequest

Both users and bots can use this request. See code examples.

---functions---
stickers.createStickerSet#9021ab67 flags:# masks:flags.0?true emojis:flags.5?true text_color:flags.6?true user_id:InputUser title:string short_name:string thumb:flags.2?InputDocument stickers:Vector<InputStickerSetItem> software:flags.3?string = messages.StickerSet

Returns

messages.StickerSet

This type can be an instance of either:

StickerSetStickerSetNotModified

Parameters

user_idInputUserAnything entity-like will work if the library can find its Input version (e.g., usernames, Peer, User or Channel objects, etc.).
titlestring
short_namestring
stickersInputStickerSetItemA list must be supplied.
masksflagThis argument defaults to None and can be omitted.
emojisflagThis argument defaults to None and can be omitted.
text_colorflagThis argument defaults to None and can be omitted.
thumbInputDocumentThis argument defaults to None and can be omitted.
softwarestringThis argument defaults to None and can be omitted.

Known RPC errors

This request can cause 14 known errors:

BotMissingErrorThis method can only be run by a bot.
PackShortNameInvalidErrorInvalid sticker pack name. It must begin with a letter, can't contain consecutive underscores and must end in "_by_"..
PackShortNameOccupiedErrorA stickerpack with this name already exists.
PeerIdInvalidErrorAn invalid Peer was used. Make sure to pass the right peer type and that the value is valid (for instance, bots cannot start conversations).
ShortnameOccupyFailedErrorAn error occurred when trying to register the short-name used for the sticker pack. Try a different name.
StickersEmptyErrorNo sticker provided.
StickerEmojiInvalidErrorSticker emoji invalid.
StickerFileInvalidErrorSticker file invalid.
StickerPngDimensionsErrorSticker png dimensions invalid.
StickerPngNopngErrorStickers must be a png file but the used image was not a png.
StickerTgsNotgsErrorStickers must be a tgs file but the used file was not a tgs.
StickerThumbPngNopngErrorStickerset thumb must be a png file but the used file was not png.
StickerThumbTgsNotgsErrorStickerset thumb must be a tgs file but the used file was not tgs.
UserIdInvalidErrorInvalid object ID for a user. Make sure to pass the right types, for instance making sure that the request is designed for users or otherwise look for a different one more suited.

You can import these from telethon.errors.

Example

from telethon.sync import TelegramClient
from telethon import functions, types

with TelegramClient(name, api_id, api_hash) as client:
    result = client(functions.stickers.CreateStickerSetRequest(
        user_id='username',
        title='My awesome title',
        short_name='some string here',
        stickers=[types.InputStickerSetItem(
            document=types.InputDocument(
                id=-12398745604826,
                access_hash=-12398745604826,
                file_reference=b'arbitrary\x7f data \xfa here'
            ),
            emoji='some string here',
            mask_coords=types.MaskCoords(
                n=42,
                x=7.13,
                y=7.13,
                zoom=7.13
            ),
            keywords='some string here'
        )],
        masks=True,
        emojis=True,
        text_color=True,
        thumb=types.InputDocument(
            id=-12398745604826,
            access_hash=-12398745604826,
            file_reference=b'arbitrary\x7f data \xfa here'
        ),
        software='some string here'
    ))
    print(result.stringify())