diff --git a/newbot2.py b/newbot2.py new file mode 100644 index 0000000..7e8c76f --- /dev/null +++ b/newbot2.py @@ -0,0 +1,1762 @@ +# -*- coding: utf-8 -*- +import LINETCR +from LINETCR.lib.curve.ttypes import * +from datetime import datetime +import time,random,sys,json,codecs,threading,glob + +cl = LINETCR.LINE() +cl.login(token="Elzk1m560TwcSIB3FV95.iur748Us1jyfpKv4oxGLDq.30PSdT7hdIrRkyd1Ikkrs5Ml9hENm2WtgLpj/eFo5po=") +cl.loginResult() + +ki = LINETCR.LINE() +ki.login(token="Elsv5DxRRZgZjPbDkB2a.PzuIGrSfbi6ZimWr5ex5QG.rO6HusEKcfGCoDHF0KuogQdYpRiYhta/Yl0k7tCKaKo=") +ki.loginResult() + +kk = LINETCR.LINE() +kk.login(token="EloPm0sIfTRihRdLX5Mf.DRgr2cTxeEiDATETLgm6FW.rqlOh97WYz1QflOnfwI1DpkRDM4eOohhY/89DEIWgZc=") +kk.loginResult() + +kc = LINETCR.LINE() +kc.login(token="ElIt9cdB7Ta64OT5veP0.0xXKLPaf8b6wAiXZDw/zKa.t77swFKIB+DOE0A4dosJq4rtL1qeGVAE6DSwMLc9jiA=") +kc.loginResult() + +kd = LINETCR.LINE() +kd.login(token="ElIq1ZAkL5VWMNrqjPH2.c74e1FIgViqAn7KTUdEVWG.1hSKlfNJMGD3NCg0OAlWvtegiESsIYrkdeEVJpHGDeE=") +kd.loginResult() + + +ke = LINETCR.LINE() +ke.login(token="EllfH0dpOxK6G4GMmvoc.fDEuyTzDGQmGfp4ckPUkpa.nwFnYWM8ozTB9Y4STFT6OeuisYkyGugP8WU47J2e4DY=") +ke.loginResult() + +kf = LINETCR.LINE() +kf.login(token="ElAswuUrXQo6FK8Si9M9.jnrl5WXaTf6U4igiiB7LEq.kXAFdPmKtgCkxosDvr1oX6BxhB56OIEPG9FC2v0NLH4=") +kf.loginResult() + +am = LINETCR.LINE() +am.login(token="El2hDLcRFlyzYAL6PB0f.FyCqvzVAe2RNaWr3/dbP3W.CzuzSPrt3m54ISxzK/MADbCaqmXoUhhBKCW3Aq1mN+Y=") +am.loginResult() + + +print "login success" +reload(sys) +sys.setdefaultencoding('utf-8') + +helpMessage ="""[Help 不給看勒]""" +KAC=[cl,ki,kk,kc,kd,ke,kf,am] +ammid = am.getProfile().mid +mid = cl.getProfile().mid +Amid = ki.getProfile().mid +Bmid = kk.getProfile().mid +Cmid = kc.getProfile().mid +Dmid = kd.getProfile().mid +Emid = ke.getProfile().mid +Fmid = kf.getProfile().mid +Bots=[mid,Amid,Bmid,Cmid,Dmid,Emid,Fmid,ammid] +admin = ["u67c43239c865dfce6addb41c6b3c0edd","u29971676114806a574c148f0df876c22","u24d44be70c40b45eaee0818821bee579","u21447be3cb92d496053e457839782575","u76b191d82b5711e21d6ad7ad94633a7f","u15d79462d65d82a32014fe022a9b8a3c","ud17c64969005f01e96688c73756f9990","u0bbe04d5f886bc841a37b92db837afc2","u67c43239c865dfce6addb41c6b3c0edd","u7d8710559bda136ae7030477f83069df"] + +adminMID = "u67c43239c865dfce6addb41c6b3c0edd","u29971676114806a574c148f0df876c22","u24d44be70c40b45eaee0818821bee579","u21447be3cb92d496053e457839782575","u76b191d82b5711e21d6ad7ad94633a7f","u15d79462d65d82a32014fe022a9b8a3c","ud17c64969005f01e96688c73756f9990","u0bbe04d5f886bc841a37b92db837afc2","u67c43239c865dfce6addb41c6b3c0edd","u7d8710559bda136ae7030477f83069df" +wait = { + 'protect':False, + 'protectinv':False, + 'protectqr':False, + 'contact':False, + 'autoJoin':True, + 'autoCancel':{"on":True,"members":1}, + 'leaveRoom':False, + 'timeline':True, + 'autoAdd':True, + 'message':"Thanks for add me", + "lang":"JP", + "comment":"Thanks for add me", + "commentOn":False, + "commentBlack":{}, + "wblack":False, + "dblack":False, + "clock":False, + "cName":"ılı ѕℓσωєя вσт A ılı", + "blacklist":{}, + "wblacklist":False, + "dblacklist":False, + "protectionOn":False, + "kickme":False + } + +wait2 = { + 'readPoint':{}, + 'readMember':{}, + 'setTime':{}, + 'ROM':{} + } + +cancelinvite = { + 'autoCancel':False +} + +setTime = {} +setTime = wait2['setTime'] + + +def sendMessage(to, text, contentMetadata={}, contentType=0): + mes = Message() + mes.to, mes.from_ = to, profile.mid + mes.text = text + mes.contentType, mes.contentMetadata = contentType, contentMetadata + if to not in messageReq: + messageReq[to] = -1 + messageReq[to] += 1 + +def NOTIFIED_READ_MESSAGE(op): + if op.type == 55: + try: + if op.param1 in wait2['readPoint']: + Name = cl.getContact(op.param1).displayName + if Name in wait2['readMember'][op.param1]: + pass + else: + wait2['readMember'][op.param1] += "\nツ1�71ᅣ1�771ᅣ1�71ᅣ1�7771ᅣ1�71ᅣ1�771ᅣ1�71ᅣ1�7777" + Name + wait2['ROM'][op.param1][op.param2] = "ツ1�71ᅣ1�771ᅣ1�71ᅣ1�7771ᅣ1�71ᅣ1�771ᅣ1�71ᅣ1�7777" + Name + else: + cl.sendText + except: + pass + +def bot(op): + try: + if op.type == 0: + return + if op.type == 13: + if mid in op.param3: + G = cl.getGroup(op.param1) + if wait["autoJoin"] == True: + if wait["autoCancel"]["on"] == True: + if len(G.members) <= wait["autoCancel"]["members"]: + cl.rejectGroupInvitation(op.param1) + else: + cl.acceptGroupInvitation(op.param1) + else: + cl.acceptGroupInvitation(op.param1) + elif wait["autoCancel"]["on"] == True: + if len(G.members) <= wait["autoCancel"]["members"]: + cl.rejectGroupInvitation(op.param1) + else: + Inviter = op.param3.replace("",',') + InviterX = Inviter.split(",") + matched_list = [] + for tag in wait["blacklist"]: + matched_list+=filter(lambda str: str == tag, InviterX) + if matched_list == []: + pass + else: + cl.cancelGroupInvitation(op.param1, matched_list) + + + if op.type == 22: + if wait["leaveRoom"] == True: + cl.leaveRoom(op.param1) + if op.type == 24: + if wait["leaveRoom"] == True: + cl.leaveRoom(op.param1) + if op.type == 26: + msg = op.message + if msg.toType == 0: + msg.to = msg.from_ + if msg.from_ == profile.mid: + if "join:" in msg.text: + list_ = msg.text.split(":") + try: + cl.acceptGroupInvitationByTicket(list_[1],list_[2]) + X = cl.getGroup(list_[1]) + X.preventJoinByTicket = True + cl.updateGroup(X) + except: + cl.sendText(msg.to,"error") + if msg.toType == 1: + if wait["leaveRoom"] == True: + cl.leaveRoom(msg.to) + if msg.contentType == 16: + url = msg.contentMetadata("line://home/post?userMid="+mid+"&postId="+"new_post") + cl.like(url[25:58], url[66:], likeType=1001) + if op.type == 26: + msg = op.message + if msg.contentType == 13: + if wait["wblack"] == True: + if msg.contentMetadata["mid"] in wait["commentBlack"]: + cl.sendText(msg.to,"already") + wait["wblack"] = False + else: + wait["commentBlack"][msg.contentMetadata["mid"]] = True + wait["wblack"] = False + cl.sendText(msg.to,"decided not to comment") + + elif wait["dblack"] == True: + if msg.contentMetadata["mid"] in wait["commentBlack"]: + del wait["commentBlack"][msg.contentMetadata["mid"]] + cl.sendText(msg.to,"Dihapus") + wait["dblack"] = False + + else: + wait["dblack"] = False + cl.sendText(msg.to,"It is not in the black list") + elif wait["wblacklist"] == True: + if msg.contentMetadata["mid"] in wait["blacklist"]: + cl.sendText(msg.to,"already") + wait["wblacklist"] = False + else: + wait["blacklist"][msg.contentMetadata["mid"]] = True + wait["wblacklist"] = False + cl.sendText(msg.to,"Ditambahkan") + print "SUKSES -- BLACKLIST DITAMBAHKAN" + + elif wait["dblacklist"] == True: + if msg.contentMetadata["mid"] in wait["blacklist"]: + del wait["blacklist"][msg.contentMetadata["mid"]] + cl.sendText(msg.to,"deleted") + print "SUKSES -- BLACKLIST DIHAPUS" + wait["dblacklist"] = False + + else: + wait["dblacklist"] = False + cl.sendText(msg.to,"It is not in the black list") + elif wait["contact"] == True: + msg.contentType = 0 + cl.sendText(msg.to,msg.contentMetadata["mid"]) + if 'displayName' in msg.contentMetadata: + contact = cl.getContact(msg.contentMetadata["mid"]) + try: + cu = cl.channel.getCover(msg.contentMetadata["mid"]) + except: + cu = "" + cl.sendText(msg.to,"[displayName]:\n" + msg.contentMetadata["displayName"] + "\n[mid]:\n" + msg.contentMetadata["mid"] + "\n[statusMessage]:\n" + contact.statusMessage + "\n[pictureStatus]:\nhttp://dl.profile.line-cdn.net/" + contact.pictureStatus + "\n[coverURL]:\n" + str(cu)) + else: + contact = cl.getContact(msg.contentMetadata["mid"]) + try: + cu = cl.channel.getCover(msg.contentMetadata["mid"]) + except: + cu = "" + cl.sendText(msg.to,"[displayName]:\n" + contact.displayName + "\n[mid]:\n" + msg.contentMetadata["mid"] + "\n[statusMessage]:\n" + contact.statusMessage + "\n[pictureStatus]:\nhttp://dl.profile.line-cdn.net/" + contact.pictureStatus + "\n[coverURL]:\n" + str(cu)) + elif msg.contentType == 16: + if wait["timeline"] == True: + msg.contentType = 0 + if wait["lang"] == "JP": + msg.text = "post URL\n" + msg.contentMetadata["postEndUrl"] + else: + msg.text = "URLâ†�1ᅣ1�77�\n" + msg.contentMetadata["postEndUrl"] + cl.sendText(msg.to,msg.text) + elif msg.text is None: + return + elif msg.text in ["Key","help","Help","key"]: + if wait["lang"] == "JP": + cl.sendText(msg.to,helpMessage) + else: + print "SUKSES -- KEYWORD" + cl.sendText(msg.to,helpt) + elif ("Gn " in msg.text): + if msg.toType == 2: + if msg.from_ in admin: + X = cl.getGroup(msg.to) + X.name = msg.text.replace("Gn ","") + cl.updateGroup(X) + print "SUKSES -- CHANGE NAME GROUP" + else: + cl.sendText(msg.to,"It can't be used besides the group.") + elif ("Bye " in msg.text): + if msg.from_ in admin: + key = eval(msg.contentMetadata["MENTION"]) + key["MENTIONEES"][0]["M"] + targets = [] + for x in key["MENTIONEES"]: + targets.append(x["M"]) + for target in targets: + try: + random.choice(KAC).kickoutFromGroup(msg.to,[target]) + except: + pass + elif "Kick " in msg.text: + if msg.from_ in admin: + midd = msg.text.replace("Kick ","") + cl.kickoutFromGroup(msg.to,[midd]) + print "SUKSES -- KICK BY MID" + elif "Invite " in msg.text: + if msg.from_ in admin: + midd = msg.text.replace("Invite ","") + cl.findAndAddContactsByMid(midd) + cl.inviteIntoGroup(msg.to,[midd]) + print "SUKSES -- INVITED BY MID" + elif msg.text in ["me","Me"]: + msg.contentType = 13 + msg.contentMetadata = {'mid': msg.from_} + cl.sendMessage(msg) + print "SUKSES -- SEND CONTACT" + elif msg.text in ["Yid","yid"]: + cl.sendText(msg.to,msg.from_) + elif msg.text in ["gift","Gift"]: + msg.contentType = 9 + msg.contentMetadata={'PRDID': 'a0768339-c2d3-4189-9653-2909e9bb6f58', + 'PRDTYPE': 'THEME', + 'MSGTPL': '5'} + msg.text = None + cl.sendMessage(msg) + print "SUKSES -- SEND GIFT" + elif msg.text in ["cancel","Cancel"]: + if msg.from_ in admin: + if msg.toType == 2: + X = cl.getGroup(msg.to) + if X.invitee is not None: + gInviMids = [contact.mid for contact in X.invitee] + cl.cancelGroupInvitation(msg.to, gInviMids) + print "SUKSES -- CANCEL INVITE GROUP" + else: + if wait["lang"] == "JP": + cl.sendText(msg.to,"No one is inviting") + else: + cl.sendText(msg.to,"Sorry, nobody absent") + else: + if wait["lang"] == "JP": + cl.sendText(msg.to,"Can not be used outside the group") + else: + cl.sendText(msg.to,"Not for use less than group") + #elif "gurl" == msg.text: + #print cl.getGroup(msg.to) + ##cl.sendMessage(msg) + elif msg.text in ["Ourl","Link on","ourl","our","Our"]: + if msg.from_ in admin: + if msg.toType == 2: + X = cl.getGroup(msg.to) + X.preventJoinByTicket = False + cl.updateGroup(X) + print "SUKSES -- OPEN URL GROUP" + if wait["lang"] == "JP": + cl.sendText(msg.to,"Done") + else: + cl.sendText(msg.to,"already open") + else: + if wait["lang"] == "JP": + cl.sendText(msg.to,"Can not be used outside the group") + else: + cl.sendText(msg.to,"Not for use less than group") + elif msg.text in ["Curl","Link off","curl"]: + if msg.from_ in admin: + if msg.toType == 2: + X = cl.getGroup(msg.to) + X.preventJoinByTicket = True + cl.updateGroup(X) + print "SUKSES -- CLOSE URL GROUP" + if wait["lang"] == "JP": + cl.sendText(msg.to,"Done") + else: + cl.sendText(msg.to,"already close") + else: + if wait["lang"] == "JP": + cl.sendText(msg.to,"Can not be used outside the group") + else: + cl.sendText(msg.to,"Not for use less than group") + elif msg.text == "Ginfo": + if msg.toType == 2: + ginfo = cl.getGroup(msg.to) + print "SUKSES -- SEND GINFO" + try: + gCreator = ginfo.creator.displayName + except: + gCreator = "Error" + if wait["lang"] == "JP": + if ginfo.invitee is None: + sinvitee = "0" + else: + sinvitee = str(len(ginfo.invitee)) + if ginfo.preventJoinByTicket == True: + u = "close" + else: + u = "open" + cl.sendText(msg.to,"[group name]\n" + str(ginfo.name) + "\n[gid]\n" + msg.to + "\n[group creator]\n" + gCreator + "\n[profile status]\nhttp://dl.profile.line.naver.jp/" + ginfo.pictureStatus + "\nmembers:" + str(len(ginfo.members)) + "members\npending:" + sinvitee + "people\nURL:" + u + "it is inside") + else: + cl.sendText(msg.to,"[group name]\n" + str(ginfo.name) + "\n[gid]\n" + msg.to + "\n[group creator]\n" + gCreator + "\n[profile status]\nhttp://dl.profile.line.naver.jp/" + ginfo.pictureStatus) + else: + if wait["lang"] == "JP": + cl.sendText(msg.to,"Can not be used outside the group") + else: + cl.sendText(msg.to,"Not for use less than group") + elif "Id" == msg.text: + cl.sendText(msg.to,msg.to) + elif msg.text in ["Mid","mid","MID"]: + print "SUKSES -- SHOW MID USER" + cl.sendText(msg.to, msg.from_) + elif msg.text in ["TL:"]: + tl_text = msg.text.replace("TL:","") + cl.sendText(msg.to,"line://home/post?userMid="+mid+"&postId="+cl.new_post(tl_text)["result"]["post"]["postInfo"]["postId"]) + elif msg.text in ["protect on","protect:on","Protect on","Protect:on","p on","P on"]: + if msg.from_ in admin: + if wait["protect"] == True: + if wait["lang"] == "JP": + print "EXECUTED -- PROTECT ON" + cl.sendText(msg.to,"already on") + else: + cl.sendText(msg.to,"Done") + else: + wait["protect"] = True + if wait["lang"] == "JP": + print "SUKSES -- PROTECT ON" + cl.sendText(msg.to,"already on") + else: + cl.sendText(msg.to,"Done") + elif msg.text in ["protect off","Protect off","Protect:off","protect:off","p off","P off"]: + if msg.from_ in admin: + if wait["protect"] == False: + if wait["lang"] == "JP": + print "EXECUTED -- PROTECT OFF" + cl.sendText(msg.to,"already off") + else: + cl.sendText(msg.to,"Done") + else: + wait["protect"] = False + if wait["lang"] == "JP": + print "SUKSES -- PROTECT OFF" + cl.sendText(msg.to,"already off") + else: + cl.sendText(msg.to,"Done") + elif msg.text in ["protectinv on","protectinv:on","Protectinv:on","Protectinv on","inv on","Inv on"]: + if msg.from_ in admin: + if wait["protectinv"] == True: + if wait["lang"] == "JP": + print "EXECUTED -- PROTECT INV ON" + cl.sendText(msg.to,"already on") + else: + cl.sendText(msg.to,"Done") + else: + wait["protectinv"] = True + if wait["lang"] == "JP": + print "SUKSES -- PROTECT INV ON" + cl.sendText(msg.to,"already on") + else: + cl.sendText(msg.to,"Done") + elif msg.text in ["protectinv off","Protectinv off","Protectinv:off","protectinv:off","deff off","inv off","Inv off"]: + if msg.from_ in admin: + if wait["protectinv"] == False: + if wait["lang"] == "JP": + print "EXECUTED -- PROTECT INV OFF" + cl.sendText(msg.to,"already off") + else: + cl.sendText(msg.to,"Done") + else: + wait["protectinv"] = False + if wait["lang"] == "JP": + print "SUKSES -- PROTECT INV OFF" + cl.sendText(msg.to,"already off") + else: + cl.sendText(msg.to,"Done") + elif msg.text in ["protectqr on","protectqr:on","Protectqr:on","Protectqr on","Qr on","qr on"]: + if msg.from_ in admin: + if wait["protectqr"] == True: + if wait["lang"] == "JP": + print "EXECUTED -- PROTECT QR ON" + cl.sendText(msg.to,"already on") + else: + cl.sendText(msg.to,"Done") + else: + wait["protectqr"] = True + if wait["lang"] == "JP": + print "SUKSES -- PROTECT QR ON" + cl.sendText(msg.to,"already on") + else: + cl.sendText(msg.to,"Done") + elif msg.text in ["protectqr off","Protectqr:off","Protectqr off","protectqr:off","qr off","Qr off"]: + if msg.from_ in admin: + if wait["protectqr"] == False: + if wait["lang"] == "JP": + print "EXECUTED -- PROTECT QR OFF" + cl.sendText(msg.to,"already off") + else: + cl.sendText(msg.to,"Done") + else: + wait["protectqr"] = False + if wait["lang"] == "JP": + cl.sendText(msg.to,"already off") + print "SUKSES -- PROTECT QR OFF" + else: + cl.sendText(msg.to,"Done") + elif msg.text in ["連絡先:オン","K on","Contact on","顯示:開"]: + if msg.from_ in admin: + if wait["contact"] == True: + if wait["lang"] == "JP": + cl.sendText(msg.to,"already on") + else: + cl.sendText(msg.to,"done") + else: + wait["contact"] = True + if wait["lang"] == "JP": + cl.sendText(msg.to,"already on") + else: + cl.sendText(msg.to,"done") + elif msg.text in ["連絡先:オフ","K off","Contact off","顯示:關"]: + if msg.from_ in admin: + if wait["contact"] == False: + if wait["lang"] == "JP": + cl.sendText(msg.to,"already off") + else: + cl.sendText(msg.to,"done ") + else: + wait["contact"] = False + if wait["lang"] == "JP": + cl.sendText(msg.to,"already off") + else: + cl.sendText(msg.to,"done") + elif msg.text in ["è‡ªå‹•å‚åŠ :オン","Join on","Auto join:on","è‡ªå‹•åƒåŠ ï¼šé–‹"]: + if msg.from_ in admin: + if wait["autoJoin"] == True: + if wait["lang"] == "JP": + cl.sendText(msg.to,"already on") + else: + cl.sendText(msg.to,"done") + else: + wait["autoJoin"] = True + if wait["lang"] == "JP": + cl.sendText(msg.to,"already on") + else: + cl.sendText(msg.to,"done") + elif msg.text in ["è‡ªå‹•å‚åŠ :オフ","Join off","Auto join:off","è‡ªå‹•åƒåŠ ï¼šé—œ"]: + if wait["autoJoin"] == False: + if wait["lang"] == "JP": + cl.sendText(msg.to,"already off") + else: + cl.sendText(msg.to,"done") + else: + wait["autoJoin"] = False + if wait["lang"] == "JP": + cl.sendText(msg.to,"already off") + else: + cl.sendText(msg.to,"done") + elif msg.text in ["Gcancel:"]: + try: + strnum = msg.text.replace("Gcancel:","") + if strnum == "off": + wait["autoCancel"]["on"] = False + if wait["lang"] == "JP": + cl.sendText(msg.to,"Invitation refused turned off\nTo turn on please specify the number of people and send") + else: + cl.sendText(msg.to,"关了邀请拒绝。要时开请指定人数发送") + else: + num = int(strnum) + wait["autoCancel"]["on"] = True + if wait["lang"] == "JP": + cl.sendText(msg.to,strnum + "The group of people and below decided to automatically refuse invitation") + else: + cl.sendText(msg.to,strnum + "使人以下的小组用自动邀请拒绝") + except: + if wait["lang"] == "JP": + cl.sendText(msg.to,"Value is wrong") + else: + cl.sendText(msg.to,"Bizarre ratings") + elif msg.text in ["強制自動退出:オン","Leave on","Auto leave:on","強制自動退出:開"]: + if wait["leaveRoom"] == True: + if wait["lang"] == "JP": + cl.sendText(msg.to,"already on") + else: + cl.sendText(msg.to,"done") + else: + wait["leaveRoom"] = True + if wait["lang"] == "JP": + cl.sendText(msg.to,"done") + else: + cl.sendText(msg.to,"要了开。") + elif msg.text in ["強制自動退出:オフ","Leave off","Auto leave:off","強制自動退出:關"]: + if wait["leaveRoom"] == False: + if wait["lang"] == "JP": + cl.sendText(msg.to,"already off") + else: + cl.sendText(msg.to,"done") + else: + wait["leaveRoom"] = False + if wait["lang"] == "JP": + cl.sendText(msg.to,"done") + else: + cl.sendText(msg.to,"already") + elif msg.text in ["共有:オン","Share on","Share on"]: + if wait["timeline"] == True: + if wait["lang"] == "JP": + cl.sendText(msg.to,"already on") + else: + cl.sendText(msg.to,"done") + else: + wait["timeline"] = True + if wait["lang"] == "JP": + cl.sendText(msg.to,"done") + else: + cl.sendText(msg.to,"要了开。") + elif msg.text in ["共有:オフ","Share off","Share off"]: + if wait["timeline"] == False: + if wait["lang"] == "JP": + cl.sendText(msg.to,"already off") + else: + cl.sendText(msg.to,"done") + else: + wait["timeline"] = False + if wait["lang"] == "JP": + cl.sendText(msg.to,"done") + else: + cl.sendText(msg.to,"要了关断。") + + elif msg.text in ["Cancel off","cancel off"]: + if msg.from_ in admin: + if cancelinvite["autoCancel"] == True: + cancelinvite["autoCancel"] = False + cl.sendText(msg.to, "Auto Cancel turned off") + print "[Command]Cancel off executed" + else: + cl.sendText(msg.to, "Auto Cancel already turned off") + print "[Command]Cancel off executed" + else: + cl.sendText(msg.to,"Command denied.") + cl.sendText(msg.to,"Staff or higher permission required.") + print "[Error]Command denied - staff or higher permission required" + + elif msg.text in ["Cancel on","cancel on"]: + if msg.from_ in admin: + if cancelinvite["autoCancel"] == False: + cancelinvite["autoCancel"] = True + cl.sendText(msg.to, "Auto Cancel turned on") + print "[Command]Cancel on executed" + else: + cl.sendText(msg.to, "Auto Cancel already turned on") + print "[Command]Cancel on executed" + else: + cl.sendText(msg.to,"Command denied.") + cl.sendText(msg.to,"Staff or higher permission required.") + print "[Error]Command denied - staff or higher permission required" + + elif msg.text in ["Set"]: + md = "" + if wait["protect"] == True: md+=" Protect : on\n" + else: md+=" Protect : off\n" + if wait["protectinv"] == True: md+=" Protectinv : on\n" + else: md+=" Protectinv : off\n" + if wait["protectqr"] == True: md+=" Protectqr : on\n" + else: md+=" Protectqr : off\n" + if wait["contact"] == True: md+=" Contact : on\n" + else: md+=" Contact : off\n" + if wait["autoJoin"] == True: md+=" Auto join : on\n" + else: md +=" Auto join : off\n" + if wait["autoCancel"]["on"] == True:md+=" Group cancel :" + str(wait["autoCancel"]["members"]) + "\n" + else: md+= " Group cancel : off\n" + if wait["leaveRoom"] == True: md+=" Auto leave : on\n" + else: md+=" Auto leave : off\n" + if wait["timeline"] == True: md+=" Share : on\n" + else:md+=" Share : off\n" + if wait["autoAdd"] == True: md+=" Auto add : on\n" + else:md+=" Auto add : off\n" + if wait["commentOn"] == True: md+=" Comment : on\n" + else:md+=" Comment : off\n" + cl.sendText(msg.to,md) + elif msg.text in ["Group id","group id"]: + gid = cl.getGroupIdsJoined() + h = "" + for i in gid: + h += "[%s]:%s\n" % (cl.getGroup(i).name,i) + cl.sendText(msg.to,h) + elif msg.text in ["/listgroup","/Listgroup","/List group","/list group"]: + gid = cl.getGroupIdsJoined() + h = "" + for i in gid: + h += "[=> %s\n" % (cl.getGroup(i).name) + cl.sendText(msg.to,h) + elif msg.text in ["Cancelall"]: + if msg.from_ in admin: + gid = cl.getGroupIdsInvited() + for i in gid: + cl.rejectGroupInvitation(i) + print "SUKSES -- SEND CANCELALL" + if wait["lang"] == "JP": + cl.sendText(msg.to,"All invitations have been refused") + else: + cl.sendText(msg.to,"拒绝了全部的邀请。") + elif msg.text in ["Add on","Auto add:on"]: + if wait["autoAdd"] == True: + if wait["lang"] == "JP": + cl.sendText(msg.to,"already on") + else: + cl.sendText(msg.to,"done") + else: + wait["autoAdd"] = True + if wait["lang"] == "JP": + cl.sendText(msg.to,"done") + else: + cl.sendText(msg.to,"要了开。") + elif msg.text in ["Add off","Auto add:off"]: + if wait["autoAdd"] == False: + if wait["lang"] == "JP": + cl.sendText(msg.to,"already off") + else: + cl.sendText(msg.to,"done") + else: + wait["autoAdd"] = False + if wait["lang"] == "JP": + cl.sendText(msg.to,"done") + else: + cl.sendText(msg.to,"要了关断。") + elif "Comment:" in msg.text: + c = msg.text.replace("Comment:","") + if c in [""," ","\n",None]: + cl.sendText(msg.to,"message changed") + else: + wait["comment"] = c + cl.sendText(msg.to,"changed\n\n" + c) + elif "Add comment:" in msg.text: + c = msg.text.replace("Add comment:","") + if c in [""," ","\n",None]: + cl.sendText(msg.to,"String that can not be changed") + else: + wait["comment"] = c + cl.sendText(msg.to,"changed\n\n" + c) + elif msg.text in ["コメント:オン","Comment on","Comment:on","è‡ªå‹•é¦–é ç•™è¨€ï¼šé–‹"]: + if wait["commentOn"] == True: + if wait["lang"] == "JP": + cl.sendText(msg.to,"done") + else: + cl.sendText(msg.to,"already on") + else: + wait["commentOn"] = True + if wait["lang"] == "JP": + cl.sendText(msg.to,"done") + else: + cl.sendText(msg.to,"要了开。") + elif msg.text in ["コメント:オフ","Comment on","Comment off","è‡ªå‹•é¦–é ç•™è¨€ï¼šé—œ"]: + if wait["commentOn"] == False: + if wait["lang"] == "JP": + cl.sendText(msg.to,"done") + else: + cl.sendText(msg.to,"already off") + else: + wait["commentOn"] = False + if wait["lang"] == "JP": + cl.sendText(msg.to,"done") + else: + cl.sendText(msg.to,"要了关断。") + elif msg.text in ["Comment","留言確認"]: + cl.sendText(msg.to,"message changed to\n\n" + str(wait["comment"])) + elif msg.text in ["Gurl"]: + if msg.from_ in admin: + if msg.toType == 2: + x = cl.getGroup(msg.to) + if x.preventJoinByTicket == True: + x.preventJoinByTicket = False + cl.updateGroup(x) + gurl = cl.reissueGroupTicket(msg.to) + cl.sendText(msg.to,"line://ti/g/" + gurl) + print "SUKSES -- OPEN AND SHARE LINK GROUP" + else: + if wait["lang"] == "JP": + cl.sendText(msg.to,"Can't be used outside the group") + else: + cl.sendText(msg.to,"Not for use less than group") + elif msg.text in ["Comment bl "]: + wait["wblack"] = True + cl.sendText(msg.to,"add to comment bl") + elif msg.text in ["Comment wl "]: + wait["dblack"] = True + cl.sendText(msg.to,"wl to comment bl") + elif msg.text in ["Comment bl confirm"]: + if wait["commentBlack"] == {}: + cl.sendText(msg.to,"confirmed") + else: + cl.sendText(msg.to,"Blacklist") + mc = "" + for mi_d in wait["commentBlack"]: + mc += "" +cl.getContact(mi_d).displayName + "\n" + cl.sendText(msg.to,mc) + elif msg.text in ["Jam on"]: + if wait["clock"] == True: + cl.sendText(msg.to,"already on") + else: + wait["clock"] = True + now2 = datetime.now() + nowT = datetime.strftime(now2,"(%H:%M)") + profile = cl.getProfile() + profile.displayName = wait["cName"] + nowT + cl.updateProfile(profile) + cl.sendText(msg.to,"done") + elif msg.text in ["Jam off"]: + if wait["clock"] == False: + cl.sendText(msg.to,"already off") + else: + wait["clock"] = False + cl.sendText(msg.to,"done") + elif msg.text in ["Change clock "]: + n = msg.text.replace("Change clock ","") + if len(n.decode("utf-8")) > 13: + cl.sendText(msg.to,"changed") + else: + wait["cName"] = n + cl.sendText(msg.to,"changed to\n\n" + n) + elif msg.text in ["Up"]: + if wait["clock"] == True: + now2 = datetime.now() + nowT = datetime.strftime(now2,"(%H:%M)") + profile = cl.getProfile() + profile.displayName = wait["cName"] + nowT + cl.updateProfile(profile) + cl.sendText(msg.to,"Jam Update") + else: + cl.sendText(msg.to,"Please turn on the name clock") + +#----------------------------------------------- + elif msg.text in ["Slower join"]: + if msg.from_ in admin: + G = cl.getGroup(msg.to) + ginfo = cl.getGroup(msg.to) + G.preventJoinByTicket = False + cl.updateGroup(G) + print "EXECUTED -- SUMMON BOT" + invsend = 0 + Ticket = cl.reissueGroupTicket(msg.to) + ki.acceptGroupInvitationByTicket(msg.to,Ticket) + time.sleep(0.0) + kk.acceptGroupInvitationByTicket(msg.to,Ticket) + time.sleep(0.0) + kc.acceptGroupInvitationByTicket(msg.to,Ticket) + time.sleep(0.0) + kd.acceptGroupInvitationByTicket(msg.to,Ticket) + time.sleep(0.0) + ke.acceptGroupInvitationByTicket(msg.to,Ticket) + time.sleep(0.0) + kf.acceptGroupInvitationByTicket(msg.to,Ticket) + time.sleep(0.0) + G = cl.getGroup(msg.to) + G.preventJoinByTicket = True + ki.updateGroup(G) + print "SUKSES -- SUMMON BOT" + G.preventJoinByTicket(G) + ki.updateGroup(G) + + elif msg.text in ["sagiri join"]: + X = kc.getGroup(msg.to) + X.preventJoinByTicket = False + kc.updateGroup(X) + invsend = 0 + Ti = kc.reissueGroupTicket(msg.to) + cl.acceptGroupInvitationByTicket(msg.to,Ti) + G = kc.getGroup(msg.to) + G.preventJoinByTicket = True + kc.updateGroup(G) + Ticket = kc.reissueGroupTicket(msg.to) + +#----------------------------------------------- +#.acceptGroupInvitationByTicket(msg.to,Ticket) +#----------------------------------------------- + elif msg.text in ["Slower bye"]: + if msg.from_ in admin: + ginfo = cl.getGroup(msg.to) + print "EXECUTED -- BOT OUT GROUP" + try: + ki.leaveGroup(msg.to) + kk.leaveGroup(msg.to) + kc.leaveGroup(msg.to) + kd.leaveGroup(msg.to) + ke.leaveGroup(msg.to) + kf.leaveGroup(msg.to) + print "SUKSES -- BOT OUT GROUP" + except: + pass + elif msg.text in ["Slower bye2"]: + if msg.from_ in admin: + if msg.toType == 2: + ginfo = cl.getGroup(msg.to) + try: + ki.leaveGroup(msg.to) + kk.leaveGroup(msg.to) + kc.leaveGroup(msg.to) + kd.leaveGroup(msg.to) + ke.leaveGroup(msg.to) + kf.leaveGroup(msg.to) + cl.leaveGroup(msg.to) + except: + pass +#----------------------------------------------- + elif msg.text in ["Kill"]: + if msg.from_ in admin: + if msg.toType == 2: + group = ki.getGroup(msg.to) + gMembMids = [contact.mid for contact in group.members] + matched_list = [] + for tag in wait["blacklist"]: + matched_list+=filter(lambda str: str == tag, gMembMids) + if matched_list == []: + kk.sendText(msg.to,"BYE") + return + for jj in matched_list: + try: + klist=[kc,kd,ke,kf] + kicker=random.choice(klist) + kicker.kickoutFromGroup(msg.to,[jj]) + print (msg.to,[jj]) + print "SUKSES -- SEND KILL" + except: + pass + elif "#kick" in msg.text: + if msg.from_ in admin: + if msg.toType == 2: + print "EXECUTED -- CLEANSE GROUP" + _name = msg.text.replace("#kick","") + gs = ki.getGroup(msg.to) + gs.name = "印尼收下此處" + cl.updateGroup(gs) + ki.sendText(msg.to,"印尼收下此處") + targets = [] + for g in gs.members: + if _name in g.displayName: + targets.append(g.mid) + if targets == []: + ki.sendText(msg.to,"Not found.") + else: + for target in targets: + if not targets in Bots: + try: + klist=[ki,kk,kc,kd,ke,kf] + kicker=random.choice(klist) + kicker.kickoutFromGroup(msg.to,[target]) + print (msg.to,[g.mid]) + except: + ki.sendText(msg.to,"Group cleanse") + kk.sendText(msg.to,"Group cleanse") + kc.sendText(msg.to,"Group cleanse") + print "SUKSES -- CLEANSE GROUP" + elif "Sk:" in msg.text: + if msg.from_ in admin: + print "EXECUTED -- NK TARGET" + nk0 = msg.text.replace("Sk:","") + nk1 = nk0.lstrip() + nk2 = nk1.replace("","") + nk3 = nk2.rstrip() + _name = nk3 + gs = cl.getGroup(msg.to) + gs = ki.getGroup(msg.to) + gs = kk.getGroup(msg.to) + gs = kc.getGroup(msg.to) + gs = kd.getGroup(msg.to) + gs = ke.getGroup(msg.to) + gs = kf.getGroup(msg.to) + targets = [] + for s in gs.members: + if _name in s.displayName: + targets.append(s.mid) + if targets == []: + sendMessage(msg.to,"user does not exist") + pass + else: + for target in targets: + try: + klist=[ki,kk,kc,kd,ke,kf] + kicker=random.choice(klist) + kicker.kickoutFromGroup(msg.to,[target]) + print "SUKSES -- NK TARGET" + except: + pass + elif "Blacklist @ " in msg.text: + _name = msg.text.replace("Blacklist @ ","") + _kicktarget = _name.rstrip(' ') + gs = ki.getGroup(msg.to) + targets = [] + for g in gs.members: + if _kicktarget == g.displayName: + targets.append(g.mid) + if targets == []: + cl.sendText(msg.to,"Not found") + else: + for target in targets: + try: + wait["blacklist"][target] = True + f=codecs.open('st2__b.json','w','utf-8') + json.dump(wait["blacklist"], f, sort_keys=True, indent=4,ensure_ascii=False) + k3.sendText(msg.to,"Succes Cv") + except: + ki.sendText(msg.to,"error") + elif ("Ban " in msg.text): + if msg.from_ in admin: + print "EXECUTED -- BAN TARGET" + key = eval(msg.contentMetadata["MENTION"]) + key["MENTIONEES"][0]["M"] + targets = [] + for x in key["MENTIONEES"]: + targets.append(x["M"]) + for target in targets: + try: + wait["blacklist"][target] = True + f=codecs.open('st2__b.json','w','utf-8') + json.dump(wait["blacklist"], f, sort_keys=True, indent=4,ensure_ascii=False) + cl.sendText(msg.to,"Succes Ter-Banned") + print "SUKSES -- BAN TARGET" + except: + pass + elif "Unban @" in msg.text: + if msg.from_ in admin: + if msg.toType == 2: + print "EXECUTED -- UNBAN TARGET" + _name = msg.text.replace("Unban @","") + _nametarget = _name.rstrip(' ') + gs = ki.getGroup(msg.to) + targets = [] + for g in gs.members: + if _nametarget == g.displayName: + targets.append(g.mid) + if targets == []: + ki.sendText(msg.to,"Not found Cv") + else: + for target in targets: + try: + del wait["blacklist"][target] + f=codecs.open('st2__b.json','w','utf-8') + json.dump(wait["blacklist"], f, sort_keys=True, indent=4,ensure_ascii=False) + ki.sendText(msg.to,"Succes Unbaned") + print "SUKSES -- UNBAN TARGET" + except: + ki.sendText(msg.to,"Succes UNBANNED") + elif "Mid @" in msg.text: + _name = msg.text.replace("Mid @","") + _nametarget = _name.rstrip(' ') + gs = cl.getGroup(msg.to) + for g in gs.members: + if _nametarget == g.displayName: + cl.sendText(msg.to, g.mid) + else: + pass + elif "Me @" in msg.text: + msg.contentType = 13 + _name = msg.text.replace("Me @","") + _nametarget = _name.rstrip(' ') + gs = cl.getGroup(msg.to) + for g in gs.members: + if _nametarget == g.displayName: + msg.contentMetadata = {'mid': g.mid} + cl.sendMessage(msg) + else: + pass +#----------------------------------------------- + elif msg.text in ["Test"]: + if msg.from_ in admin: + ki.sendText(msg.to,"Ok Cv 􀨁􀄻double thumbs up􏿿") +#----------------------------------------------- + + elif "admin add @" in msg.text: + if msg.from_ in admin: + print "[Command]Staff add executing" + _name = msg.text.replace("admin add @","") + _nametarget = _name.rstrip(' ') + gs = cl.getGroup(msg.to) + gs = ki.getGroup(msg.to) + gs = kk.getGroup(msg.to) + gs = kc.getGroup(msg.to) + gs = kd.getGroup(msg.to) + gs = ke.getGroup(msg.to) + gs = kf.getGroup(msg.to) + targets = [] + for g in gs.members: + if _nametarget == g.displayName: + targets.append(g.mid) + if targets == []: + ki.sendText(msg.to,"Contact not found") + else: + for target in targets: + try: + admin.append(target) + cl.sendText(msg.to,"已給權") + except: + pass + print "[Command]Staff add executed" + else: + cl.sendText(msg.to,"Command denied.") + cl.sendText(msg.to,"Admin permission required.") + + elif "Admin add @" in msg.text: + if msg.from_ in admin: + print "[Command]Staff add executing" + _name = msg.text.replace("Ar Staff add @","") + _nametarget = _name.rstrip(' ') + gs = cl.getGroup(msg.to) + gs = ki.getGroup(msg.to) + gs = kk.getGroup(msg.to) + gs = kc.getGroup(msg.to) + gs = ke.getGroup(msg.to) + targets = [] + for g in gs.members: + if _nametarget == g.displayName: + targets.append(g.mid) + if targets == []: + ki.sendText(msg.to,"Contact not found") + else: + for target in targets: + try: + admin.append(target) + cl.sendText(msg.to,"已給權") + except: + pass + print "[Command]Staff add executed" + else: + cl.sendText(msg.to,"Command denied.") + cl.sendText(msg.to,"Admin permission required.") + + elif "admin remove @" in msg.text: + if msg.from_ in admin: + print "[Command]Staff remove executing" + _name = msg.text.replace("admin remove @","") + _nametarget = _name.rstrip(' ') + gs = cl.getGroup(msg.to) + gs = ki.getGroup(msg.to) + gs = kk.getGroup(msg.to) + gs = kc.getGroup(msg.to) + gs = kg.getGroup(msg.to) + targets = [] + + if _nametarget == g.displayName: + targets.append(g.mid) + if targets == []: + ki.sendText(msg.to,"Contact not found") + else: + for target in targets: + try: + admin.remove(target) + cl.sendText(msg.to,"已移除") + except: + pass + print "[Command]Staff remove executed" + else: + cl.sendText(msg.to,"Command denied.") + cl.sendText(msg.to,"Admin permission required.") + + elif "Admin remove @" in msg.text: + if msg.from_ in admin: + print "[Command]Staff remove executing" + _name = msg.text.replace("Admin remove @","") + _nametarget = _name.rstrip(' ') + gs = cl.getGroup(msg.to) + gs = ki.getGroup(msg.to) + gs = kk.getGroup(msg.to) + gs = kc.getGroup(msg.to) + gs = kg.getGroup(msg.to) + targets = [] + for g in gs.members: + if _nametarget == g.displayName: + targets.append(g.mid) + if targets == []: + ki.sendText(msg.to,"Contact not found") + else: + for target in targets: + try: + admin.remove(target) + cl.sendText(msg.to,"已移除") + except: + pass + print "[Command]Staff remove executed" + else: + cl.sendText(msg.to,"Command denied.") + cl.sendText(msg.to,"Admin permission required.") + + elif msg.text in ["Adminlist","adminlist"]: + if admin == []: + cl.sendText(msg.to,"The stafflist is empty") + else: + cl.sendText(msg.to,"權限名單:") + mc = "" + for mi_d in admin: + mc += "->" +cl.getContact(mi_d).displayName + "\n" + cl.sendText(msg.to,mc) + print "[Command]Stafflist executed" +#----------------------------------------------- + elif "Bc " in msg.text: + if msg.from_ in admin: + bctxt = msg.text.replace("Bc ","") + ki.sendText(msg.to,(bctxt)) + kk.sendText(msg.to,(bctxt)) + kc.sendText(msg.to,(bctxt)) +#----------------------------------------------- + + elif msg.text in ["Respon","respon","absen","Absen"]: + if msg.from_ in admin: + cl.sendText(msg.to,"ılı ѕℓσωєя вσт ılı") + ki.sendText(msg.to,"lıl ѕℓσωєя вσт lıl") + kk.sendText(msg.to,"ılı ѕℓσωєя вσт ılı") + kc.sendText(msg.to,"lıl ѕℓσωєя вσт lıl") + kd.sendText(msg.to,"ılı ѕℓσωєя вσт ılı") + ke.sendText(msg.to,"lıl ѕℓσωєя вσт lıl") + kf.sendText(msg.to,"ılı ѕℓσωєя вσт ılı") +#----------------------------------------------- + + elif msg.text in ["Sp","Speed","speed"]: + start = time.time() + cl.sendText(msg.to, "Progress...") + elapsed_time = time.time() - start + cl.sendText(msg.to, "%sseconds" % (elapsed_time)) + +#------------------------------------------------------------------ + elif msg.text in ["Ban"]: + if msg.from_ in admin: + wait["wblacklist"] = True + cl.sendText(msg.to,"send contact") + elif msg.text in ["Unban"]: + if msg.from_ in admin: + wait["dblacklist"] = True + cl.sendText(msg.to,"send contact") + elif msg.text in ["Banlist"]: + if wait["blacklist"] == {}: + cl.sendText(msg.to,"nothing") + else: + cl.sendText(msg.to,"Blacklist user") + mc = "" + for mi_d in wait["blacklist"]: + mc += "->" +cl.getContact(mi_d).displayName + "\n" + cl.sendText(msg.to,mc) + elif msg.text in ["Cek ban"]: + if msg.toType == 2: + group = cl.getGroup(msg.to) + gMembMids = [contact.mid for contact in group.members] + matched_list = [] + for tag in wait["blacklist"]: + matched_list+=filter(lambda str: str == tag, gMembMids) + cocoa = "" + for mm in matched_list: + cocoa += mm + "\n" + cl.sendText(msg.to,cocoa + "") + elif msg.text in ["Tagall", "tagall"]: + if msg.from_ in admin: + group = cl.getGroup(msg.to) + msg_appended = "" + mem = [contact.mid for contact in group.members] + for mm in mem: + xname = cl.getContact(mm).displayName + xlen = str(len(xname)+1) + msg.contentType = 0 + msg.text = "@"+xname+" " + msg.contentMetadata ={'MENTION':'{"MENTIONEES":[{"S":"0","E":'+json.dumps(xlen)+',"M":'+json.dumps(mm)+'}]}','EMTVER':'4'} + #msg_appended += "->" +msg+ "\n" + try: + cl.sendMessage(msg) + except Exception as error: + print error + elif msg.text in ["Kill ban"]: + if msg.from_ in admin: + if msg.toType == 2: + print "EXCUTED -- KILL BAN" + group = cl.getGroup(msg.to) + gMembMids = [contact.mid for contact in group.members] + matched_list = [] + for tag in wait["blacklist"]: + matched_list+=filter(lambda str: str == tag, gMembMids) + if matched_list == []: + cl.sendText(msg.to,"There was no blacklist user") + return + for jj in matched_list: + print "SUKSES -- KILL BAN" + cl.kickoutFromGroup(msg.to,[jj]) + ki.kickoutFromGroup(msg.to,[jj]) + kk.kickoutFromGroup(msg.to,[jj]) + kc.kickoutFromGroup(msg.to,[jj]) + cl.sendText(msg.to,"Good Bye Sampah") +#-------------------- + elif msg.text in ["km on","kM on","Km on","KM on"]: + if wait["kickme"] == True: + if wait["lang"] == "JP": + if msg.from_ in admin: + cl.sendText(msg.to,"already on") + else: + cl.sendText(msg.to,"done") + else: + wait["kickme"] = True + if wait["lang"] == "JP": + cl.sendText(msg.to,"done") + else: + cl.sendText(msg.to,"ok") + elif msg.text in ["km off","Km off","kM off","KM off"]: + if wait["kickme"] == False: + if wait["lang"] == "JP": + if msg.from_ in admin: + + cl.sendText(msg.to,"already off") + else: + cl.sendText(msg.to,"done") + else: + wait["kickme"] = False + if wait["lang"] == "JP": + cl.sendText(msg.to,"done") + else: + cl.sendText(msg.to,"ok") +#-------------------- + elif msg.text in ["踢我阿","踢我啊","踢我錒","踢我啦","踢我拉","踢我喇","踢我菈","踢我辣"]: + if msg.from_ in admin: + random.choice(KAC).sendText(msg.to, "管理員勿打") + if wait["kickme"] == False: + random.choice(KAC).getGroup(msg.to) + midd = msg.from_ + name = random.choice(KAC).getContact(midd).displayName + random.choice(KAC).sendText(msg.to, name + "\n踢你阿嬤啦[off中]") + + if wait["kickme"] == True: + + random.choice(KAC).getGroup(msg.to) + midd = msg.from_ + name = random.choice(KAC).getContact(midd).displayName + random.choice(KAC).sendText(msg.to, name + "\n你說的哦掰掰") + random.choice(KAC).kickoutFromGroup(msg.to, [midd]) + elif msg.text in ["垃圾","拉基"]: + msg.contentType = 7 + msg.text = None + msg.contentMetadata = { + "STKID": "100", + "STKPKGID": "1", + "STKVER": "100" } + random.choice(KAC).sendText(msg.to, "你才是垃圾") + random.choice(KAC).sendMessage(msg) + elif "Sb Add @" in msg.text: + if msg.toType == 2: + if msg.from_ in admin: + print "[Command]Add executing" + _name = msg.text.replace("Sb Add @","") + _nametarget = _name.rstrip(' ') + gs = ki.getGroup(msg.to) + gs = kk.getGroup(msg.to) + gs = kc.getGroup(msg.to) + gs = kd.getGroup(msg.to) + gs = ke.getGroup(msg.to) + gs = kf.getGroup(msg.to) + targets = [] + for g in gs.members: + if _nametarget == g.displayName: + targets.append(g.mid) + if targets == []: + ki.sendText(msg.to,"Contact not found") + else: + for target in targets: + try: + cl.findAndAddContactsByMid(target) + ki.findAndAddContactsByMid(target) + kk.findAndAddContactsByMid(target) + kc.findAndAddContactsByMid(target) + kd.findAndAddContactsByMid(target) + ke.findAndAddContactsByMid(target) + kf.findAndAddContactsByMid(target) + + except: + ki.sendText(msg.to,"Error") + else: + cl.sendText(msg.to,"Command denied.") + cl.sendText(msg.to,"Admin permission required.") + +#----------- + if op.type == 5: + if wait["autoAdd"] == True: + cl.findAndAddContactsByMid(op.param1) + if (wait["message"] in [""," ","\n",None]): + pass + else: + cl.sendText(op.param1,str(wait["message"])) + + if op.type == 13: + if mid in op.param3: + if wait["autoJoin"] == True: + cl.acceptGroupInvitation(op.param1) + print "BOT 1 Joined" + else: + print "autoJoin is Off" + + if Amid in op.param3: + if wait["autoJoin"] == True: + ki.acceptGroupInvitation(op.param1) + print "BOT 2 Joined" + else: + print "autoJoin is Off" + + if Bmid in op.param3: + if wait["autoJoin"] == True: + kk.acceptGroupInvitation(op.param1) + print "BOT 3 Joined" + else: + print "autoJoin is Off" + + if Cmid in op.param3: + if wait["autoJoin"] == True: + kc.acceptGroupInvitation(op.param1) + print "BOT 4 Joined" + else: + print "autoJoin is Off" + if Dmid in op.param3: + if wait["autoJoin"] == True: + kd.acceptGroupInvitation(op.param1) + if Emid in op.param3: + if wait["autoJoin"] == True: + ke.acceptGroupInvitation(op.param1) + if Fmid in op.param3: + if wait["autoJoin"] == True: + kf.acceptGroupInvitation(op.param1) + if ammid in op.param3: + if wait["autoJoin"] == True: + am.acceptGroupInvitation(op.param1) + else: + if cancelinvite["autoCancel"] == True: + try: + X = cl.getGroup(op.param1) + gInviMids = [contact.mid for contact in X.invitee] + cl.cancelGroupInvitation(op.param1, gInviMids) + print gInviMids + "invite canceled" + except: + try: + print "Retry canceling invitation" + X = random.choice(KAC).getGroup(op.param1) + gInviMids = [contact.mid for contact in X.invitee] + random.choice(KAC).cancelGroupInvitation(op.param1, gInviMids) + print gInviMids + "invite canceled" + except: + print "Bot can't cancel the invitation" + pass + if op.type == 13: + if op.param3 in mid: + if op.param2 in Amid: + G = ki.getGroup(op.param1) + G.preventJoinByTicket = False + ki.updateGroup(G) + Ticket = ki.reissueGroupTicket(op.param1) + cl.acceptGroupInvitationByTicket(op.param1,Ticket) + G.preventJoinByTicket = True + ki.updateGroup(G) + Ticket = ki.reissueGroupTicket(op.param1) + + if op.param3 in Amid: + if op.param2 in Bmid: + X = kk.getGroup(op.param1) + + + + X.preventJoinByTicket = False + kk.updateGroup(X) + Ti = kk.reissueGroupTicket(op.param1) + ki.acceptGroupInvitationByTicket(op.param1,Ti) + X.preventJoinByTicket = True + kk.updateGroup(X) + Ti = kk.reissueGroupTicket(op.param1) + + if op.param3 in Bmid: + if op.param2 in Cmid: + X = kc.getGroup(op.param1) + X.preventJoinByTicket = False + kc.updateGroup(X) + Ti = kc.reissueGroupTicket(op.param1) + kk.acceptGroupInvitationByTicket(op.param1,Ti) + X.preventJoinByTicket = True + kc.updateGroup(X) + Ti = kc.reissueGroupTicket(op.param1) + + if op.param3 in Cmid: + if op.param2 in Dmid: + X = kd.getGroup(op.param1) + X.preventJoinByTicket = False + kd.updateGroup(X) + Ti = kd.reissueGroupTicket(op.param1) + kc.acceptGroupInvitationByTicket(op.param1,Ti) + X.preventJoinByTicket = True + kd.updateGroup(X) + Ti = kd.reissueGroupTicket(op.param1) + + if op.param3 in Dmid: + if op.param2 in Emid: + X = ke.getGroup(op.param1) + X.preventJoinByTicket = False + ke.updateGroup(X) + Ti = ke.reissueGroupTicket(op.param1) + kd.acceptGroupInvitationByTicket(op.param1,Ti) + X.preventJoinByTicket = True + ke.updateGroup(X) + Ti = ke.reissueGroupTicket(op.param1) + + if op.param3 in Emid: + if op.param2 in Fmid: + X = kf.getGroup(op.param1) + X.preventJoinByTicket = False + kf.updateGroup(X) + Ti = kf.reissueGroupTicket(op.param1) + ke.acceptGroupInvitationByTicket(op.param1,Ti) + X.preventJoinByTicket = True + kf.updateGroup(X) + Ti = kf.reissueGroupTicket(op.param1) + + if op.param3 in Fmid: + if op.param2 in mid: + X = cl.getGroup(op.param1) + X.preventJoinByTicket = False + cl.updateGroup(X) + Ti = cl.reissueGroupTicket(op.param1) + kf.acceptGroupInvitationByTicket(op.param1,Ti) + X.preventJoinByTicket = True + cl.updateGroup(X) + Ti = cl.reissueGroupTicket(op.param1) + + if op.type == 13: + print op.param1 + print op.param2 + print op.param3 + if mid in op.param3: + G = cl.getGroup(op.param1) + if wait["autoJoin"] == True: + if wait["autoCancel"]["on"] == True: + if len(G.members) <= wait["autoCancel"]["members"]: + cl.rejectGroupInvitation(op.param1) + else: + cl.acceptGroupInvitation(op.param1) + else: + cl.acceptGroupInvitation(op.param1) + elif wait["autoCancel"]["on"] == True: + if len(G.members) <= wait["autoCancel"]["members"]: + cl.rejectGroupInvitation(op.param1) + else: + Inviter = op.param3.replace("",',') + InviterX = Inviter.split(",") + matched_list = [] + + for tag in wait["blacklist"]: + matched_list+=filter(lambda str: str == tag, InviterX) + if matched_list == []: + pass + else: + cl.cancelGroupInvitation(op.param1, matched_list) + + + if op.type == 11: + if op.param2 in Bots: + return + if op.param2 in admin: + return + elif wait ["protectqr"] == True: + X = random.choice(KAC).getGroup(op.param1) + X.preventJoinByTicket = True + random.choice(KAC).updateGroup(X) + else: + pass + + if op.type == 19: + if op.param2 in Bots: + return + if op.param2 in admin: + return + elif wait ["protect"] == True: + random.choice(KAC).kickoutFromGroup(op.param1,[op.param2]) + random.choice(KAC).inviteIntoGroup(op.param1,[op.param3]) + + if op.type == 13: + if op.param2 in Bots: + return + if op.param2 in admin: + return + if wait ["protectinv"] == True: + try: + X = cl.getGroup(op.param1) + gInviMids = [contact.mid for contact in X.invitee] + cl.cancelGroupInvitation(msg.to, gInviMids) + print gInviMids + "INVITE CANCEL" + except: + try: + print "RETRY CANCEL INVITATION" + X = cl.getGroup(op.param1) + gInviMids = [contact.mid for contact in X.invitee] + cl.cancelGroupInvitation(op.param1, gInviMids) + print gInviMids + "INVITE CANCELED" + except: + print "BOT CAN'T CANCEL THE INVITATION" + pass + +#----------------------------------------------------- + if mid in op.param3: + print "BOT1 has been kicked" + if op.param2 in Bots: + pass + if op.param2 in admin: + pass + else: + ki.kickoutFromGroup(op.param1,[op.param2]) + wait["blacklist"][op.param2] = True + print "kicker kicked" + try: + kk.inviteIntoGroup(op.param1,op.param3) + cl.acceptGroupInvitation(op.param1) + except: + random.choice(KAC).inviteIntoGroup(op.param1,op.param3) + cl.acceptGroupInvitation(op.param1) + print "BOT1 Joined" + + if Amid in op.param3: + print "BOT2 has been kicked" + if op.param2 in Bots: + pass + if op.param2 in admin: + pass + else: + kd.kickoutFromGroup(op.param1,[op.param2]) + wait["blacklist"][op.param2] = True + print "kicker kicked" + try: + kd.inviteIntoGroup(op.param1,op.param3) + ki.acceptGroupInvitation(op.param1) + except: + random.choice(KAC).inviteIntoGroup(op.param1,op.param3) + ki.acceptGroupInvitation(op.param1) + print "BOT2 Joined" + + if Bmid in op.param3: + print "BOT3 has been kicked" + if op.param2 in Bots: + pass + if op.param2 in admin: + pass + else: + kc.kickoutFromGroup(op.param1,[op.param2]) + wait["blacklist"][op.param2] = True + print "kicker kicked" + try: + kc.inviteIntoGroup(op.param1,op.param3) + kk.acceptGroupInvitation(op.param1) + except: + random.choice(KAC).inviteIntoGroup(op.param1,op.param3) + kk.acceptGroupInvitation(op.param1) + print "BOT3 Joined" + + if Cmid in op.param3: + print "BOT4 has been kicked" + if op.param2 in Bots: + pass + if op.param2 in admin: + pass + else: + kf.kickoutFromGroup(op.param1,[op.param2]) + wait["blacklist"][op.param2] = True + print "kicker kicked" + try: + ke.inviteIntoGroup(op.param1,op.param3) + kc.acceptGroupInvitation(op.param1) + except: + random.choice(KAC).inviteIntoGroup(op.param1,op.param3) + kc.acceptGroupInvitation(op.param1) + print "BOT4 Joined" + + if Dmid in op.param3: + print "BOT5 has been kicked" + if op.param2 in Bots: + pass + if op.param2 in admin: + pass + else: + kf.kickoutFromGroup(op.param1,[op.param2]) + wait["blacklist"][op.param2] = True + print "kicker kicked" + try: + kg.inviteIntoGroup(op.param1,op.param3) + kd.acceptGroupInvitation(op.param1) + except: + random.choice(KAC).inviteIntoGroup(op.param1,op.param3) + kd.acceptGroupInvitation(op.param1) + print "BOT5 Joined" + if Emid in op.param3: + print "BOT6 has been kicked" + if op.param2 in Bots: + pass + if op.param2 in admin: + pass + else: + cl.kickoutFromGroup(op.param1,[op.param2]) + wait["blacklist"][op.param2] = True + print "kicker kicked" + try: + kf.inviteIntoGroup(op.param1,op.param3) + ke.acceptGroupInvitation(op.param1) + except: + random.choice(KAC).inviteIntoGroup(op.param1,op.param3) + ke.acceptGroupInvitation(op.param1) + print "BOT6 Joined" + if Fmid in op.param3: + print "BOT7 has been kicked" + if op.param2 in Bots: + pass + if op.param2 in admin: + pass + else: + kk.kickoutFromGroup(op.param1,[op.param2]) + wait["blacklist"][op.param2] = True + print "kicker kicked" + try: + ke.inviteIntoGroup(op.param1,op.param3) + kf.acceptGroupInvitation(op.param1) + except: + random.choice(KAC).inviteIntoGroup(op.param1,op.param3) + kf.acceptGroupInvitation(op.param1) + print "BOT2 Joined" + + else: + cl.kickoutFromGroup(op.param1,[op.param2]) + kk.kickoutFromGroup(op.param1,[op.param2]) + ki.kickoutFromGroup(op.param1,[op.param2]) + kc.kickoutFromGroup(op.param1,[op.param2]) + kd.kickoutFromGroup(op.param1,[op.param2]) + ke.kickoutFromGroup(op.param1,[op.param2]) + kf.kickoutFromGroup(op.param1,[op.param2]) + wait["blacklist"][op.param2] = True + print "autokick executed" +#----------------------------------------------------- +#----------- + if op.type == 59: + print op + + + except Exception as error: + print error + + +def a2(): + now2 = datetime.now() + nowT = datetime.strftime(now2,"%M") + if nowT[14:] in ["10","20","30","40","50","00"]: + return False + else: + return True + +def nameUpdate(): + while True: + try: + #while a2(): + #pass + if wait["clock"] == True: + now2 = datetime.now() + nowT = datetime.strftime(now2,"(%H:%M)") + profile = cl.getProfile() + profile.displayName = wait["cName"] + nowT + cl.updateProfile(profile) + time.sleep(600) + except: + pass +thread2 = threading.Thread(target=nameUpdate) +thread2.daemon = True +thread2.start() + +#def autolike(): +# for zx in range(0,20): +# hasil = cl.activity(limit=20) +# if hasil['result']['posts'][zx]['postInfo']['liked'] == False: +# try: +# cl.like(hasil['result']['posts'][zx]['userInfo']['mid'],hasil['result']['posts'][zx]['postInfo']['postId'],likeType=1002) +# cl.comment(hasil['result']['posts'][zx]['userInfo']['mid'],hasil['result']['posts'][zx]['postInfo']['postId'],"Auto Like by ㄩㄗ大神") ki.like(hasil['result']['posts'][zx]['userInfo']['mid'],hasil['result']['posts'][zx]['postInfo']['postId'],likeType=1002) +# kk.like(hasil['result']['posts'][zx]['userInfo']['mid'],hasil['result']['posts'][zx]['postInfo']['postId'],likeType=1002) +# kc.like(hasil['result']['posts'][zx]['userInfo']['mid'],hasil['result']['posts'][zx]['postInfo']['postId'],likeType=1002) +# kd.like(hasil['result']['posts'][zx]['userInfo']['mid'],hasil['result']['posts'][zx]['postInfo']['postId'],likeType=1002) +# ke.like(hasil['result']['posts'][zx]['userInfo']['mid'],hasil['result']['posts'][zx]['postInfo']['postId'],likeType=1002) +# kf.like(hasil['result']['posts'][zx]['userInfo']['mid'],hasil['result']['posts'][zx]['postInfo']['postId'],likeType=1002) +# print "Like" +# except: +# pass +# else: +# print "Already Liked" +# time.sleep(5000) +#thread2 = #threading.Thread(target=autolike) +#thread2.daemon = True +#thread2.start() + +while True: + try: + Ops = cl.fetchOps(cl.Poll.rev, 5) + except EOFError: + raise Exception("It might be wrong revision\n" + str(cl.Poll.rev)) + + for Op in Ops: + if (Op.type != OpType.END_OF_OPERATION): + cl.Poll.rev = max(cl.Poll.rev, Op.revision) + bot(Op)