Telethon/methods/stickers/create_sticker_set.html
2024-11-17 22:32:52 +01:00

51 lines
7.6 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>CreateStickerSetRequest</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link id="style" href="../../css/docs.dark.css" rel="stylesheet">
<script>
document.getElementById("style").href = "../../css/docs."
+ (localStorage.getItem("theme") || "light")
+ ".css";
</script>
<link href="https://fonts.googleapis.com/css?family=Nunito|Source+Code+Pro"
rel="stylesheet">
</head>
<body>
<div id="main_div"><ul class="horizontal"><li><a href="../../index.html">API</a></li><img src="../../img/arrow.svg" alt="/" /><li><a href="../index.html">Methods</a></li><img src="../../img/arrow.svg" alt="/" /><li><a href="index.html">Stickers</a></li><img src="../../img/arrow.svg" alt="/" /><li><a href="create_sticker_set.html">CreateStickerSetRequest</a></li></ul><h1>CreateStickerSetRequest</h1><p><strong>Both users and bots</strong> can use this request. <a href="#examples">See code examples.</a></p><pre>---functions---
stickers.createStickerSet#9021ab67 flags:# masks:flags.0?<a href="../../index.html#true">true</a> emojis:flags.5?<a href="../../index.html#true">true</a> text_color:flags.6?<a href="../../index.html#true">true</a> user_id:<a href="../../types/input_user.html">InputUser</a> title:<a href="../../index.html#string">string</a> short_name:<a href="../../index.html#string">string</a> thumb:flags.2?<a href="../../types/input_document.html">InputDocument</a> stickers:<a href="../../index.html#vector">Vector</a>&lt;<a href="../../types/input_sticker_set_item.html">InputStickerSetItem</a>&gt; software:flags.3?<a href="../../index.html#string">string</a> = <a href="../../types/messages/sticker_set.html">messages.StickerSet</a></pre><button onclick="cp('from telethon.tl.functions.stickers import CreateStickerSetRequest');">Copy import to the clipboard</button><h3>Returns</h3><table><tr><td><a href="../../types/messages/sticker_set.html">messages.StickerSet</a></td></tr></table><p>This type can be an instance of either:</p><table><tr><td><a href="../../constructors/messages/sticker_set.html">StickerSet</a></td><td><a href="../../constructors/messages/sticker_set_not_modified.html">StickerSetNotModified</a></td></tr></table><h3>Parameters</h3><table><tr><td><b>user_id</b></td><td style="text-align:center"><a href="../../types/input_user.html">InputUser</a></td><td>Anything entity-like will work if the library can find its <code>Input</code> version (e.g., usernames, <code>Peer</code>, <code>User</code> or <code>Channel</code> objects, etc.).</td></tr><tr><td><b>title</b></td><td style="text-align:center"><a href="../../index.html#string">string</a></td><td></td></tr><tr><td><b>short_name</b></td><td style="text-align:center"><a href="../../index.html#string">string</a></td><td></td></tr><tr><td><b>stickers</b></td><td style="text-align:center"><a href="../../types/input_sticker_set_item.html">InputStickerSetItem</a></td><td>A <span class="tooltip" title="Any iterable that supports len() will work too">list</span> must be supplied.</td></tr><tr><td><b>masks</b></td><td style="text-align:center"><a href="../../index.html#true">flag</a></td><td>This argument defaults to <code>None</code> and can be omitted.</td></tr><tr><td><b>emojis</b></td><td style="text-align:center"><a href="../../index.html#true">flag</a></td><td>This argument defaults to <code>None</code> and can be omitted.</td></tr><tr><td><b>text_color</b></td><td style="text-align:center"><a href="../../index.html#true">flag</a></td><td>This argument defaults to <code>None</code> and can be omitted.</td></tr><tr><td><b>thumb</b></td><td style="text-align:center"><a href="../../types/input_document.html">InputDocument</a></td><td>This argument defaults to <code>None</code> and can be omitted.</td></tr><tr><td><b>software</b></td><td style="text-align:center"><a href="../../index.html#string">string</a></td><td>This argument defaults to <code>None</code> and can be omitted.</td></tr></table><h1>Known RPC errors</h1><p>This request can cause 14 known errors:</p><table><tr><td><code>BotMissingError</code></td><td>This method can only be run by a bot.</td></tr><tr><td><code>PackShortNameInvalidError</code></td><td>Invalid sticker pack name. It must begin with a letter, can't contain consecutive underscores and must end in "_by_<bot username>"..</td></tr><tr><td><code>PackShortNameOccupiedError</code></td><td>A stickerpack with this name already exists.</td></tr><tr><td><code>PeerIdInvalidError</code></td><td>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).</td></tr><tr><td><code>ShortnameOccupyFailedError</code></td><td>An error occurred when trying to register the short-name used for the sticker pack. Try a different name.</td></tr><tr><td><code>StickersEmptyError</code></td><td>No sticker provided.</td></tr><tr><td><code>StickerEmojiInvalidError</code></td><td>Sticker emoji invalid.</td></tr><tr><td><code>StickerFileInvalidError</code></td><td>Sticker file invalid.</td></tr><tr><td><code>StickerPngDimensionsError</code></td><td>Sticker png dimensions invalid.</td></tr><tr><td><code>StickerPngNopngError</code></td><td>Stickers must be a png file but the used image was not a png.</td></tr><tr><td><code>StickerTgsNotgsError</code></td><td>Stickers must be a tgs file but the used file was not a tgs.</td></tr><tr><td><code>StickerThumbPngNopngError</code></td><td>Stickerset thumb must be a png file but the used file was not png.</td></tr><tr><td><code>StickerThumbTgsNotgsError</code></td><td>Stickerset thumb must be a tgs file but the used file was not tgs.</td></tr><tr><td><code>UserIdInvalidError</code></td><td>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.</td></tr></table><p>You can import these from <code>telethon.errors</code>.</p><h1 id="examples">Example</h1><pre><strong>from</strong> telethon.sync <strong>import</strong> TelegramClient
<strong>from</strong> telethon <strong>import</strong> functions, types
<strong>with</strong> TelegramClient(name, api_id, api_hash) <strong>as</strong> client:
result = client(functions.stickers.CreateStickerSetRequest(
user_id=<em>'username'</em>,
title=<em>'My awesome title'</em>,
short_name=<em>'some string here'</em>,
stickers=[types.InputStickerSetItem(
document=types.InputDocument(
id=-12398745604826,
access_hash=-12398745604826,
file_reference=<em>b'arbitrary\x7f data \xfa here'</em>
),
emoji=<em>'some string here'</em>,
mask_coords=types.MaskCoords(
n=42,
x=7.13,
y=7.13,
zoom=7.13
),
keywords=<em>'some string here'</em>
)],
masks=<strong>True</strong>,
emojis=<strong>True</strong>,
text_color=<strong>True</strong>,
thumb=types.InputDocument(
id=-12398745604826,
access_hash=-12398745604826,
file_reference=<em>b'arbitrary\x7f data \xfa here'</em>
),
software=<em>'some string here'</em>
))
print(result.stringify())</pre><textarea id="c" class="invisible"></textarea><script>function cp(t){var c=document.getElementById("c");c.value=t;c.select();try{document.execCommand("copy")}catch(e){}}</script></div><script>prependPath = "../../";</script><script src="../../js/search.js"></script></body></html>