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:
StickerSet | StickerSetNotModified |
Parameters
user_id | InputUser | Anything entity-like will work if the library can find its Input version (e.g., usernames, Peer , User or Channel objects, etc.). |
title | string | |
short_name | string | |
stickers | InputStickerSetItem | A list must be supplied. |
masks | flag | This argument defaults to None and can be omitted. |
emojis | flag | This argument defaults to None and can be omitted. |
text_color | flag | This argument defaults to None and can be omitted. |
thumb | InputDocument | This argument defaults to None and can be omitted. |
software | string | This argument defaults to None and can be omitted. |
Known RPC errors
This request can cause 14 known errors:
BotMissingError | This method can only be run by a bot. |
PackShortNameInvalidError | Invalid sticker pack name. It must begin with a letter, can't contain consecutive underscores and must end in "_by_ |
PackShortNameOccupiedError | A stickerpack with this name already exists. |
PeerIdInvalidError | An invalid Peer was used. Make sure to pass the right peer type and that the value is valid (for instance, bots cannot start conversations). |
ShortnameOccupyFailedError | An error occurred when trying to register the short-name used for the sticker pack. Try a different name. |
StickersEmptyError | No sticker provided. |
StickerEmojiInvalidError | Sticker emoji invalid. |
StickerFileInvalidError | Sticker file invalid. |
StickerPngDimensionsError | Sticker png dimensions invalid. |
StickerPngNopngError | Stickers must be a png file but the used image was not a png. |
StickerTgsNotgsError | Stickers must be a tgs file but the used file was not a tgs. |
StickerThumbPngNopngError | Stickerset thumb must be a png file but the used file was not png. |
StickerThumbTgsNotgsError | Stickerset thumb must be a tgs file but the used file was not tgs. |
UserIdInvalidError | Invalid 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())