pythontelethon

telethon error when getting a link to a folder


I do everything according to the documentation, here is the link https://tl.telethon.dev/methods/chatlists/export_chatlist_invite.html and here is my code:

    result = client(functions.chatlists.ExportChatlistInviteRequest(
        chatlist=types.InputChatlistDialogFilter(
            filter_id=42
        ),
        title='lol',
        peers=include_peers
    ))
    print(result.stringify())

there is one public channel and one public chat in the folder, but for some reason it gives an error telethon.errors.rpcerrorlist.FilterNotSupportedError: The specified filter cannot be used in this context (caused by ExportChatlistInviteRequest)

in the include_peers, those chats that are in the folder, I added them using telethon and then I tried get the link

I tried to change different filters and asked gpt, there are no results, but this particular filter is in the documentation


Solution

  • I have added dummy values to show you working code so change the values accordingly -

    result = client(functions.chatlists.ExportChatlistInviteRequest(
        chatlist=types.InputChatlistDialogFilter(
            filter_id=291
        ),
        title='Folder Name',
        peers=[
            PeerChannel(channel_id=200325454640421), 
            PeerChannel(channel_id=205924512704101)
        ]
    ))
    
    print(result.stringify())