Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.2.15
0.2.16
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
grpclib
pyee
requests
chatie-grpc==0.16.1
wechaty-puppet >= 0.0.17
chatie-grpc==0.17.dev4
wechaty-puppet== 0.0.18
34 changes: 27 additions & 7 deletions src/wechaty_puppet_hostie/puppet.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
# pylint: disable=E0401
from pyee import AsyncIOEventEmitter # type: ignore

from wechaty_puppet.schemas.types import PayloadType # type: ignore

from wechaty_puppet import ( # type: ignore
EventScanPayload,
ScanStatus,
Expand Down Expand Up @@ -510,10 +512,9 @@ async def contact_alias(self, contact_id: str, alias: Optional[str] = None

async def contact_payload_dirty(self, contact_id: str):
"""
# TODO this function has not been implement in chatie_grpc
:param contact_id:
:return:
mark the contact payload dirty status, and remove it from the cache
"""
await self.dirty_payload(PayloadType.PAYLOAD_TYPE_CONTACT, contact_id)

async def contact_payload(self, contact_id: str) -> ContactPayload:
"""
Expand Down Expand Up @@ -662,7 +663,7 @@ async def contact_self_qr_code(self) -> str:
:return:
"""

response = await self.puppet_stub.contact_self_q_r_code()
response = await self.puppet_stub.contact_self_qr_code()
return response.qrcode

async def contact_self_name(self, name: str):
Expand All @@ -689,17 +690,25 @@ async def room_validate(self, room_id: str) -> bool:

async def room_payload_dirty(self, room_id: str):
"""

mark the room payload dirty status, and remove it from the cache
:param room_id:
:return:
"""
await self.dirty_payload(
PayloadType.PAYLOAD_TYPE_ROOM,
room_id
)

async def room_member_payload_dirty(self, room_id: str):
"""

mark the room-member payload dirty status, and remove it from the cache
:param room_id:
:return:
"""
await self.dirty_payload(
PayloadType.PAYLOAD_TYPE_ROOM_MEMBER,
room_id
)

async def room_payload(self, room_id: str) -> RoomPayload:
"""
Expand Down Expand Up @@ -777,8 +786,10 @@ async def room_qr_code(self, room_id: str) -> str:
:param room_id:
:return:
"""
# TODO -> chatie-grpc packages has leave out id params
log.warning('room_qr_code() <room_id: %s> param is missing', room_id)
room_qr_code_response = await \
self.puppet_stub.room_q_r_code(id=room_id)
self.puppet_stub.room_qr_code()
return room_qr_code_response.qrcode

async def room_member_payload(self, room_id: str,
Expand Down Expand Up @@ -812,6 +823,15 @@ async def room_avatar(self, room_id: str) -> FileBox:
)
return file_box

async def dirty_payload(self, payload_type: PayloadType, payload_id: str):
"""
mark the payload dirty status, and remove it from the cache
"""
await self.puppet_stub.dirty_payload(
type=payload_type.value,
id=payload_id
)

def _init_puppet(self):
"""
start puppet channel contact_self_qr_code
Expand Down