コード例 #1
0
    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)
コード例 #2
0
 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))
コード例 #3
0
 def user_presence_update_handler(user_id: str, user_info: UserInfo):
     self.update_user_presence(user_id, from_user_info(user_info))
コード例 #4
0
def test_from_user_info(user_info, user_presence):
    assert from_user_info(user_info) == user_presence
コード例 #5
0
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