Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
AugustLigh committed Jun 1, 2024
1 parent 70ff1c0 commit 58ad996
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 48 deletions.
38 changes: 19 additions & 19 deletions AminoLightPy/amino_socket.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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": {
Expand Down
50 changes: 21 additions & 29 deletions AminoLightPy/lib/util/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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 = []
Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit 58ad996

Please sign in to comment.