全面改为AndroidApi,添加抽奖识别及消息提示

This commit is contained in:
2019-01-29 13:50:29 +08:00
parent 14525ee76e
commit 8c0320c97e
10 changed files with 169 additions and 59 deletions

10
Chat.py
View File

@ -1,19 +1,27 @@
from User import User
from Lottery import Lottery
class Chat:
content: str =""
user: User=None
filterString:list = ["",]
isFiltered = False
def __init__(self, json=None):
def __init__(self, json=None, lottery:Lottery = None):
if json:
self.parse(json)
if lottery:
self.filterString.append(lottery.content)
def parse(self, json):
self.user = User(json)
if "extra" in json:
if "content" in json["extra"]:
self.content = json["extra"]['content']
if self.content in self.filterString:
self.isFiltered = True
def __str__(self):
return "{} : {}".format(self.user,self.content)