Пример #1
0
    async def __ws_friend_location(self, content):
        world = aobjects.World(content["world"])
        user = aobjects.User(content["user"])
        location = aobjects.Location(content["location"])
        instance = aobjects.Instance(content["instance"])

        self.on_friend_location(user, world, location, instance)
Пример #2
0
    async def fetch_user_by_name(self, name):
        '''
        Used to get a user via id

            name, string
            Name of the user

        Returns User object
        '''

        resp = await self.api.call("/users/"+urllib.parse.urlencode(name)+"/name")
        return aobjects.User(self, resp["data"])
Пример #3
0
    async def fetch_user_by_id(self, id):
        '''
        Used to get a user via id

            id, string
            UserId of the user

        Returns User object
        '''

        resp = await self.api.call("/users/"+id)
        return aobjects.User(self, resp["data"])
Пример #4
0
    async def _ws_friend_location(self, content):
        user = aobjects.User(self, content["user"])

        if content["location"] == "private":
            await self.on_friend_location(user, None, None, None)
            return

        try:
            world = aobjects.World(self, content["world"])
        except IntegretyError:
            world = await self.fetch_world(content["world"]["id"])

        instance = await world.fetch_instance(content["instance"])
        location = aobjects.Location(self, content["location"])

        self._update_friend(user, user.id)
        await self.on_friend_location(user, world, location, instance)
Пример #5
0
 async def __ws_friend_active(self, content):
     self.on_friend_active(aobjects.User(content["user"]))
Пример #6
0
 async def _ws_friend_update(self, content):
     user = aobjects.User(self, content["user"])
     self._update_friend(user, user.id)
     await self.on_friend_update(user)