async def get_user_presence(self, user_id: str, context: Any) -> UserPresence: user_info = context.get(user_id) if user_info is None: raise UnknownError( "User {} not in friend list (plugin only supports fetching presence for friends)" .format(user_id)) return from_user_info(user_info, self._translations_cache)
def user_presence_update_handler(user_id: str, user_info: UserInfo): self.update_user_presence( user_id, from_user_info(user_info, self._translations_cache))
def user_presence_update_handler(user_id: str, user_info: UserInfo): self.update_user_presence(user_id, from_user_info(user_info))
def test_from_user_info(user_info, user_presence): assert from_user_info(user_info) == user_presence
def test_from_user_info(user_info, user_presence): assert from_user_info( user_info, { 1512: translations_cache_mock_dataclass(), 1513: translations_cache_parametrized_mock_dataclass() }) == user_presence