wechaty / python-wechaty

Python Wechaty is a Conversational RPA SDK for Chatbot Makers written in Python
https://wechaty.readthedocs.io/zh_CN/latest/
Apache License 2.0
1.55k stars 229 forks source link

room.findall()获取当前所有群聊,为什么里面还有已经退出的群聊? #355

Closed xinxinyihao closed 1 year ago

xinxinyihao commented 1 year ago

requirements

Describe your problem

使用room.findall()获取当前所有群聊的时候,得到的结果,包含已经退出的群聊。

请问如何获取到当前最新的所有群聊啊

wj-Mcat commented 1 year ago

So why do you close this issue? Do you fix it or get some conclusions?

duanghuang commented 1 year ago

朋友,你的Friendship.search功能可以正常使用吗

xinxinyihao commented 1 year ago

So why do you close this issue? Do you fix it or get some conclusions?

因为我认为这个问题,和之前那个问题 #328 可能是同一个问题,你回答了是padlocal的问的,我就关掉了。

xinxinyihao commented 1 year ago

朋友,你的Friendship.search功能可以正常使用吗

我在文档中没有看到关于Friendship.search的相关调用。我看了你的问题 #366 ,如果你是想在你的好友列表里面搜索某个联系人的话,你应该用【联系人模块|Contact】模块里面的相关接口。比如:

        contact = await self.Contact.find_all()  # 获取一个列表, 里面包含了Bot所有的联系人
        contact = await self.Contact.find_all(ContactQueryFilter(name="lijiarui"))  # 获取一个包含所有名字为lijiarui的联系人的列表
        contact = await self.Contact.find_all(ContactQueryFilter(alias="ruirui"))   # 获取一个包含所有别名(备注)为ruirui的联系人列表

这里的搜索应该支持昵称、备注、联系人id,至于你写的那个直接搜索phone=xxxx,应该是不支持的。

希望可以帮助到你。

ghost commented 1 year ago

朋友,你的Friendship.search功能可以正常使用吗

我在文档中没有看到关于Friendship.search的相关调用。我看了你的问题 #366 ,如果你是想在你的好友列表里面搜索某个联系人的话,你应该用【联系人模块|Contact】模块里面的相关接口。比如:

        contact = await self.Contact.find_all()  # 获取一个列表, 里面包含了Bot所有的联系人
        contact = await self.Contact.find_all(ContactQueryFilter(name="lijiarui"))  # 获取一个包含所有名字为lijiarui的联系人的列表
        contact = await self.Contact.find_all(ContactQueryFilter(alias="ruirui"))   # 获取一个包含所有别名(备注)为ruirui的联系人列表

这里的搜索应该支持昵称、备注、联系人id,至于你写的那个直接搜索phone=xxxx,应该是不支持的。

希望可以帮助到你。

请教一下,有没有可以获取某个群所有成员的方法呀?

Pengchengistaken commented 1 year ago

朋友,你的Friendship.search功能可以正常使用吗

我在文档中没有看到关于Friendship.search的相关调用。我看了你的问题 #366 ,如果你是想在你的好友列表里面搜索某个联系人的话,你应该用【联系人模块|Contact】模块里面的相关接口。比如:

        contact = await self.Contact.find_all()  # 获取一个列表, 里面包含了Bot所有的联系人
        contact = await self.Contact.find_all(ContactQueryFilter(name="lijiarui"))  # 获取一个包含所有名字为lijiarui的联系人的列表
        contact = await self.Contact.find_all(ContactQueryFilter(alias="ruirui"))   # 获取一个包含所有别名(备注)为ruirui的联系人列表

这里的搜索应该支持昵称、备注、联系人id,至于你写的那个直接搜索phone=xxxx,应该是不支持的。 希望可以帮助到你。

请教一下,有没有可以获取某个群所有成员的方法呀?

可以试一下:

await room.ready()
members: List[Contact] = await room.member_list()
for member in members:
    await member.ready()
xinxinyihao commented 1 year ago

朋友,你的Friendship.search功能可以正常使用吗

我在文档中没有看到关于Friendship.search的相关调用。我看了你的问题 #366 ,如果你是想在你的好友列表里面搜索某个联系人的话,你应该用【联系人模块|Contact】模块里面的相关接口。比如:

        contact = await self.Contact.find_all()  # 获取一个列表, 里面包含了Bot所有的联系人
        contact = await self.Contact.find_all(ContactQueryFilter(name="lijiarui"))  # 获取一个包含所有名字为lijiarui的联系人的列表
        contact = await self.Contact.find_all(ContactQueryFilter(alias="ruirui"))   # 获取一个包含所有别名(备注)为ruirui的联系人列表

这里的搜索应该支持昵称、备注、联系人id,至于你写的那个直接搜索phone=xxxx,应该是不支持的。 希望可以帮助到你。

请教一下,有没有可以获取某个群所有成员的方法呀?

# 通过昵称来搜索群成员
room = await bot.Room.find('wechaty')
if room:
    # 查找一个房间里的联系人,如果获取到的联系人多于一个,则返回第一个
    member = await room.member('lijiarui')
    if member:
        print(f'wechaty 群聊内找到了联系人: {member.name()}')
    else:
        print(f'wechaty群聊内找不到该联系人')

希望可以帮助到你