From 3623496fb9e88884b00fc5966a379826eb233eba Mon Sep 17 00:00:00 2001 From: Lonami Date: Thu, 15 Jun 2017 17:13:37 +0200 Subject: [PATCH] Let get_input_peer do its magic --- Joining-a-chat-or-channel.md | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/Joining-a-chat-or-channel.md b/Joining-a-chat-or-channel.md index 3c01a00..41e6845 100644 --- a/Joining-a-chat-or-channel.md +++ b/Joining-a-chat-or-channel.md @@ -6,10 +6,7 @@ Once you have the [entity](Retrieving-an-entity) of the channel you want to join ```python from telethon.tl.functions.channels import JoinChannelRequest -from telethon.helpers import get_input_peer - -input_channel = get_input_peer(channel) -client.invoke(JoinChannelRequest(input_channel)) +client.invoke(JoinChannelRequest(channel)) # In the same way, you can also leave such channel from telethon.tl.functions.channels import LeaveChannelRequest @@ -24,7 +21,6 @@ If all you have is a link like this one: `https://t.me/joinchat/AAAAAFFszQPyPEZ7 ```python from telethon.tl.functions.messages import ImportChatInviteRequest - updates = client.invoke(ImportChatInviteRequest('AAAAAEHbEkejzxUjAUCfYg')) ``` @@ -34,11 +30,10 @@ If you don't want to add yourself, maybe because you're already in, you can alwa ```python from telethon.tl.functions.messages import AddChatUserRequest -from telethon.helpers import get_input_peer client.invoke(AddChatUserRequest( chat_id, - get_input_peer(user_to_add), + user_to_add, fwd_limit=10 # allow the user to see the 10 last messages )) ``` \ No newline at end of file