python-wechaty icon indicating copy to clipboard operation
python-wechaty copied to clipboard

如何获取用户的群昵称

Open huangmu168 opened this issue 4 years ago • 7 comments

roon_nick_name = await my_room.alias(member)
#获取的是空值,why?

huangmu168 avatar Jul 02 '20 06:07 huangmu168

Sorry, It's not supported now, which can't get the room-member alias.

wj-Mcat avatar Jul 02 '20 06:07 wj-Mcat

@wj-Mcat I have labeled this issue with good first issue because I believe that this feature can be implemented within 10 lines of the Python code. :)

huan avatar Jul 02 '20 07:07 huan

@huan The basic interface is implemented:

if room:
    alias = await room.alias(from_contact)
    print("alias: " + alias)

But, all the alias variable is an empty string. I asked 百年 before, he telled me that this was not supported now, when I wrote the DingDongRankPlugin . So, I leave it to now.

wj-Mcat avatar Jul 02 '20 07:07 wj-Mcat

Oh yes, it perhaps that the donut puppet does not support the room alias.

However, we have other puppets like padplus, which I'm sure the padplus can support this feature.

huan avatar Jul 02 '20 07:07 huan

Oh yes, it perhaps that the donut puppet does not support the room alias.

However, we have other puppets like padplus, which I'm sure the padplus can support this feature.

那么,我是要切换协议吗?

huangmu168 avatar Jul 02 '20 07:07 huangmu168

Does the web-wechaty support this or not?

alingse avatar Sep 22 '21 15:09 alingse

puppet-padlocal 能够正确获得群昵称。

from typing import List
from wechaty import  Wechaty, WechatyPlugin,Contact, Room


class RoomPlugin(WechatyPlugin):
    async def init_plugin(self, wechaty: Wechaty) -> None:
        room: Room = wechaty.Room.load("3xxxxxxxxxx@chatroom")
        await room.ready()
        members: List[Contact] = await room.member_list()
        for member in members:
            room_alias = await room.alias(member)
            print(member.name,room_alias)

YanCore avatar Nov 27 '22 14:11 YanCore