diff --git a/AminoLightPy/amino_socket.py b/AminoLightPy/amino_socket.py index 4ca48c8..dc84302 100644 --- a/AminoLightPy/amino_socket.py +++ b/AminoLightPy/amino_socket.py @@ -192,6 +192,25 @@ def end_vc(self, comId: int, chatId: str, joinType: int = 2): joinType=joinType ) + def start_video_chat(self, comId: str, chatId: str, joinType: int = 1): + self.join_voice_chat( + comId=comId, + chatId=chatId, + joinType=joinType + ) + + data = { + "o": { + "ndcId": int(comId), + "threadId": chatId, + "joinRole": joinType, + "channelType": 4, + }, + "t": 108 + } + data = dumps(data) + self.client.send(data) + def Browsing(self, comId: int, blogId: str = None, blogType: int = 0): """ Send Browsing Action @@ -284,25 +303,6 @@ def LeaderBoards(self, comId: int,): data = dumps(data) self.client.send(data) - def start_video_chat(self, comId: str, chatId: str, joinType: int = 1): - self.join_video_chat( - comId=comId, - chatId=chatId, - joinType=joinType - ) - - data = { - "o": { - "ndcId": int(comId), - "threadId": chatId, - "joinRole": joinType, - "channelType": 4, - }, - "t": 108 - } - data = dumps(data) - self.client.send(data) - def typing_request(self, comId: int, chatId: str, stop: bool): data = { "o": { diff --git a/AminoLightPy/lib/util/objects.py b/AminoLightPy/lib/util/objects.py index 5d030c2..f11c3cc 100644 --- a/AminoLightPy/lib/util/objects.py +++ b/AminoLightPy/lib/util/objects.py @@ -344,7 +344,7 @@ def __init__(self, data): extensions = data.get("extensions") or {} style = extensions.get("style") or {} knowledgeBase = extensions.get("knowledgeBase") or {} - self.labels = WikiLabelList(extensions.get("props")).WikiLabelList + self.labels = WikiLabelList(extensions.get("props", [])).WikiLabelList self.wikiId = data.get("itemId") self.status = data.get("status") @@ -400,42 +400,40 @@ def __init__(self, data: Dict): def WikiList(self): return self - class WikiLabelList: __slots__ = ("json", "title", "content", "type") - def __init__(self, data: dict): - if not data: - for attr in self.__slots__: - setattr(self, attr, None) - - return + def __init__(self, data): self.json = data - self.title = data.get("title") - self.content = data.get("value") - self.type = data.get("type") + self.title = [] + self.content = [] + self.type = [] @property def WikiLabelList(self): + for x in self.json: + self.title.append(x.get("title")) + self.content.append(x.get("value")) + self.type.append(x.get("type")) return self class RankingTableList: __slots__ = ("json", "title", "level", "reputation", "id") def __init__(self, data: list[dict]): - if not data: - for attr in self.__slots__: - setattr(self, attr, None) - return self.json = data - self.title = tuple(x.get("title") for x in data) - self.level = tuple(x.get("level") for x in data) - self.reputation = tuple(x.get("reputation") for x in data) - self.id = tuple(x.get("id") for x in data) + self.title = [] + self.level = [] + self.reputation = [] + self.id = [] @property def RankingTableList(self): - + for x in self.json: + self.title.append(x.get("title")) + self.level.append(x.get("level")) + self.reputation.append(x.get("reputation")) + self.id.append(x.get("id")) return self class Community: @@ -890,15 +888,10 @@ class WikiCategoryList: ) def __init__(self, data): - if not data: - for attr in self.__slots__: - setattr(self, attr, None) - return + self.json = data _author = [x.get("author") for x in data] - self.json = data - self.author = UserProfileList(_author).UserProfileList self.itemsCount = [] self.parentCategoryId = [] @@ -930,18 +923,17 @@ class WikiCategory: "createdTime", "title", "mediaList", "icon", "parentType" ) def __init__(self, data): + self.json = data if not data: for attr in self.__slots__: setattr(self, attr, None) return - self.json = data - itemCategory = data.get("itemCategory") or {} childrenWrapper = data.get("childrenWrapper") or {} self.author = UserProfile(itemCategory.get("author")).UserProfile - self.subCategory = WikiCategoryList(childrenWrapper.get("itemCategoryList")).WikiCategoryList + self.subCategory = WikiCategoryList(childrenWrapper.get("itemCategoryList", [])).WikiCategoryList self.itemsCount = itemCategory.get("itemsCount") self.parentCategoryId = itemCategory.get("parentCategoryId")