This commit is contained in:
SuperSonic 2019-08-25 13:21:49 +08:00
parent 9c7dd8e646
commit b3823a667f
2 changed files with 27 additions and 20 deletions

View file

@ -74,8 +74,8 @@ class Yuuki_Data:
self.LogType = { self.LogType = {
"JoinGroup":"<li>%s: %s(%s) -> Inviter: %s</li>", "JoinGroup":"<li>%s: %s(%s) -> Inviter: %s</li>",
"KickEvent":"<li>%s: %s(%s) -> Kicker: %s | Kicked: %s | Status: %s</li>", "KickEvent":"<li>%s: %s(%s) -(%s)> Kicker: %s | Kicked: %s | Status: %s</li>",
"CancelEvent":"<li>%s: %s(%s) -> Inviter: %s | Canceled: %s</li>", "CancelEvent":"<li>%s: %s(%s) -(%s)> Inviter: %s | Canceled: %s</li>",
"BlackList":"<li>%s: %s(%s)</li>" "BlackList":"<li>%s: %s(%s)</li>"
} }

View file

@ -203,7 +203,7 @@ class Yuuki:
helper = max(accounts, key=accounts.get) helper = max(accounts, key=accounts.get)
else: else:
if exceptUserId == self.MyMID: if exceptUserId == self.MyMID:
return return "None"
helper = self.MyMID helper = self.MyMID
Limit = self.data.getLimit("Kick")[helper] Limit = self.data.getLimit("Kick")[helper]
@ -212,6 +212,7 @@ class Yuuki:
self.data.updateData(self.data.getData("LimitInfo")["KickLimit"], helper, Limit - 1) self.data.updateData(self.data.getData("LimitInfo")["KickLimit"], helper, Limit - 1)
else: else:
self.sendText(groupId, _("Kick Limit.")) self.sendText(groupId, _("Kick Limit."))
return helper
def sendToWho(self, Message): def sendToWho(self, Message):
if Message.message.toType == MIDType.USER: if Message.message.toType == MIDType.USER:
@ -301,7 +302,7 @@ class Yuuki:
if self.checkInInvitationList(ncMessage, userId): if self.checkInInvitationList(ncMessage, userId):
self.getClientByMid(userId).acceptGroupInvitation(self.Seq, ncMessage.param1) self.getClientByMid(userId).acceptGroupInvitation(self.Seq, ncMessage.param1)
# Log # Log
self.data.updateLog("JoinGroup", (self.data.getTime(), GroupID, userId, Inviter)) self.data.updateLog("JoinGroup", (self.data.getTime(), ncMessage.param1, userId, ncMessage.param2))
self.Security(ncMessage) self.Security(ncMessage)
def Commands(self, ncMessage): def Commands(self, ncMessage):
@ -432,56 +433,62 @@ class Yuuki:
if ncMessage.param3 == '4': if ncMessage.param3 == '4':
if not GroupInfo.preventJoinByTicket: if not GroupInfo.preventJoinByTicket:
self.changeGroupUrlStatus(GroupInfo, False) self.changeGroupUrlStatus(GroupInfo, False)
self.kickSomeone(GroupID, ncMessage.param2) Kicker = self.kickSomeone(GroupID, ncMessage.param2)
# Log
self.data.updateLog("KickEvent", (self.data.getTime(), GroupInfo.name, GroupID, Kicker, Action, ncMessage.param3, ncMessage.type))
elif ncMessage.type == OpType.NOTIFIED_INVITE_INTO_GROUP: elif ncMessage.type == OpType.NOTIFIED_INVITE_INTO_GROUP:
if "\x1e" in ncMessage.param3: if "\x1e" in ncMessage.param3:
Canceler = "None"
for userId in ncMessage.param3.split("\x1e"): for userId in ncMessage.param3.split("\x1e"):
if userId not in [self.MyMID] + self.Connect.helper_ids + GroupPrivilege: if userId not in [self.MyMID] + self.Connect.helper_ids + GroupPrivilege:
self.cancelSomeone(GroupID, userId) Canceler = self.cancelSomeone(GroupID, userId)
# Log # Log
self.data.updateLog("CancelEvent", (self.data.getTime(), GroupInfo.name, GroupID, Action, ncMessage.param3)) self.data.updateLog("CancelEvent", (self.data.getTime(), GroupInfo.name, GroupID, Canceler, Action, ncMessage.param3))
elif ncMessage.param3 not in [self.MyMID] + self.Connect.helper_ids + GroupPrivilege: elif ncMessage.param3 not in [self.MyMID] + self.Connect.helper_ids + GroupPrivilege:
self.cancelSomeone(GroupID, ncMessage.param3) Canceler = self.cancelSomeone(GroupID, ncMessage.param3)
# Log # Log
self.data.updateLog("CancelEvent", (self.data.getTime(), GroupInfo.name, GroupID, Action, ncMessage.param3)) self.data.updateLog("CancelEvent", (self.data.getTime(), GroupInfo.name, GroupID, Canceler, Action, ncMessage.param3))
elif ncMessage.type == OpType.NOTIFIED_ACCEPT_GROUP_INVITATION: elif ncMessage.type == OpType.NOTIFIED_ACCEPT_GROUP_INVITATION:
for userId in self.data.getData("BlackList"): for userId in self.data.getData("BlackList"):
if userId == ncMessage.param2: if userId == ncMessage.param2:
self.kickSomeone(GroupID, userId) Kicker = self.kickSomeone(GroupID, userId)
# Log # Log
self.data.updateLog("KickEvent", (self.data.getTime(), GroupInfo.name, GroupID, Action, ncMessage.param3, ncMessage.type)) self.data.updateLog("KickEvent", (self.data.getTime(), GroupInfo.name, GroupID, Kicker, Kicker, Action, ncMessage.type))
elif ncMessage.type == OpType.NOTIFIED_KICKOUT_FROM_GROUP: elif ncMessage.type == OpType.NOTIFIED_KICKOUT_FROM_GROUP:
if ncMessage.param2 in self.Connect.helper_ids: if ncMessage.param2 in self.Connect.helper_ids:
# Log # Log
self.data.updateLog("KickEvent", (self.data.getTime(), GroupInfo.name, GroupID, Action, ncMessage.param3, ncMessage.type*10+1)) self.data.updateLog("KickEvent", (self.data.getTime(), GroupInfo.name, GroupID, Action, Action, ncMessage.param3, ncMessage.type*10+1))
else: else:
if ncMessage.param3 in [self.MyMID] + self.Connect.helper_ids: if ncMessage.param3 in [self.MyMID] + self.Connect.helper_ids:
Kicker = "None"
try: try:
self.kickSomeone(GroupID, ncMessage.param2, ncMessage.param3) Kicker = self.kickSomeone(GroupID, ncMessage.param2, ncMessage.param3)
# Log # Log
self.data.updateLog("KickEvent", (self.data.getTime(), GroupInfo.name, GroupID, Action, ncMessage.param3, ncMessage.type*10+2)) self.data.updateLog("KickEvent", (self.data.getTime(), GroupInfo.name, GroupID, Kicker, Action, ncMessage.param3, ncMessage.type*10+2))
except: except:
# Log # Log
self.data.updateLog("KickEvent", (self.data.getTime(), GroupInfo.name, GroupID, Action, ncMessage.param3, ncMessage.type*10+3)) self.data.updateLog("KickEvent", (self.data.getTime(), GroupInfo.name, GroupID, Kicker, Action, ncMessage.param3, ncMessage.type*10+3))
self.data.updateData(self.data.getData("BlackList"), True, ncMessage.param2) self.data.updateData(self.data.getData("BlackList"), True, ncMessage.param2)
# Log # Log
self.data.updateLog("BlackList", (self.data.getTime(), Action, GroupID)) self.data.updateLog("BlackList", (self.data.getTime(), Action, GroupID))
else: else:
self.sendText(GroupID, _("Bye Bye")) self.sendText(GroupID, _("Bye Bye"))
self.kickSomeone(GroupID, ncMessage.param2) Kicker = self.kickSomeone(GroupID, ncMessage.param2)
# Log
self.data.updateLog("KickEvent", (self.data.getTime(), GroupInfo.name, GroupID, Kicker, Action, ncMessage.param3, ncMessage.type))
elif self.SecurityService: elif self.SecurityService:
if ncMessage.type == OpType.NOTIFIED_INVITE_INTO_GROUP: if ncMessage.type == OpType.NOTIFIED_INVITE_INTO_GROUP:
for userId in self.data.getData("BlackList"): for userId in self.data.getData("BlackList"):
if self.checkInInvitationList(ncMessage, userId): if self.checkInInvitationList(ncMessage, userId):
self.cancelSomeone(GroupID, userId) Canceler = self.cancelSomeone(GroupID, userId)
# Log # Log
self.data.updateLog("CancelEvent", (self.data.getTime(), GroupInfo.name, GroupID, Action, ncMessage.param3)) self.data.updateLog("CancelEvent", (self.data.getTime(), GroupInfo.name, GroupID, Canceler, Action, ncMessage.param3))
elif ncMessage.type == OpType.NOTIFIED_ACCEPT_GROUP_INVITATION: elif ncMessage.type == OpType.NOTIFIED_ACCEPT_GROUP_INVITATION:
for userId in self.data.getData("BlackList"): for userId in self.data.getData("BlackList"):
if userId == ncMessage.param2: if userId == ncMessage.param2:
self.kickSomeone(GroupID, userId) Kicker = self.kickSomeone(GroupID, userId)
# Log # Log
self.data.updateLog("KickEvent", (self.data.getTime(), GroupInfo.name, GroupID, Action, ncMessage.param3, ncMessage.type)) self.data.updateLog("KickEvent", (self.data.getTime(), GroupInfo.name, GroupID, Kicker, Kicker, Action, ncMessage.type))
# Main # Main