if not isinstance(public_channel, PublicVoiceChannel):
return
users = await public_channel.fetch_user_list()
Expected behavior
正常获取到语音频道用户列表
Logs/Screenshots
报错如下:
Traceback (most recent call last):
File "\venv\lib\site-packages\khl\client.py", line 112, in safe_handler
await handler(msg)
File "\venv\lib\site-packages\khl\bot\bot.py", line 142, in handler
await event_handler(self, event)
File "\plugins\kook\__init__.py", line 49, in handle_kook_join_channel
users = await public_channel.fetch_user_list()
File "\venv\lib\site-packages\khl\channel.py", line 183, in fetch_user_list
users = await self.gate.exec_paged_req(api.Channel.userList(channel_id=self.id))
File "\venv\lib\site-packages\khl\gateway.py", line 34, in exec_paged_req
return await self.requester.exec_paged_req(r, **kwargs)
File "\venv\lib\site-packages\khl\requester.py", line 81, in exec_paged_req
ret.extend(p['items'])
TypeError: list indices must be integers or slices, not str
而 khl 中调用 requester.py 中的 exec_paged_req 函数,data 部分实际上为 list,exec_paged_req 按照 dict 处理,取 p['items'],因此报错 TypeError: list indices must be integers or slices, not str
Describe the bug 使用 fetch_user_list 报错
To Reproduce
Expected behavior 正常获取到语音频道用户列表
Logs/Screenshots 报错如下:
Environment
Additional context
/api/v3/channel/user-list
接口返回格式为:而 khl 中调用
requester.py
中的exec_paged_req
函数,data 部分实际上为 list,exec_paged_req
按照 dict 处理,取p['items']
,因此报错TypeError: list indices must be integers or slices, not str