简体   繁体   中英

GetDialogRequest for bot; telethon for python

i'm trying to implement a bot with an autodestruction function, and as suggested in another discussion, i'm trying to use only the telethon api. But when i'm trying to get all the user in a list like this:

chats = []
    last_date = None
    chunk_size = 900
    groups=[]   
    result = bot(GetDialogsRequest(
                offset_date=last_date,
                offset_id=0,
                offset_peer=InputPeerEmpty(),
                limit=chunk_size,
                hash = 0
            ))
    await chats.extend(result.chats)

    print('[+] scegli il gruppo dove vuoi bannare gli utenti:')
    i=0
    for g in groups:
        print('[' + str(i) + ']' + ' - '+ g.title )
        i+=1
    g_index = input("inserisci il numero del gruppo scelto: ")
    target_group=groups[int(g_index)]
 
    print("Seleziono gli utenti...")
    time.sleep(1)
    all_participants = []
    all_participants = await bot.get_participants(target_group, aggressive=False)

but it return this error, saying that i cannot use getDialogsRequest in a bot

telethon.errors.rpcerrorlist.BotMethodInvalidError: The API access for bot users is restricted. The method you tried to invoke cannot be executed as a bot (caused by GetDialogsRequest)

i don't know how to access the user list excluding the admins, any ideas?

Bot accounts cannot get dialogs. This is a Telegram limitation. There is no way around it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM