diff --git a/worker/echo.py b/worker/echo.py index 7cbebcc..4ac5437 100644 --- a/worker/echo.py +++ b/worker/echo.py @@ -1,15 +1,13 @@ import random -from zzcore import StdAns +from zzcore import StdAns, mysakuya class Ans(StdAns): def GETMSG(self): if len(self.parms) < 2: return '不加参数是坏文明!' - - if self.uid != 1318000868: - for sakuya in ['口关夜','十六夜咲夜','十六夜','十六','咲夜','Sakuya','sakuya','Izayoi Sakuya','Izayoi','izayoi','izayoi sakuya']: - if sakuya in self.raw_msg['message']: - return "不许你们说咲夜!!" + + if mysakuya(self,self.raw_msg['message']) == False: + return "不许你们说咲夜!!" r = random.randint(1,3) if r == 1: diff --git a/worker/emmm.py b/worker/emmm.py index 491a8b6..e591451 100644 --- a/worker/emmm.py +++ b/worker/emmm.py @@ -1,4 +1,4 @@ -from zzcore import StdAns +from zzcore import StdAns, mysakuya class Ans(StdAns): @@ -11,10 +11,10 @@ class Ans(StdAns): def GETMSG(self): if self.parms: - if self.uid != 1318000868: - for sakuya in ['口关夜','十六夜咲夜','十六夜','十六','咲夜','Sakuya','sakuya','Izayoi Sakuya','Izayoi','izayoi','izayoi sakuya']: - if sakuya in self.parms[0]: - return "咲夜是最完美的!!" + + if mysakuya(self, self.parms[0]) == False: + return "咲夜是最完美的!!" + return '咱也不知道' + self.parms[0] + '是啥呢~' else: return '汝再调戏咱,咱可就生气了!!' diff --git a/worker/pixiv.py b/worker/pixiv.py index caa4511..b376309 100644 --- a/worker/pixiv.py +++ b/worker/pixiv.py @@ -1,4 +1,4 @@ -from zzcore import StdAns +from zzcore import StdAns, mysakuya import requests from config import LOLIKEY @@ -23,10 +23,10 @@ class Ans(StdAns): else: keyword = self.raw_msg['message'][7:] - if self.uid != 1318000868: - for sakuya in ['口关夜','十六夜咲夜','十六夜','十六','咲夜','Sakuya','sakuya','Izayoi Sakuya','Izayoi','izayoi','izayoi sakuya']: - if sakuya in keyword: - return "不许你们看咲夜的涩图!!" + + if mysakuya(self, keyword) == False: + return "不许你们看咲夜的涩图!!" + params['keyword'] = keyword try: resp = requests.get(url=url,params=params).json() diff --git a/zzcore.py b/zzcore.py index 1f37c15..8138e59 100644 --- a/zzcore.py +++ b/zzcore.py @@ -61,4 +61,15 @@ class StdAns(): data = { 'message_id' : msgid, } - requests.post(url = url, data = json.dumps(data),headers = Headers) \ No newline at end of file + requests.post(url = url, data = json.dumps(data),headers = Headers) + + +def mysakuya(self, words): + if self.uid == 1318000868: + return True + + if ('咲' in words and '夜' in words) or ('口关' in words and '夜' in words) or ('十' in words and '六' in words and '夜' in words) or ('1' in words and '6' in words and '夜' in words): + return False + for sakuya in ['口关夜','十六夜咲夜','十六夜','十六','咲夜','Sakuya','sakuya','Izayoi Sakuya','Izayoi','izayoi','izayoi sakuya']: + if sakuya in words: + return False \ No newline at end of file