Exemplo n.º 1
0
def join_channel(client: TelegramClient, channel) -> bool:
    """Join channel. Returns whether client joined or not."""
    try:
        client(channels.JoinChannelRequest(channel))

    except errors.RPCError:
        return False

    # Verify if client joined channel or not
    chat = client(channels.GetChannelsRequest([channel])).chats[0]

    return not chat.left and not chat.restricted
Exemplo n.º 2
0
def join(client, channel):
    request = channels.JoinChannelRequest(channel)
    request.resolve(client, telethon.utils)
    client(request)