Tian-que / nonebot-adapter-kaiheila

Kaiheila adapter for nonebot2
MIT License
27 stars 10 forks source link

[提问]如何获取指定频道用户信息 #26

Closed Agnes4m closed 11 months ago

Agnes4m commented 11 months ago

我尝试以下写法,并没有获取到任意的用户列表信息 e1fdece5cec3e3149329daf963b0064a 6b3413201ef2e60dbba49b3f4b1e5e8e

ssttkkl commented 11 months ago

频道ID的字段是event.group_id

Agnes4m commented 11 months ago

仍然无法获取列表

image image

ssttkkl commented 11 months ago

怀疑是代码有问题,这里方法写错了应该是GET,回头看一下 image

ssttkkl commented 11 months ago

channel/user-list这个API获取的是语音频道的用户列表 image

获取服务器用户列表需要使用guild/user-list image

ssttkkl commented 11 months ago

例如:

@on_command("test").handle()
async def test(bot: Bot, event: ChannelMessageEvent, matcher: Matcher):
    userlist = await bot.guild_userList(guild_id=event.extra.guild_id, channel_id=event.group_id)
    await matcher.send("\n".join(u.username for u in userlist.users))