尝试从我自己的电报频道(Telethon API)获取用户时获取权限错误

时间:2018-01-23 14:14:21

标签: python python-3.x telegram python-telegram-bot

当我尝试将用户放入我自己的电报频道时,我正在使用Telethon API并在函数 GetParticipantsRequest 中获得权限错误,其中我是管理员。

telethon.errors.rpc_error_list.ChatAdminRequiredError: (ChatAdminRequiredError(...), 'Chat admin privileges are required to do that in the specified chat (for e
xample, to send a message in a channel which is not yours)')

没有任何意义,因为当我使用我的电报执行相同的代码例程时,它就像一个魅力。

以下是常规:

def getUserNames(channel):
offset = 0
limit = 100
all_participants = []
selected_participants = []
channel = client(ResolveUsernameRequest(channel))
channel = InputChannel(channel.chats[0].id, channel.chats[0].access_hash)       

while True:
    participants = client(
        GetParticipantsRequest(channel, ChannelParticipantsSearch(''), offset, limit, 0)
    )
    if not participants.users:
        break
    all_participants.extend(participants.users)
    offset += len(participants.users)

if len(all_participants):
    for x in all_participants:
        if x.username: selected_participants.append(x.username)
    print (selected_participants)
    return selected_participants
else:
    return -1

我在这里找不到什么东西?

0 个答案:

没有答案