mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-25 19:03:46 +03:00
26 lines
5.6 KiB
HTML
26 lines
5.6 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
|
<title>InviteToChannelRequest</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">Channels</a></li><img src="../../img/arrow.svg" alt="/" /><li><a href="invite_to_channel.html">InviteToChannelRequest</a></li></ul><h1>InviteToChannelRequest</h1><p><strong>Only users</strong> can use this request. <a href="#examples">See code examples.</a></p><pre>---functions---
|
|
channels.inviteToChannel#c9e33d54 channel:<a href="../../types/input_channel.html">InputChannel</a> users:<a href="../../index.html#vector">Vector</a><<a href="../../types/input_user.html">InputUser</a>> = <a href="../../types/messages/invited_users.html">messages.InvitedUsers</a></pre><button onclick="cp('from telethon.tl.functions.channels import InviteToChannelRequest');">Copy import to the clipboard</button><h3>Returns</h3><table><tr><td><a href="../../types/messages/invited_users.html">messages.InvitedUsers</a></td></tr></table><p>This type can only be an instance of:</p><table><tr><td><a href="../../constructors/messages/invited_users.html">InvitedUsers</a></td></tr></table><h3>Parameters</h3><table><tr><td><b>channel</b></td><td style="text-align:center"><a href="../../types/input_channel.html">InputChannel</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>users</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.). A <span class="tooltip" title="Any iterable that supports len() will work too">list</span> must be supplied.</td></tr></table><h1>Known RPC errors</h1><p>This request can cause 17 known errors:</p><table><tr><td><code>BotsTooMuchError</code></td><td>There are too many bots in this chat/channel.</td></tr><tr><td><code>BotGroupsBlockedError</code></td><td>This bot can't be added to groups.</td></tr><tr><td><code>ChannelInvalidError</code></td><td>Invalid channel object. Make sure to pass the right types, for instance making sure that the request is designed for channels or otherwise look for a different one more suited.</td></tr><tr><td><code>ChannelPrivateError</code></td><td>The channel specified is private and you lack permission to access it. Another reason may be that you were banned from it.</td></tr><tr><td><code>ChatAdminRequiredError</code></td><td>Chat admin privileges are required to do that in the specified chat (for example, to send a message in a channel which is not yours), or invalid permissions used for the channel or group.</td></tr><tr><td><code>ChatInvalidError</code></td><td>The chat is invalid for this request.</td></tr><tr><td><code>ChatWriteForbiddenError</code></td><td>You can't write in this chat.</td></tr><tr><td><code>InputUserDeactivatedError</code></td><td>The specified user was deleted.</td></tr><tr><td><code>UsersTooMuchError</code></td><td>The maximum number of users has been exceeded (to create a chat, for example).</td></tr><tr><td><code>UserBannedInChannelError</code></td><td>You're banned from sending messages in supergroups/channels.</td></tr><tr><td><code>UserBlockedError</code></td><td>User blocked.</td></tr><tr><td><code>UserBotError</code></td><td>Bots can only be admins in channels..</td></tr><tr><td><code>UserChannelsTooMuchError</code></td><td>One of the users you tried to add is already in too many channels/supergroups.</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><tr><td><code>UserKickedError</code></td><td>This user was kicked from this supergroup/channel.</td></tr><tr><td><code>UserNotMutualContactError</code></td><td>The provided user is not a mutual contact.</td></tr><tr><td><code>UserPrivacyRestrictedError</code></td><td>The user's privacy settings do not allow you to do this.</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.channels.InviteToChannelRequest(
|
|
channel=<em>'username'</em>,
|
|
users=[<em>'username'</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> |