Api使用Android app弹幕协议

This commit is contained in:
2019-01-28 18:54:24 +08:00
parent e46e4ec0d7
commit 5da70e81f9
7 changed files with 77 additions and 64 deletions

View File

@ -12,11 +12,11 @@ class MemberMsg:
def parse(self, json):
self.user = User(json)
if "Msg" in json:
if "action" in json["Msg"]:
self.type = json["Msg"]['action']
elif "content" in json["Msg"]:
self.content = json["Msg"]['content']
if "extra" in json:
if "action" in json["extra"]:
self.type = json["extra"]['action']
elif "content" in json["extra"]:
self.content = json["extra"]['content']
def __str__(self):
if self.type == 3:
@ -28,6 +28,7 @@ class MemberMsg:
elif self.type == 1:
return "{} 进入了房间".format(self.user)
else:
print(self.type)
return self.content.format(self.user)
def __unicode__(self):