From 07e02cf4755bbfb5a1cb80ee8be08444bef15231 Mon Sep 17 00:00:00 2001 From: SuperSonic Date: Sun, 1 Sep 2019 10:51:45 +0800 Subject: [PATCH] v6.5.0-beta_RC3 --- libs/i18n/en.py | 10 +++--- libs/i18n/zh_TW.py | 10 +++--- libs/yuuki.py | 87 ++++++++++++++++++++++++++++++---------------- 3 files changed, 70 insertions(+), 37 deletions(-) diff --git a/libs/i18n/en.py b/libs/i18n/en.py index 8be5fdc..cd63453 100644 --- a/libs/i18n/en.py +++ b/libs/i18n/en.py @@ -17,20 +17,22 @@ class English: i18nText = { "Helllo^^\nMy name is %s ><\nNice to meet you OwO": "Helllo^^\nMy name is %s ><\nNice to meet you OwO", - "Type:\n\t%s/Help\nto get more information\n\nAdmin of the Group:\n%s": "Type:\n\t%s/Help\nto get more information\n\nAdmin of the Group:\n%s", + "Type:\n\t%s/Help\nto get more information\n\nMain Admin of the Group:\n%s": "Type:\n\t%s/Help\nto get more information\n\nMain Admin of the Group:\n%s", "%s\n\t%s\n\nCommands Info:\n%s\n\nPrivacy:\n%s\n\nMore Information:\n%s\n\n%s": "%s\n\t%s\n\nCommands Info:\n%s\n\nPrivacy:\n%s\n\nMore Information:\n%s\n\n%s", - "URL:%s\nInvite:%s\nJoin:%s\nMembers:%s\n\nAdmin of the Group:\n%s": "URL:%s\nInvite:%s\nJoin:%s\nMembers:%s\n\nAdmin of the Group:\n%s", + "SecurityService is Listening on\n\nURL:%s\nInvite:%s\nJoin:%s\nMembers:%s\n\nMain Admin of the Group:\n%s": "SecurityService is Listening on\n\nURL:%s\nInvite:%s\nJoin:%s\nMembers:%s\n\nMain Admin of the Group:\n%s", "Wrong UserID or the guy is not in Group": "Wrong UserID or the guy is not in Group", - "Default without Initialize\nAdmin of the Group:\n%s": "Default without Initialize\nAdmin of the Group:\n%s", + "Default without Initialize\nMain Admin of the Group:\n%s": "Default without Initialize\nMain Admin of the Group:\n%s", "Sorry...\nThe number of members is not satisfied (%s needed)": "Sorry...\nThe number of members is not satisfied (%s needed)", "Name:%s\nPicture URL:%s/%s\nStatusMessage:\n%s\nLINE System UserID:%s": "Name:%s\nPicture URL:%s/%s\nStatusMessage:\n%s\nLINE System UserID:%s", "LINE System UserID:\n": "LINE System UserID:\n", + "SecurityService of %s was disable": "SecurityService of %s was disable", "DO NOT KICK, thank you ^^": "DO NOT KICK, thank you ^^", - "DO NOT TOUCH THE GROUP URL SETTINGs, see you...": "DO NOT TOUCH THE GROUP URL SETTINGs, see you...", + "DO NOT ENABLE THE GROUP URL STATUS, see you...": "DO NOT ENABLE THE GROUP URL STATUS, see you...", "Do not invite anyone...thanks": "Do not invite anyone...thanks", "The User(s) was in our blacklist database.": "The User(s) was in our blacklist database.", "You are our blacklist. Bye~": "You are our blacklist. Bye~", "You had been blocked by our database.": "You had been blocked by our database.", + "\nExtend Administrator(s)": "\nExtend Administrator(s)", "Kick Limit.": "Kick Limit.", "Cancel Limit.": "Cancel Limit.", "Testing...": "Testing...", diff --git a/libs/i18n/zh_TW.py b/libs/i18n/zh_TW.py index 448d9b4..88a4ad1 100644 --- a/libs/i18n/zh_TW.py +++ b/libs/i18n/zh_TW.py @@ -17,20 +17,22 @@ class Traditional_Chinese: i18nText = { "Helllo^^\nMy name is %s ><\nNice to meet you OwO": "安安^^\n我是%s呦><\n請多多指教OwO", - "Type:\n\t%s/Help\nto get more information\n\nAdmin of the Group:\n%s": "請輸入:\n\t%s/Help\n以獲得更多資訊\n\n本群組管理員為:\n%s", + "Type:\n\t%s/Help\nto get more information\n\nMain Admin of the Group:\n%s": "請輸入:\n\t%s/Help\n以獲得更多資訊\n\n本群組主管理員為:\n%s", "%s\n\t%s\n\nCommands Info:\n%s\n\nPrivacy:\n%s\n\nMore Information:\n%s\n\n%s": "%s\n\t%s\n\n指令資訊:\n%s\n\n隱私權政策:\n%s\n\n更多資訊:\n%s\n\n%s", - "URL:%s\nInvite:%s\nJoin:%s\nMembers:%s\n\nAdmin of the Group:\n%s": "網址:%s\n邀請:%s\n加入:%s\n成員:%s\n\n本群組管理員為:\n%s", + "SecurityService is Listening on\n\nURL:%s\nInvite:%s\nJoin:%s\nMembers:%s\n\nMain Admin of the Group:\n%s": "安全防護模式正在監控\n\n網址:%s\n邀請:%s\n加入:%s\n成員:%s\n\n本群組主管理員為:\n%s", "Wrong UserID or the guy is not in Group": "錯誤的用戶識別碼或這傢伙不在群組", - "Default without Initialize\nAdmin of the Group:\n%s": "使用系統預設值,並未初始化\n本群組管理員為:\n%s", + "Default without Initialize\nMain Admin of the Group:\n%s": "使用系統預設值,並未初始化\n本群組主管理員為:\n%s", "Sorry...\nThe number of members is not satisfied (%s needed)": "抱歉...\n這個群尚未達到可安裝人數 (需要%s人)", "Name:%s\nPicture URL:%s/%s\nStatusMessage:\n%s\nLINE System UserID:%s": "名字:%s\n頭像網址:%s/%s\n個性簽名:\n%s\nLINE用戶識別碼:%s", "LINE System UserID:\n": "LINE用戶識別碼:\n", + "SecurityService of %s was disable": "%s的安全防護模式被已關閉", "DO NOT KICK, thank you ^^": "請不要踢人,謝謝 =3=", - "DO NOT TOUCH THE GROUP URL SETTINGs, see you...": "請不要動到網址設定,再見了 0.0", + "DO NOT ENABLE THE GROUP URL STATUS, see you...": "請不要開啟群組網址,再見了 0.0", "Do not invite anyone...thanks": "請不要邀請任何人,感謝配合 OwO", "The User(s) was in our blacklist database.": "這個臭小子在我們的黑名單中 =.=", "You are our blacklist. Bye~": "再見了~黑名單用戶。", "You had been blocked by our database.": "您目前已被本程序封鎖。", + "\nExtend Administrator(s)": "\n延伸管理員", "Kick Limit.": "踢人次數已達上限", "Cancel Limit.": "取消次數已達上限", "Testing...": "測試中...", diff --git a/libs/yuuki.py b/libs/yuuki.py index af51205..8498976 100644 --- a/libs/yuuki.py +++ b/libs/yuuki.py @@ -18,9 +18,9 @@ class Yuuki_Settings: config = { "name": "Yuuki", - "version": "v6.5.0-beta_RC2", + "version": "v6.5.0-beta_RC3", "project_url": "https://tinyurl.com/syb-yuuki", - "man_page": "None", + "man_page": "https://tinyurl.com/yuuki-manual", "privacy_page": "OpenSource - Licensed under MPL 2.0", "copyright": "(c)2019 Star Inc.", @@ -394,7 +394,7 @@ class Yuuki: GroupJoined_.append(GroupID) self.YuukiVariable["GroupJoined"] = GroupJoined_ self.sendText(GroupID, _("Helllo^^\nMy name is %s ><\nNice to meet you OwO") % self.YuukiConfigs["name"]) - self.sendText(GroupID, _("Type:\n\t%s/Help\nto get more information\n\nAdmin of the Group:\n%s") % + self.sendText(GroupID, _("Type:\n\t%s/Help\nto get more information\n\nMain Admin of the Group:\n%s") % (self.YuukiConfigs["name"], self.sybGetGroupCreator(GroupInfo).displayName,)) self.getGroupTicket(GroupID, self.MyMID, True) for userId in self.Connect.helper_ids: @@ -459,7 +459,10 @@ class Yuuki: if ncMessage.message.toType == MIDType.GROUP: GroupInfo = self.getClient(self.MyMID).getGroup(ncMessage.message.to) GroupPrivilege = self.Admin + [self.sybGetGroupCreator(GroupInfo).mid] + self.data.getGroup(GroupInfo.id)["Ext_Admin"] - if ncMessage.message.from_ in GroupPrivilege: + if not self.YuukiVariable["SecurityService"]: + self.sendText(self.sendToWho(ncMessage), + _("SecurityService of %s was disable") % (self.YuukiConfigs["name"],)) + elif ncMessage.message.from_ in GroupPrivilege: status = [] for code in msgSep: try: @@ -467,12 +470,18 @@ class Yuuki: except: pass self.enableSecurityStatus(ncMessage.message.to, status) - self.sendText(self.sendToWho(ncMessage), _("Okay")) + if status != []: + self.sendText(self.sendToWho(ncMessage), _("Okay")) + else: + self.sendText(self.sendToWho(ncMessage), _("Not Found")) elif self.YuukiConfigs["name"] + '/Disable' == msgSep[0]: if ncMessage.message.toType == MIDType.GROUP: GroupInfo = self.getClient(self.MyMID).getGroup(ncMessage.message.to) GroupPrivilege = self.Admin + [self.sybGetGroupCreator(GroupInfo).mid] + self.data.getGroup(GroupInfo.id)["Ext_Admin"] - if ncMessage.message.from_ in GroupPrivilege: + if not self.YuukiVariable["SecurityService"]: + self.sendText(self.sendToWho(ncMessage), + _("SecurityService of %s was disable") % (self.YuukiConfigs["name"],)) + elif ncMessage.message.from_ in GroupPrivilege: status = [] for code in msgSep: try: @@ -480,41 +489,61 @@ class Yuuki: except: pass self.disableSecurityStatus(ncMessage.message.to, status) - self.sendText(self.sendToWho(ncMessage), _("Okay")) + if status != []: + self.sendText(self.sendToWho(ncMessage), _("Okay")) + else: + self.sendText(self.sendToWho(ncMessage), _("Not Found")) elif self.YuukiConfigs["name"] + '/ExtAdmin' == msgSep[0]: if ncMessage.message.toType == MIDType.GROUP: GroupInfo = self.getClient(self.MyMID).getGroup(ncMessage.message.to) GroupPrivilege = self.Admin + [self.sybGetGroupCreator(GroupInfo).mid] - if ncMessage.message.from_ in GroupPrivilege and len(msgSep) == 3: - if msgSep[1] == "add": - if msgSep[2] in [Member.mid for Member in GroupInfo.members]: + if len(msgSep) == 3: + if ncMessage.message.from_ in GroupPrivilege: + if msgSep[1] == "add": + if msgSep[2] in [Member.mid for Member in GroupInfo.members]: + if msgSep[2] in self.data.getGroup(GroupInfo.id)["Ext_Admin"]: + self.sendText(self.sendToWho(ncMessage), _("Added")) + elif msgSep[2] not in self.data.getData("BlackList"): + self.data.updateData(self.data.getGroup(GroupInfo.id)["Ext_Admin"], True, msgSep[2]) + self.sendText(self.sendToWho(ncMessage), _("Okay")) + else: + self.sendText(self.sendToWho(ncMessage), _("The User(s) was in our blacklist database.")) + else: + self.sendText(self.sendToWho(ncMessage), _("Wrong UserID or the guy is not in Group")) + elif msgSep[1] == "delete": if msgSep[2] in self.data.getGroup(GroupInfo.id)["Ext_Admin"]: - self.sendText(self.sendToWho(ncMessage), _("Added")) - elif msgSep[2] not in self.data.getData("BlackList"): - self.data.updateData(self.data.getGroup(GroupInfo.id)["Ext_Admin"], True, msgSep[2]) + self.data.updateData(self.data.getGroup(GroupInfo.id)["Ext_Admin"], False, msgSep[2]) self.sendText(self.sendToWho(ncMessage), _("Okay")) else: - self.sendText(self.sendToWho(ncMessage), _("The User(s) was in our blacklist database.")) - else: - self.sendText(self.sendToWho(ncMessage), _("Wrong UserID or the guy is not in Group")) - elif msgSep[1] == "delete": - if msgSep[2] in self.data.getGroup(GroupInfo.id)["Ext_Admin"]: - self.data.updateData(self.data.getGroup(GroupInfo.id)["Ext_Admin"], False, msgSep[2]) - self.sendText(self.sendToWho(ncMessage), _("Okay")) - else: - self.sendText(self.sendToWho(ncMessage), _("Not Found")) + self.sendText(self.sendToWho(ncMessage), _("Not Found")) else: - self.sendText(self.sendToWho(ncMessage), str(self.data.getGroup(GroupInfo.id)["Ext_Admin"])) + if self.data.getGroup(GroupInfo.id)["Ext_Admin"] != []: + status = "" + status_added = [] + for member in GroupInfo.members: + if member.mid in self.data.getGroup(GroupInfo.id)["Ext_Admin"]: + status += "{}\n".format(member.displayName) + status_added.append(member.mid) + for userId in self.data.getGroup(GroupInfo.id)["Ext_Admin"]: + if userId not in status_added: + status += "Unknown: {}\n".format(userId) + self.sendText(self.sendToWho(ncMessage), status + _("\nExtend Administrator(s)")) + else: + self.sendText(self.sendToWho(ncMessage), _("Not Found")) elif self.YuukiConfigs["name"] + '/Status' == ncMessage.message.text: if ncMessage.message.toType == MIDType.GROUP: GroupInfo = self.getClient(self.MyMID).getGroup(ncMessage.message.to) group_status = self.data.getSEGroup(ncMessage.message.to) - if group_status == None: - status = _("Default without Initialize\nAdmin of the Group:\n%s") % ( + if not self.YuukiVariable["SecurityService"]: + status = _("SecurityService of %s was disable") % ( + self.YuukiConfigs["name"], + ) + elif group_status == None: + status = _("Default without Initialize\nMain Admin of the Group:\n%s") % ( self.sybGetGroupCreator(GroupInfo).displayName, ) else: - status = _("URL:%s\nInvite:%s\nJoin:%s\nMembers:%s\n\nAdmin of the Group:\n%s") % ( + status = _("SecurityService is Listening on\n\nURL:%s\nInvite:%s\nJoin:%s\nMembers:%s\n\nMain Admin of the Group:\n%s") % ( group_status[OpType.NOTIFIED_UPDATE_GROUP], group_status[OpType.NOTIFIED_INVITE_INTO_GROUP], group_status[OpType.NOTIFIED_ACCEPT_GROUP_INVITATION], @@ -525,7 +554,7 @@ class Yuuki: elif self.YuukiConfigs["name"] + '/Quit' == ncMessage.message.text: if ncMessage.message.toType == MIDType.GROUP: GroupInfo = self.getClient(self.MyMID).getGroup(ncMessage.message.to) - GroupPrivilege = self.Admin + [self.sybGetGroupCreator(GroupInfo).mid] + self.data.getGroup(GroupInfo.id)["Ext_Admin"] + GroupPrivilege = self.Admin + [self.sybGetGroupCreator(GroupInfo).mid] if ncMessage.message.from_ in GroupPrivilege: self.sendText(self.sendToWho(ncMessage), _("Bye Bye")) self.getClient(self.MyMID).leaveGroup(self.Seq, GroupInfo.id) @@ -587,7 +616,7 @@ class Yuuki: if Another == '4': if not GroupInfo.preventJoinByTicket: self.changeGroupUrlStatus(GroupInfo, False) - self.sendText(GroupID, _("DO NOT TOUCH THE GROUP URL SETTINGs, see you...")) + self.sendText(GroupID, _("DO NOT ENABLE THE GROUP URL STATUS, see you...")) Kicker = self.kickSomeone(GroupInfo, Action) # Log self.data.updateLog("KickEvent", (self.data.getTime(), GroupInfo.name, GroupID, Kicker, Action, Another, ncMessage.type)) @@ -605,7 +634,7 @@ class Yuuki: self.data.updateLog("CancelEvent", (self.data.getTime(), GroupInfo.name, GroupID, Canceler, Action, Another)) if Canceler != "None": self.sendText(GroupID, _("Do not invite anyone...thanks")) - elif ncMessage.type == OpType.NOTIFIED_ACCEPT_GROUP_INVITATION: + elif ncMessage.type == OpType.NOTIFIED_ACCEPT_GROUP_INVITATION and Security_Access: for userId in self.data.getData("BlackList"): if userId == Action: self.sendText(GroupID, _("You are our blacklist. Bye~"))