This repository has been archived on 2022-05-30. You can view files and clone it, but cannot push or open issues or pull requests.
2019-04-07 16:01:27 +08:00

32 lines
731 B
Python

from .User import User
from .Lottery import Lottery
class Chat:
content =""
user=None
filterString = ["",]
isFiltered = False
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)
def __unicode__(self):
return self.__str__()