Python Forum
Help needed adding a certain Argument
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help needed adding a certain Argument
#1
I need to add a specific Argument at get_channel_participants. For some bloody reason, I can't. Here is the reference from Telethon's documentation (iter_participants is the same with get_participants): http://telethon.readthedocs.io/en/latest...rticipants. I am looking to add "aggressive". I tried a lot of variants and I failed every time.

Note: I am quite a newbie, so please excuse my rough language. I used the documentation above to write the code below, but I have hit a wall...Thank you in advance.

Note 2: The code itself works like a charm, but if I add "aggressive" it doesn't. For me, using the argument is compulsory.

from telethon import TelegramClient
from telethon.tl.functions.contacts import ResolveUsernameRequest
from telethon.tl.functions.channels import GetAdminLogRequest
from telethon.tl.functions.channels import GetParticipantsRequest
from telethon.tl.types import ChannelParticipantsSearch
from telethon.tl.types import InputChannel
from telethon.tl.types import ChannelAdminLogEventsFilter
from telethon.tl.types import InputUserSelf
from telethon.tl.types import InputUser
from time import sleep
def get_channel_participants(channel, offset, batch_size):
    api_id = 2vbdg
    api_hash = 'gvf6483f445c1'
    phone_number = '+lfd03'
    client = TelegramClient(phone_number, api_id, api_hash)
    client.start()
    offset = 0
    limit = 100
    all_participants = []
    while True:
        participants = client(GetParticipantsRequest(
            channel, ChannelParticipantsSearch(''), offset, batch_size,
            hash=0
        ))
        if not participants.users:
            break
        all_participants.extend(participants.users)
        offset += len(participants.users)
        sleep(5)
    return all_participants
 
users = get_channel_participants('asdfasdf1234123', 0, 100)
len(users)
Reply
#2
please, post your attempt to add aggressive argument and the full traceback you get
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#3
(Apr-29-2018, 05:20 PM)buran Wrote: please, post your attempt to add aggressive argument and the full traceback you get
Believe me or not, I made it work somehow. I am simply batshit retarded, I cannot believe it took me so much time...I don't even want to tell you what I was supposed to add, I would be too ashamed to do that.

Thanks anyway, glad to have found this cool forum. I am sure I'll return here in the near future~
Reply
#4
Take it easy lad, that's part of coding, in some form or another it happens to all of us =) Glad you got it working!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  SyntaxError: positional argument follows keyword argument syd_jat 3 5,852 Mar-03-2020, 08:34 AM
Last Post: buran
  Adding markers to Folium map only adding last element. tantony 0 2,133 Oct-16-2019, 03:28 PM
Last Post: tantony
  Adding a parameter/argument to a script jehoshua 11 9,452 Jan-29-2018, 09:45 AM
Last Post: jehoshua

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020