Skip to content

Commit

Permalink
并发获取头像
Browse files Browse the repository at this point in the history
  • Loading branch information
xfgryujk committed Jul 4, 2019
1 parent 290b09f commit 2d86449
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions views/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ def send_message(self, cmd, data):
client.write_message(body)

async def _on_receive_danmaku(self, danmaku: blivedm.DanmakuMessage):
asyncio.ensure_future(self.__on_receive_danmaku(danmaku))

async def __on_receive_danmaku(self, danmaku: blivedm.DanmakuMessage):
if danmaku.uid == self.room_owner_uid:
author_type = 3 # 主播
elif danmaku.admin:
Expand Down Expand Up @@ -146,6 +149,9 @@ async def _on_receive_gift(self, gift: blivedm.GiftMessage):
})

async def _on_buy_guard(self, message: blivedm.GuardBuyMessage):
asyncio.ensure_future(self.__on_buy_guard(message))

async def __on_buy_guard(self, message: blivedm.GuardBuyMessage):
self.send_message(Command.ADD_MEMBER, {
'avatarUrl': await get_avatar_url(message.uid),
'timestamp': message.start_time,
Expand Down

0 comments on commit 2d86449

Please sign in to comment.