Best Python code snippet using mailosaur-python_python
newsb.py
Source:newsb.py  
1# -*- coding: utf-8 -*-2import LINETCR3import wikipedia4import urllib5import subprocess6import profile7import requests8from LINETCR.lib.curve.ttypes import *9from datetime import datetime10import time,random,sys,json,codecs,threading,glob,re11from bs4 import BeautifulSoup12from threading import Thread13from gtts import gTTS14import urllib315cl = LINETCR.LINE()16cl.login(qr=True)17#cl.login(token='')18cl.loginResult()19print "===[Login Success]==="20helpMessage ="""21âââà³â¢ â â¢à³ââââ22      âมิà¸à¸à¸à¸à¸à¸´à¸à¸à¸µà¹â23        âsá´ÊÒÊá´á´â    24âââà³â¢ â â¢à³ââââ25ðBY.มิà¸à¸à¸à¸à¸à¸´à¸à¸à¸µà¹ð26ðBY.Min Team Hack ð27ðBY.Min Hack Botð28ðBY.GU Hack Botð29ð¡sá´á´á´ÉªÉ´É¢ á´á´á´
ð¡30â[Url:on/off]ðลิà¹à¸à¸«à¹à¸à¸31â[Autojoin:on/off]ðà¹à¸à¹à¸²à¸à¸¥à¸¸à¹à¸¡à¸à¸±à¸à¹à¸à¸¡à¸±à¸32â[Autocancel:on/offðà¸à¸à¹à¸à¹à¸¢à¸à¹à¸¥à¸´à¸33â[Qr:on/off]ðลิà¹à¸QR34â[Autokick:on/off]ðà¸à¸à¹à¸à¹à¸à¸¥à¸´à¸35â[Contact:on/off]ðà¸à¸à¸à¹à¸à¸à¸à¹à¸²à¸36â[Status]ðสà¸à¸²à¸à¸°37â»ï¸sá´á´á´Ê á´á´á´
â»ï¸38â[Steal contact @{name}]ðมิรูà¹39â[Steal mid @{name}]ðมิรูà¹40â[Steal group pict]ðมิรูà¹41â[Steal bio @{name}]ðมิรูà¹42â[Steal cover @{name}]ðà¹à¸à¸²à¸£à¸¹à¸43â[Steal pict @{name}]ðà¹à¸à¸²à¸à¸44â£ï¸á´á´Êá´ á´á´ Êɪsá´ á´á´á´
â£ï¸45â[Ban @{name}]ðà¹à¸à¸46â[Unban @{name}]ðยà¸à¹à¸¥à¸´à¸à¹à¸à¸47â[Ban {send contact}]ðà¹à¸à¸à¹à¸£à¸¡à¸´à¸£à¸¹à¹48â[Unban {send contact}]ðยà¸à¹à¸¥à¸´à¸à¹à¸à¸à¸¡à¸´à¸£à¸¹à¹49â[Banlist]ðà¹à¸à¸à¸£à¸´à¸ª50â[Kick @{name}]ðà¹à¸à¸°à¸à¸51â[Kill ban]ðà¹à¸à¸°à¸à¸à¸à¸µà¹à¹à¸£à¸²à¹à¸à¸à¹à¸§à¹52â[Spamcontact @{name}]ðสà¹à¸à¸¡à¸à¸à¸à¹à¸à¸53â[Copy @{name}]ðà¸à¹à¸à¸à¸à¸µà¹54â[Backup me]ðà¸à¸à¸à¸à¸²à¸à¸à¸²à¸£à¸à¹à¸à¸à¸à¸µà¹55â[Gn: {Text}]ðมิรูà¹56â[Kick: {mid}ðà¸à¸´à¸à¸¡à¸´à¸£à¸¹à¹57â[Invite: {mid}]ðà¸à¸¶à¸à¸¡à¸´à¸£à¸¹à¹58âá´Êá´á´ Êá´Êá´á´á´á´
â59â[Wikipedia {text search}]ðมิรูà¹60â[Music ]ðà¸à¸à¸à¸£à¸µ61â[.instagram {username}]ðมิรูà¹62â[/say {text}]ðà¹à¸§à¹à¹à¸¥à¹à¸à¸à¸´à¸63â[Vidio {text search}]ðมิรูà¹64â[Creator]ðà¸à¸à¸ªà¸£à¹à¸²à¸à¸à¸à¹à¸à¸µà¸¢à¸65â[Ginfo]ðà¹à¸à¹à¸à¸à¸¥à¸¸à¹à¸¡à¸¡à¸±à¹à¸66â[à¸à¸¥à¸¸à¹à¸¡à¹à¸à¸£]ðà¸à¸à¸ªà¸£à¹à¸²à¸à¸à¸¥à¸¸à¹à¸¡67â[Glist]ðมิรูà¹68â[Gurl]ðมิรูà¹69â[Ourl/Curl]ðมิรูà¹70â[à¹à¸à¸]ðà¹à¸à¹à¸à¸à¸à¸à¸±à¹à¸à¸«à¸¡à¸71â[Mid @]ðà¹à¸à¹à¸72â[Gift]ðà¸à¸à¸à¸à¸§à¸±à¸73â[Welcome]ðยิà¸à¸à¸µà¸à¹à¸à¸à¸£à¸±à¸74â[Speed]ðà¹à¸à¸ªà¸ªà¸à¸µà¸à¸à¸à¸75â[Set]ðà¹à¸à¹à¸à¸à¸²à¸£à¸à¸±à¹à¸à¸à¹à¸²76â[Read]ðมิรูà¹77â[ยà¸à¹à¸à¸´à¸]ð
78"""79mid = cl.getProfile().mid80Creator="ua1cb6e845fe8f2646fe8a5c5911841fa"81admin=["ua1cb6e845fe8f2646fe8a5c5911841fa"]82owner="ua1cb6e845fe8f2646fe8a5c5911841fa"83contact = cl.getProfile()84backup = cl.getProfile()85backup.displayName = contact.displayName86backup.statusMessage = contact.statusMessage87backup.pictureStatus = contact.pictureStatus88wait = {89    "LeaveRoom":True,90    "AutoJoin":True,91    "Members":0,92    "AutoCancel":False,93    "AutoKick":False,       94    "blacklist":{},95    "wblacklist":False,96    "dblacklist":False,97    "Qr":True,98    "Timeline":True,99    "Contact":True,100    "lang":"JP",101    "BlGroup":{}102}103def sendMessage(to, text, contentMetadata={}, contentType=0):104    mes = Message()105    mes.to, mes.from_ = to, profile.mid106    mes.text = text107    mes.contentType, mes.contentMetadata = contentType, contentMetadata108    if to not in messageReq:109        messageReq[to] = -1110    messageReq[to] += 1111    112def yt(query):113    with requests.session() as s:114         isi = []115         if query == "":116             query = "S1B tanysyz"   117         s.headers['user-agent'] = 'Mozilla/5.0'118         url    = 'http://www.youtube.com/results'119         params = {'search_query': query}120         r    = s.get(url, params=params)121         soup = BeautifulSoup(r.content, 'html5lib')122         for a in soup.select('.yt-lockup-title > a[title]'):123            if '&list=' not in a['href']:124                if 'watch?v' in a['href']:125                    b = a['href'].replace('watch?v=', '')126                    isi += ['youtu.be' + b]127         return isi128def bot(op):129    try:130# ----------------- NOTIFED MEMBER OUT GROUP131        if op.type == 15:132            if op.param2 in bot1:133                return134            cl.sendText(op.param1,"มาà¹à¸§à¹à¸à¹à¸§à¸à¸£à¸´à¸à¹à¸à¸±à¸à¸«à¸³   " + cl.getContact(op.param2).displayName + "  ลาà¸à¹à¸à¸¢\nï½(^з^)-â¡\n\n\n\nà¹à¸¥à¹à¸§à¹à¸à¸à¸à¸±à¸\nà¹à¸¡à¸·à¹à¸à¸à¸²à¸à¸´à¸à¹à¸à¸à¸à¸²à¸£\nâहठ௮ิЮð¥ã®à¸´à¦ã®à¶§à¬ð¥à¤à¤¹â")135            print ("MEMBER HAS LEFT THE GROUP")136#------------------ KICK OUT FORM GROUP137        if op.type == 19:138            if op.param2 in bot1:139                return140            cl.sendText(op.param1,cl.getContact(op.param2).displayName + " à¸à¸±à¸à¹à¸à¹à¸¡à¸à¹à¸à¹à¸¥à¸¢à¸à¸£à¸±à¸ à¸à¹à¸²à¸à¸à¸¹à¹à¸à¸¡")141            print "MEMBER KICK OUT FORM GROUP"142# ----------------- NOTIFED MEMBER JOIN GROUP143        if op.type == 17:144            if op.param2 in bot1:145                return146            ginfo = cl.getGroup(op.param1)147            cl.sendText(op.param1, "ยิà¸à¸à¸µà¸à¹à¸à¸à¸£à¸±à¸à¹à¸à¹à¸à¸±à¸à¸«à¸³ ð  " + cl.getContact(op.param2).displayName + " สูà¹à¸à¸¥à¸¸à¹à¸¡ " + "ð" + str(ginfo.name) + "ð""\n\nมาà¹à¸¥à¹à¸§à¸à¹à¸à¸³à¸à¸±à¸§à¸à¸µà¹à¸«à¸à¹à¸à¸¢à¸à¸°à¸à¸±à¸à¸«à¸³\nà¸à¸¥à¸¸à¹à¸¡à¸à¸µà¹à¸¢à¸´à¸à¸à¸µà¸à¸à¸à¸£à¸±à¸à¹à¸ªà¸¡à¸à¸«à¸³\n\n\nà¹à¸à¹à¸à¸µà¹à¹à¸¥à¹à¸§à¸à¸±à¸à¹à¸à¸à¸°à¸à¸¹à¹à¸«à¸à¸·à¸à¸¢\n\nà¸à¸´à¸à¹à¸¡à¹à¸à¸à¸555\n\nâहठ௮ิЮð¥ã®à¸´à¦ã®à¶§à¬ð¥à¤à¤¹â")148            print "MEMBER HAS JOIN THE GROUP"149     #----------------------------------------------------------------150            elif msg.text in ["Reject","ลà¸à¸£à¸±à¸"]:151                gid = cl.getGroupIdsInvited()152                for i in gid:153                    cl.rejectGroupInvitation(i)154                if wait["lang"] == "JP":155                    cl.sendText(msg.to,"à¸à¸à¸´à¹à¸ªà¸à¸à¸³à¹à¸à¸´à¸à¹à¸à¹à¸²à¸à¸¥à¸¸à¹à¸¡à¸à¸±à¹à¸à¸«à¸¡à¸à¹à¸£à¸µà¸¢à¸à¸£à¹à¸à¸¢")156                else:157                    cl.sendText(msg.to,"key is wrong")158            elif msg.text in ["me","à¸à¸","à¹à¸à¹à¸²","à¹à¸à¹à¸²à¹à¸à¸"]:159                msg.contentType = 13160                msg.contentMetadata = {'mid': mid}161                cl.sendMessage(msg)162#--------------------END_OF_OPERATION--------------------163        if op.type == 0:164            return165#-------------------NOTIFIED_READ_MESSAGE----------------166        if op.type == 55:167	    try:168	      group_id = op.param1169	      user_id=op.param2170	      subprocess.Popen('echo "'+ user_id+'|'+str(op.createdTime)+'" >> dataSeen/%s.txt' % group_id, shell=True, stdout=subprocess.PIPE, )171	    except Exception as e:172	      print e173#------------------NOTIFIED_INVITE_INTO_ROOM-------------174        if op.type == 22:175            cl.leaveRoom(op.param1)176#--------------------INVITE_INTO_ROOM--------------------177        if op.type == 21:178            cl.leaveRoom(op.param1)179#--------------NOTIFIED_INVITE_INTO_GROUP----------------180	    if mid in op.param3:181                if wait["AutoJoin"] == True:182                    cl.acceptGroupInvitation(op.param1)183                else:184		    cl.rejectGroupInvitation(op.param1)185	    else:186                if wait["AutoCancel"] == True:187		    if op.param3 in admin:188			pass189		    else:190                        cl.cancelGroupInvitation(op.param1, [op.param3])191		else:192		    if op.param3 in wait["blacklist"]:193			cl.cancelGroupInvitation(op.param1, [op.param3])194			cl.sendText(op.param1, "Itu kicker jgn di invite!")195		    else:196			pass197#------------------NOTIFIED_KICKOUT_FROM_GROUP-----------------198        if op.type == 19:199		if wait["AutoKick"] == True:200                    if op.param2 in admin:201                        pass202                    try:203                        cl.kickoutFromGroup(op.param1,[op.param2])204			cl.inviteIntoGroup(op.param1,[op.param3])205                    except:206                        try:207			    cl.kickoutFromGroup(op.param1,[op.param2])208			    cl.inviteIntoGroup(op.param1,[op.param3])209                        except:210                            print ("client Kick regulation or Because it does not exist in the group\ngid=["+op.param1+"]\nmid=["+op.param2+"]")211                        if op.param2 in wait["blacklist"]:212                            pass213                        else:214			    if op.param2 in admin:215			        pass216			    else:217                                wait["blacklist"][op.param2] = True218                    if op.param2 in wait["blacklist"]:219                        pass220                    else:221		        if op.param2 in admin:222			    pass223		        else:224                            wait["blacklist"][op.param2] = True225#--------------------------NOTIFIED_UPDATE_GROUP---------------------226        if op.type == 11:227            if wait["Qr"] == True:228		if op.param2 in admin:229		    pass230		else:231                    cl.sendText(msg.to, "Jangan mainan QR ntr ada kicker")232            else:233                pass234#--------------------------SEND_MESSAGE---------------------------235        if op.type == 25:236            msg = op.message237#----------------------------------------------------------------------------238            if msg.contentType == 13:239                if wait["wblacklist"] == True:240		    if msg.contentMetadata["mid"] not in admin:241                        if msg.contentMetadata["mid"] in wait["blacklist"]:242                            cl.sendText(msg.to,"already")243                            wait["wblacklist"] = False244                        else:245                            wait["blacklist"][msg.contentMetadata["mid"]] = True246                            wait["wblacklist"] = False247                            cl.sendText(msg.to,"aded")248		    else:249			cl.sendText(msg.to,"Admin Detected~")250			251                elif wait["dblacklist"] == True:252                    if msg.contentMetadata["mid"] in wait["blacklist"]:253                        del wait["blacklist"][msg.contentMetadata["mid"]]254                        cl.sendText(msg.to,"deleted")255                        wait["dblacklist"] = False256                    else:257                        wait["dblacklist"] = False258                        cl.sendText(msg.to,"It is not in the black list")259#--------------------------------------------------------260                elif wait["Contact"] == True:261                     msg.contentType = 0262                     cl.sendText(msg.to,msg.contentMetadata["mid"])263                     if 'displayName' in msg.contentMetadata:264                         contact = cl.getContact(msg.contentMetadata["mid"])265                         try:266                             cu = cl.channel.getCover(msg.contentMetadata["mid"])267                         except:268                             cu = ""269                         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))270                     else:271                         contact = cl.getContact(msg.contentMetadata["mid"])272                         try:273                             cu = cl.channel.getCover(msg.contentMetadata["mid"])274                         except:275                             cu = ""276                         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))277#--------------------------------------------------------278            elif msg.text == "Ginfo":279                if msg.toType == 2:280                    ginfo = cl.getGroup(msg.to)281                    try:282                        gCreator = ginfo.creator.displayName283                    except:284                        gCreator = "Error"285                    if wait["lang"] == "JP":286                        if ginfo.invitee is None:287                            sinvitee = "0"288                        else:289                            sinvitee = str(len(ginfo.invitee))290                        if ginfo.preventJoinByTicket == True:291                            u = "close"292                        else:293                            u = "open"294                        cl.sendText(msg.to,"[Group name]\n" + str(ginfo.name) + "\n\n[Gid]\n" + msg.to + "\n\n[Group creator]\n" + gCreator + "\n\n[Profile status]\nhttp://dl.profile.line.naver.jp/" + ginfo.pictureStatus + "\n\nMembers:" + str(len(ginfo.members)) + "members\nPending:" + sinvitee + "people\nURL:" + u + "it is inside")295                    else:296                        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)297                else:298                    if wait["lang"] == "JP":299                        cl.sendText(msg.to,"Can not be used outside the group")300                    else:301                        cl.sendText(msg.to,"Not for use less than group")302#--------------------------------------------------------303            elif msg.text is None:304                return305#--------------------------------------------------------306            elif msg.text in ["Creator"]:307                msg.contentType = 13308                msg.contentMetadata = {'mid': Creator}309                cl.sendMessage(msg)310		cl.sendText(msg.to,"à¸à¸¹à¹à¸ªà¸£à¹à¸²à¸à¸à¸¹à¹à¹à¸à¸µà¸¢à¸\n\nมิà¸à¸à¸à¸à¸à¸´à¸à¸à¸µà¹ð")311#--------------------------------------------------------312	    elif msg.text in ["à¸à¸¥à¸¸à¹à¸¡à¹à¸à¸£","Gcreator","gcreator"]:313		ginfo = cl.getGroup(msg.to)314		gCreator = ginfo.creator.mid315                msg.contentType = 13316                msg.contentMetadata = {'mid': gCreator}317                cl.sendMessage(msg)318		cl.sendText(msg.to,"Itu Yang Buat Grup Ini")319#--------------------------------------------------------320            elif msg.contentType == 16:321                if wait["Timeline"] == True:322                    msg.contentType = 0323                    msg.text = "post URL\n" + msg.contentMetadata["postEndUrl"]324                    cl.sendText(msg.to,msg.text)325#--------------------------------------------------------326            elif msg.text in ["Key","help","Help"]:327                cl.sendText(msg.to,helpMessage)328#--------------------------------------------------------329            elif msg.text in ["List group","Glist","glist"]:330                gid = cl.getGroupIdsJoined()331                h = ""332		jml = 0333                for i in gid:334		    gn = cl.getGroup(i).name335                    h += "ââÍ¡Íâ£ã%sã\n" % (gn)336		    jml += 1337                cl.sendText(msg.to,"======[List Group]======\n"+ h +"Total group: "+str(jml))338#--------------------------------------------------------339	    elif "Leave group: " in msg.text:340		ng = msg.text.replace("Leave group: ","")341		gid = cl.getGroupIdsJoined()342                for i in gid:343                    h = cl.getGroup(i).name344		    if h == ng:345			cl.sendText(i,"Bye "+h+"~")346		        cl.leaveGroup(i)347			cl.sendText(msg.to,"Success left ["+ h +"] group")348		    else:349			pass350#--------------------------------------------------------351#--------------------------------------------------------352            elif msg.text in ["cancel","ยà¸à¹à¸à¸´à¸"]:353                if msg.toType == 2:354                    X = cl.getGroup(msg.to)355                    if X.invitee is not None:356                        gInviMids = [contact.mid for contact in X.invitee]357                        cl.cancelGroupInvitation(msg.to, gInviMids)358                    else:359                        cl.sendText(msg.to,"No one is inviting")360                else:361                    Cl.sendText(msg.to,"Can not be used outside the group")362#--------------------------------------------------------363            elif msg.text in ["Ourl","Url:on"]:364                if msg.toType == 2:365                    X = cl.getGroup(msg.to)366                    X.preventJoinByTicket = False367                    cl.updateGroup(X)368                    cl.sendText(msg.to,"Url Active")369                else:370                    cl.sendText(msg.to,"Can not be used outside the group")371#--------------------------------------------------------372            elif msg.text in ["Curl","Url:off"]:373                if msg.toType == 2:374                    X = cl.getGroup(msg.to)375                    X.preventJoinByTicket = True376                    cl.updateGroup(X)377                    cl.sendText(msg.to,"Url inActive")378                else:379                    cl.sendText(msg.to,"Can not be used outside the group")380#--------------------------------------------------------381            elif msg.text in ["Join on","Autojoin:on"]:382                wait["AutoJoin"] = True383                cl.sendText(msg.to,"AutoJoin Active")384            elif msg.text in ["Join off","Autojoin:off"]:385                wait["AutoJoin"] = False386                cl.sendText(msg.to,"AutoJoin inActive")387#--------------------------------------------------------388	    elif msg.text in ["Autocancel:on"]:389                wait["AutoCancel"] = True390                cl.sendText(msg.to,"The group of people and below decided to automatically refuse invitation")391		print wait["AutoCancel"][msg.to]392	    elif msg.text in ["Autocancel:off"]:393                wait["AutoCancel"] = False394                cl.sendText(msg.to,"Invitation refused turned off")395		print wait["AutoCancel"][msg.to]396#--------------------------------------------------------397	    elif "Qr:on" in msg.text:398	        wait["Qr"] = True399	    	cl.sendText(msg.to,"QR Protect Active")400	    elif "Qr:off" in msg.text:401	    	wait["Qr"] = False402	    	cl.sendText(msg.to,"Qr Protect inActive")403#--------------------------------------------------------404	    elif "Autokick:on" in msg.text:405		wait["AutoKick"] = True406		cl.sendText(msg.to,"AutoKick Active")407	    elif "Autokick:off" in msg.text:408		wait["AutoKick"] = False409		cl.sendText(msg.to,"AutoKick inActive")410#--------------------------------------------------------411            elif msg.text in ["K on","Contact:on"]:412                wait["Contact"] = True413                cl.sendText(msg.to,"Contact Active")414            elif msg.text in ["K off","Contact:off"]:415                wait["Contact"] = False416                cl.sendText(msg.to,"Contact inActive")417#--------------------------------------------------------418            elif msg.text in ["Set","Setting"]:419                md = ""420		if wait["AutoJoin"] == True: md+="⦠Auto join : on\n"421                else: md +="⦠Auto join : off\n"422		if wait["Contact"] == True: md+="⦠Info Contact : on\n"423		else: md+="⦠Info Contact : off\n"424                if wait["AutoCancel"] == True:md+="⦠Auto cancel : on\n"425                else: md+= "⦠Auto cancel : off\n"426		if wait["Qr"] == True: md+="⦠Qr Protect : on\n"427		else:md+="⦠Qr Protect : off\n"428		if wait["AutoKick"] == True: md+="⦠Autokick : on\n"429		else:md+="⦠Autokick : off"430                cl.sendText(msg.to,"=====[Status]=====\n"+md)431#--------------------------------------------------------432            elif msg.text in ["Gift","gift"]:433                msg.contentType = 9434                msg.contentMetadata={'PRDID': 'a0768339-c2d3-4189-9653-2909e9bb6f58',435                                    'PRDTYPE': 'THEME',436                                    'MSGTPL': '5'}437                msg.text = None438                cl.sendMessage(msg)439            elif msg.text in ["Gift1"]:440                msg.contentType = 9441                msg.contentMetadata={'PRDID': '696d7046-843b-4ed0-8aac-3113ed6c0733',442                                    'PRDTYPE': 'THEME',443                                    'MSGTPL': '6'}444                msg.text = None445                cl.sendMessage(msg)446            elif msg.text in ["Gift2"]:447                msg.contentType = 9448                msg.contentMetadata={'PRDID': '8fe8cdab-96f3-4f84-95f1-6d731f0e273e',449                                    'PRDTYPE': 'THEME',450                                    'MSGTPL': '7'}451                msg.text = None452                cl.sendMessage(msg)453            elif msg.text in ["Gift3"]:454                msg.contentType = 9455                msg.contentMetadata={'PRDID': 'ae3d9165-fab2-4e70-859b-c14a9d4137c4',456                                    'PRDTYPE': 'THEME',457                                    'MSGTPL': '8'}458                msg.text = None459                cl.sendMessage(msg)460#--------------------------------------------------------461            elif msg.text in ["à¹à¸à¸","tagall","Tagall","Tag All"]:462              if msg.from_ in admin:463                group = cl.getGroup(msg.to)464                nama = [contact.mid for contact in group.members]465                cb = ""466                cb2 = "" 467                strt = int(0)468                akh = int(0)469                for md in nama:470                    akh = akh + int(6)471                    cb += """{"S":"""+json.dumps(str(strt))+""","E":"""+json.dumps(str(akh))+""","M":"""+json.dumps(md)+"},"""472                    strt = strt + int(7)473                    akh = akh + 1474                    cb2 += "@nrik \n"475                cb = (cb[:int(len(cb)-1)])476                msg.contentType = 0477                msg.text = cb2478                msg.contentMetadata ={'MENTION':'{"MENTIONEES":['+cb+']}','EMTVER':'4'}479                try:480                    ki.sendMessage(msg)481                except Exception as error:482                    print error483            elif "Rename:" in msg.text:484              if msg.from_ in owner:485                string = msg.text.replace("Rename:","")486                if len(string.decode('utf-8')) <= 99999999999999999999999999999999999999999:487                    profile = cl.getProfile()488                    profile.displayName = string489                    cl.updateProfile(profile)490                    491            elif "Mid @" in msg.text:492                _name = msg.text.replace("Mid @","")493                _nametarget = _name.rstrip(' ')494                gs = cl.getGroup(msg.to)495                for g in gs.members:496                    if _nametarget == g.displayName:497                        cl.sendText(msg.to, g.mid)498                    else:499                        cl.sendText(msg.to,"Error.")500                        501            elif "Spamcontact @" in msg.text:502                _name = msg.text.replace("Spamcontact @","")503                _nametarget = _name.rstrip(' ')504                gs = cl.getGroup(msg.to)505                for g in gs.members:506                    if _nametarget == g.displayName:507                       cl.sendText(g.mid,"Spam")508                       cl.sendText(g.mid,"Spam")509                       cl.sendText(g.mid,"Spam")510                       cl.sendText(g.mid,"Spam")511                       cl.sendText(g.mid,"Spam")512                       cl.sendText(g.mid,"Spam") 513                       cl.sendText(g.mid,"Spam")514                       cl.sendText(g.mid,"Spam")515                       cl.sendText(g.mid,"Spam")516                       cl.sendText(g.mid,"Spam")517                       cl.sendText(g.mid,"Spam")518                       cl.sendText(g.mid,"Spam")519                       cl.sendText(g.mid,"Spam")520                       cl.sendText(g.mid,"Spam")521                       cl.sendText(g.mid,"Spam")522                       cl.sendText(g.mid,"Spam")523                       cl.sendText(g.mid,"Spam")524                       cl.sendText(g.mid,"Spam")525                       cl.sendText(g.mid,"Spam")526                       cl.sendText(g.mid,"Spam")527                       cl.sendText(g.mid,"Spam")528                       cl.sendText(g.mid,"Spam")529                       cl.sendText(g.mid,"Spam")530                       cl.sendText(g.mid,"Spam")531                       cl.sendText(g.mid,"Spam")532                       cl.sendText(g.mid,"Spam")533                       cl.sendText(g.mid,"Spam")534                       cl.sendText(g.mid,"Spam")535                       cl.sendText(g.mid,"Spam")536                       cl.sendText(g.mid,"Spam")537                       cl.sendText(g.mid,"Spam")538                       cl.sendText(g.mid,"Spam")539                       cl.sendText(g.mid,"Spam")540                       cl.sendText(g.mid,"Spam")541                       cl.sendText(g.mid,"Spam")542                       cl.sendText(g.mid,"Spam")543                       cl.sendText(g.mid,"Spam") 544                       cl.sendText(g.mid,"Spam")545                       cl.sendText(g.mid,"Spam")546                       cl.sendText(g.mid,"Spam")547                       cl.sendText(g.mid,"Spam")548                       cl.sendText(g.mid,"Spam")549                       cl.sendText(g.mid,"Spam")550                       cl.sendText(g.mid,"Spam")551                       cl.sendText(g.mid,"Spam")552                       cl.sendText(g.mid,"Spam")553                       cl.sendText(g.mid,"Spam")554                       cl.sendText(g.mid,"Spam")555                       cl.sendText(g.mid,"Spam")556                       cl.sendText(g.mid,"Spam")557                       cl.sendText(g.mid,"Spam")558                       cl.sendText(g.mid,"Spam")559                       cl.sendText(g.mid,"Spam")560                       cl.sendText(g.mid,"Spam")561                       cl.sendText(g.mid,"Spam")562                       cl.sendText(g.mid,"Spam")563                       cl.sendText(g.mid,"Spam")564                       cl.sendText(g.mid,"Spam")565                       cl.sendText(g.mid,"Spam")566                       cl.sendText(g.mid,"Spam")567                       cl.sendText(g.mid,"Spam")568                       cl.sendText(g.mid,"Spam")569                       cl.sendText(g.mid,"Spam")570                       cl.sendText(g.mid,"Spam")571                       cl.sendText(g.mid,"Spam")572                       cl.sendText(g.mid,"Spam")573                       cl.sendText(g.mid,"Spam")574                       cl.sendText(g.mid,"Spam") 575                       cl.sendText(g.mid,"Spam")576                       cl.sendText(g.mid,"Spam")577                       cl.sendText(g.mid,"Spam")578                       cl.sendText(g.mid,"Spam")579                       cl.sendText(g.mid,"Spam")580                       cl.sendText(g.mid,"Spam")581                       cl.sendText(g.mid,"Spam")582                       cl.sendText(g.mid,"Spam")583                       cl.sendText(g.mid,"Spam")584                       cl.sendText(g.mid,"Spam")585                       cl.sendText(g.mid,"Spam")586                       cl.sendText(g.mid,"Spam")587                       cl.sendText(g.mid,"Spam")588                       cl.sendText(g.mid,"Spam")589                       cl.sendText(g.mid,"Spam")590                       cl.sendText(g.mid,"Spam")591                       cl.sendText(g.mid,"Spam")592                       cl.sendText(g.mid,"Spam")593                       cl.sendText(g.mid,"Spam")594                       cl.sendText(g.mid,"Spam")595                       cl.sendText(g.mid,"Spam")596                       cl.sendText(g.mid,"Spam")597                       cl.sendText(g.mid,"Spam")598                       cl.sendText(g.mid,"Spam")599                       cl.sendText(g.mid,"Spam")600                       cl.sendText(g.mid,"Spam")601                       cl.sendText(g.mid,"Spam")602                       cl.sendText(g.mid,"Spam")603                       cl.sendText(g.mid,"Spam")604                       cl.sendText(g.mid,"Spam")605                       cl.sendText(g.mid,"Spam") 606                       cl.sendText(g.mid,"Spam")607                       cl.sendText(g.mid,"Spam")608                       cl.sendText(g.mid,"Spam")609                       cl.sendText(g.mid,"Spam")610                       cl.sendText(g.mid,"Spam")611                       cl.sendText(g.mid,"Spam")612                       cl.sendText(g.mid,"Spam")613                       cl.sendText(g.mid,"Spam")614                       cl.sendText(g.mid,"Spam")615                       cl.sendText(g.mid,"Spam")616                       cl.sendText(g.mid,"Spam")617                       cl.sendText(g.mid,"Spam")618                       cl.sendText(g.mid,"Spam")619                       cl.sendText(g.mid,"Spam")620                       cl.sendText(g.mid,"Spam")621                       cl.sendText(g.mid,"Spam")622                       cl.sendText(g.mid,"Spam")623                       cl.sendText(g.mid,"Spam")624                       cl.sendText(g.mid,"Spam")625                       cl.sendText(g.mid,"Spam")626                       cl.sendText(g.mid,"Spam")627                       cl.sendText(g.mid,"Spam")628                       cl.sendText(g.mid,"Spam")629                       cl.sendText(g.mid,"Spam")630                       cl.sendText(g.mid,"Spam")631                       cl.sendText(g.mid,"Spam")632                       cl.sendText(g.mid,"Spam")633                       cl.sendText(g.mid,"Spam")634                       cl.sendText(g.mid,"Spam")635                       cl.sendText(g.mid,"Spam")636                       cl.sendText(g.mid,"Spam") 637                       cl.sendText(g.mid,"Spam")638                       cl.sendText(g.mid,"Spam")639                       cl.sendText(g.mid,"Spam")640                       cl.sendText(g.mid,"Spam")641                       cl.sendText(g.mid,"Spam")642                       cl.sendText(g.mid,"Spam")643                       cl.sendText(g.mid,"Spam")644                       cl.sendText(g.mid,"Spam")645                       cl.sendText(g.mid,"Spam")646                       cl.sendText(g.mid,"Spam")647                       cl.sendText(g.mid,"Spam")648                       cl.sendText(g.mid,"Spam")649                       cl.sendText(g.mid,"Spam")650                       cl.sendText(g.mid,"Spam")651                       cl.sendText(g.mid,"Spam")652                       cl.sendText(g.mid,"Spam")653                       cl.sendText(g.mid,"Spam")654                       cl.sendText(g.mid,"Spam")655                       cl.sendText(g.mid,"Spam")656                       cl.sendText(g.mid,"Spam")657                       cl.sendText(g.mid,"Spam")658                       cl.sendText(g.mid,"Spam")659                       cl.sendText(g.mid,"Spam")660                       cl.sendText(g.mid,"Spam")661                       cl.sendText(g.mid,"Spam")662                       cl.sendText(g.mid,"Spam")663                       cl.sendText(g.mid,"Spam")664                       cl.sendText(g.mid,"Spam")665                       cl.sendText(g.mid,"Spam")666                       cl.sendText(g.mid,"Spam")667                       cl.sendText(g.mid,"Spam") 668                       cl.sendText(g.mid,"Spam")669                       cl.sendText(g.mid,"Spam")670                       cl.sendText(g.mid,"Spam")671                       cl.sendText(g.mid,"Spam")672                       cl.sendText(g.mid,"Spam")673                       cl.sendText(g.mid,"Spam")674                       cl.sendText(g.mid,"Spam")675                       cl.sendText(g.mid,"Spam")676                       cl.sendText(g.mid,"Spam")677                       cl.sendText(g.mid,"Spam")678                       cl.sendText(g.mid,"Spam")679                       cl.sendText(g.mid,"Spam")680                       cl.sendText(g.mid,"Spam")681                       cl.sendText(g.mid,"Spam")682                       cl.sendText(g.mid,"Spam")683                       cl.sendText(g.mid,"Spam")684                       cl.sendText(g.mid,"Spam")685                       cl.sendText(g.mid,"Spam")686                       cl.sendText(g.mid,"Spam")687                       cl.sendText(g.mid,"Spam")688                       cl.sendText(g.mid,"Spam")689                       cl.sendText(g.mid,"Spam")690                       cl.sendText(g.mid,"Spam")691                       cl.sendText(g.mid,"Spam")692                       cl.sendText(g.mid,"Spam")693                       cl.sendText(g.mid,"Spam")694                       cl.sendText(g.mid,"Spam")695                       cl.sendText(g.mid,"Spam")696                       cl.sendText(g.mid,"Spam")697                       cl.sendText(g.mid,"Spam")698                       cl.sendText(g.mid,"Spam") 699                       cl.sendText(g.mid,"Spam")700                       cl.sendText(g.mid,"Spam")701                       cl.sendText(g.mid,"Spam")702                       cl.sendText(g.mid,"Spam")703                       cl.sendText(g.mid,"Spam")704                       cl.sendText(g.mid,"Spam")705                       cl.sendText(g.mid,"Spam")706                       cl.sendText(g.mid,"Spam")707                       cl.sendText(g.mid,"Spam")708                       cl.sendText(g.mid,"Spam")709                       cl.sendText(g.mid,"Spam")710                       cl.sendText(g.mid,"Spam")711                       cl.sendText(g.mid,"Spam")712                       cl.sendText(g.mid,"Spam")713                       cl.sendText(g.mid,"Spam")714                       cl.sendText(g.mid,"Spam")715                       cl.sendText(g.mid,"Spam")716                       cl.sendText(g.mid,"Spam")717                       cl.sendText(g.mid,"Spam")718                       cl.sendText(g.mid,"Spam")719                       cl.sendText(g.mid,"Spam")720                       cl.sendText(g.mid,"Spam")721                       cl.sendText(g.mid,"Spam")722                       cl.sendText(g.mid,"Spam")723                       cl.sendText(g.mid,"Spam")724                       cl.sendText(g.mid,"Spam")725                       cl.sendText(g.mid,"Spam")726                       cl.sendText(g.mid,"Spam")727                       cl.sendText(g.mid,"Spam")728                       cl.sendText(g.mid,"Spam")729                       cl.sendText(g.mid,"Spam") 730                       cl.sendText(g.mid,"Spam")731                       cl.sendText(g.mid,"Spam")732                       cl.sendText(g.mid,"Spam")733                       cl.sendText(g.mid,"Spam")734                       cl.sendText(g.mid,"Spam")735                       cl.sendText(g.mid,"Spam")736                       cl.sendText(g.mid,"Spam")737                       cl.sendText(g.mid,"Spam")738                       cl.sendText(g.mid,"Spam")739                       cl.sendText(g.mid,"Spam")740                       cl.sendText(g.mid,"Spam")741                       cl.sendText(g.mid,"Spam")742                       cl.sendText(g.mid,"Spam")743                       cl.sendText(g.mid,"Spam")744                       cl.sendText(g.mid,"Spam")745                       cl.sendText(g.mid,"Spam")746                       cl.sendText(g.mid,"Spam")747                       cl.sendText(g.mid,"Spam")748                       cl.sendText(g.mid,"Spam")749                       cl.sendText(g.mid,"Spam")750                       cl.sendText(g.mid,"Spam")751                       cl.sendText(g.mid,"Spam")752                       cl.sendText(g.mid,"Spam")753                       cl.sendText(g.mid,"Spam")754                       cl.sendText(g.mid,"Spam")755                       cl.sendText(g.mid,"Spam")756                       cl.sendText(g.mid,"Spam")757                       cl.sendText(g.mid,"Spam")758                       cl.sendText(g.mid,"Spam")759                       cl.sendText(g.mid,"Spam")760                       cl.sendText(g.mid,"Spam") 761                       cl.sendText(g.mid,"Spam")762                       cl.sendText(g.mid,"Spam")763                       cl.sendText(g.mid,"Spam")764                       cl.sendText(g.mid,"Spam")765                       cl.sendText(g.mid,"Spam")766                       cl.sendText(g.mid,"Spam")767                       cl.sendText(g.mid,"Spam")768                       cl.sendText(g.mid,"Spam")769                       cl.sendText(g.mid,"Spam")770                       cl.sendText(g.mid,"Spam")771                       cl.sendText(g.mid,"Spam")772                       cl.sendText(g.mid,"Spam")773                       cl.sendText(g.mid,"Spam")774                       cl.sendText(g.mid,"Spam")775                       cl.sendText(g.mid,"Spam")776                       cl.sendText(g.mid,"Spam")777                       cl.sendText(g.mid,"Spam")778                       cl.sendText(g.mid,"Spam")779                       cl.sendText(g.mid,"Spam")780                       cl.sendText(g.mid,"Spam")781                       cl.sendText(g.mid,"Spam")782                       cl.sendText(g.mid,"Spam")783                       cl.sendText(g.mid,"Spam")784                       cl.sendText(g.mid,"Spam")785                       cl.sendText(g.mid,"Spam")786                       cl.sendText(g.mid,"Spam")787                       cl.sendText(g.mid,"Spam")788                       cl.sendText(g.mid,"Spam")789                       cl.sendText(g.mid,"Spam")790                       cl.sendText(g.mid,"Spam")791                       cl.sendText(g.mid,"Spam") 792                       cl.sendText(g.mid,"Spam")793                       cl.sendText(g.mid,"Spam")794                       cl.sendText(g.mid,"Spam")795                       cl.sendText(g.mid,"Spam")796                       cl.sendText(g.mid,"Spam")797                       cl.sendText(g.mid,"Spam")798                       cl.sendText(g.mid,"Spam")799                       cl.sendText(g.mid,"Spam")800                       cl.sendText(g.mid,"Spam")801                       cl.sendText(g.mid,"Spam")802                       cl.sendText(g.mid,"Spam")803                       cl.sendText(g.mid,"Spam")804                       cl.sendText(g.mid,"Spam")805                       cl.sendText(g.mid,"Spam")806                       cl.sendText(g.mid,"Spam")807                       cl.sendText(g.mid,"Spam")808                       cl.sendText(g.mid,"Spam")809                       cl.sendText(g.mid,"Spam")810                       cl.sendText(g.mid,"Spam")811                       cl.sendText(g.mid,"Spam")812                       cl.sendText(g.mid,"Spam")813                       cl.sendText(g.mid,"Spam")814                       cl.sendText(g.mid,"Spam")815                       cl.sendText(g.mid,"Spam")816                       cl.sendText(g.mid,"Spam")817                       cl.sendText(g.mid,"Spam")818                       cl.sendText(g.mid,"Spam")819                       cl.sendText(g.mid,"Spam")820                       cl.sendText(g.mid,"Spam")821                       cl.sendText(g.mid,"Spam")822                       cl.sendText(g.mid,"Spam") 823                       cl.sendText(g.mid,"Spam")824                       cl.sendText(g.mid,"Spam")825                       cl.sendText(g.mid,"Spam")826                       cl.sendText(g.mid,"Spam")827                       cl.sendText(g.mid,"Spam")828                       cl.sendText(g.mid,"Spam")829                       cl.sendText(g.mid,"Spam")830                       cl.sendText(g.mid,"Spam")831                       cl.sendText(g.mid,"Spam")832                       cl.sendText(g.mid,"Spam")833                       cl.sendText(g.mid,"Spam")834                       cl.sendText(g.mid,"Spam")835                       cl.sendText(g.mid,"Spam")836                       cl.sendText(g.mid,"Spam")837                       cl.sendText(g.mid,"Spam")838                       cl.sendText(g.mid,"Spam")839                       cl.sendText(g.mid,"Spam")840                       cl.sendText(g.mid,"Spam")841                       cl.sendText(g.mid,"Spam")842                       cl.sendText(g.mid,"Spam")843                       cl.sendText(g.mid,"Spam")844                       cl.sendText(g.mid,"Spam")845                       cl.sendText(g.mid,"Spam")846                       cl.sendText(g.mid,"Spam")847                       cl.sendText(g.mid,"Spam")848                       cl.sendText(g.mid,"Spam")849                       cl.sendText(g.mid,"Spam")850                       cl.sendText(g.mid,"Spam")851                       cl.sendText(g.mid,"Spam")852                       cl.sendText(g.mid,"Spam")853                       cl.sendText(g.mid,"Spam") 854                       cl.sendText(g.mid,"Spam")855                       cl.sendText(g.mid,"Spam")856                       cl.sendText(g.mid,"Spam")857                       cl.sendText(g.mid,"Spam")858                       cl.sendText(g.mid,"Spam")859                       cl.sendText(g.mid,"Spam")860                       cl.sendText(g.mid,"Spam")861                       cl.sendText(g.mid,"Spam")862                       cl.sendText(g.mid,"Spam")863                       cl.sendText(g.mid,"Spam")864                       cl.sendText(g.mid,"Spam")865                       cl.sendText(g.mid,"Spam")866                       cl.sendText(g.mid,"Spam")867                       cl.sendText(g.mid,"Spam")868                       cl.sendText(g.mid,"Spam")869                       cl.sendText(g.mid,"Spam")870                       cl.sendText(g.mid,"Spam")871                       cl.sendText(g.mid,"Spam")872                       cl.sendText(g.mid,"Spam")873                       cl.sendText(g.mid,"Spam")874                       cl.sendText(g.mid,"Spam")875                       cl.sendText(g.mid,"Spam")876                       cl.sendText(g.mid,"Spam")877                       cl.sendText(g.mid,"Spam")878                       cl.sendText(g.mid,"Spam")879                       cl.sendText(g.mid,"Spam")880                       cl.sendText(g.mid,"Spam")881                       cl.sendText(g.mid,"Spam")882                       cl.sendText(g.mid,"Spam")883                       cl.sendText(g.mid,"Spam")884                       cl.sendText(g.mid,"Spam") 885                       cl.sendText(g.mid,"Spam")886                       cl.sendText(g.mid,"Spam")887                       cl.sendText(g.mid,"Spam")888                       cl.sendText(g.mid,"Spam")889                       cl.sendText(g.mid,"Spam")890                       cl.sendText(g.mid,"Spam")891                       cl.sendText(g.mid,"Spam")892                       cl.sendText(g.mid,"Spam")893                       cl.sendText(g.mid,"Spam")894                       cl.sendText(g.mid,"Spam")895                       cl.sendText(g.mid,"Spam")896                       cl.sendText(g.mid,"Spam")897                       cl.sendText(g.mid,"Spam")898                       cl.sendText(g.mid,"Spam")899                       cl.sendText(g.mid,"Spam")900                       cl.sendText(g.mid,"Spam")901                       cl.sendText(g.mid,"Spam")902                       cl.sendText(g.mid,"Spam")903                       cl.sendText(g.mid,"Spam")904                       cl.sendText(g.mid,"Spam")905                       cl.sendText(g.mid,"Spam")906                       cl.sendText(g.mid,"Spam")907                       cl.sendText(g.mid,"Spam")908                       cl.sendText(g.mid,"Spam")909                       cl.sendText(g.mid,"Spam")910                       cl.sendText(g.mid,"Spam")911                       cl.sendText(g.mid,"Spam")912                       cl.sendText(g.mid,"Spam")913                       cl.sendText(g.mid,"Spam")914                       cl.sendText(g.mid,"Spam")915                       cl.sendText(g.mid,"Spam") 916                       cl.sendText(g.mid,"Spam")917                       cl.sendText(g.mid,"Spam")918                       cl.sendText(g.mid,"Spam")919                       cl.sendText(g.mid,"Spam")920                       cl.sendText(g.mid,"Spam")921                       cl.sendText(g.mid,"Spam")922                       cl.sendText(g.mid,"Spam")923                       cl.sendText(g.mid,"Spam")924                       cl.sendText(g.mid,"Spam")925                       cl.sendText(g.mid,"Spam")926                       cl.sendText(g.mid,"Spam")927                       cl.sendText(g.mid,"Spam")928                       cl.sendText(g.mid,"Spam")929                       cl.sendText(g.mid,"Spam")930                       cl.sendText(g.mid,"Spam")931                       cl.sendText(g.mid,"Spam")932                       cl.sendText(g.mid,"Spam")933                       cl.sendText(g.mid,"Spam")934                       cl.sendText(g.mid,"Spam")935                       cl.sendText(g.mid,"Spam")936                       cl.sendText(g.mid,"Spam")937                       cl.sendText(g.mid,"Spam")938                       cl.sendText(g.mid,"Spam")939                       cl.sendText(g.mid,"Spam")940                       cl.sendText(g.mid,"Spam")941                       cl.sendText(g.mid,"Spam")942                       cl.sendText(g.mid,"Spam")943                       cl.sendText(g.mid,"Spam")944                       cl.sendText(g.mid,"Spam")945                       cl.sendText(g.mid,"Spam")946                       cl.sendText(g.mid,"Spam") 947                       cl.sendText(g.mid,"Spam")948                       cl.sendText(g.mid,"Spam")949                       cl.sendText(g.mid,"Spam")950                       cl.sendText(g.mid,"Spam")951                       cl.sendText(g.mid,"Spam")952                       cl.sendText(g.mid,"Spam")953                       cl.sendText(g.mid,"Spam")954                       cl.sendText(g.mid,"Spam")955                       cl.sendText(g.mid,"Spam")956                       cl.sendText(g.mid,"Spam")957                       cl.sendText(g.mid,"Spam")958                       cl.sendText(g.mid,"Spam")959                       cl.sendText(g.mid,"Spam")960                       cl.sendText(g.mid,"Spam")961                       cl.sendText(g.mid,"Spam")962                       cl.sendText(g.mid,"Spam")963                       cl.sendText(g.mid,"Spam")964                       cl.sendText(g.mid,"Spam")965                       cl.sendText(g.mid,"Spam")966                       cl.sendText(g.mid,"Spam")967                       cl.sendText(g.mid,"Spam")968                       cl.sendText(g.mid,"Spam")969                       cl.sendText(g.mid,"Spam")970                       cl.sendText(g.mid,"Spam")971                       cl.sendText(g.mid,"Spam")972                       cl.sendText(g.mid,"Spam")973                       cl.sendText(g.mid,"Spam")974                       cl.sendText(g.mid,"Spam")975                       cl.sendText(g.mid,"Spam")976                       cl.sendText(g.mid,"Spam")977                       cl.sendText(g.mid,"Spam") 978                       cl.sendText(g.mid,"Spam")979                       cl.sendText(g.mid,"Spam")980                       cl.sendText(g.mid,"Spam")981                       cl.sendText(g.mid,"Spam")982                       cl.sendText(g.mid,"Spam")983                       cl.sendText(g.mid,"Spam")984                       cl.sendText(g.mid,"Spam")985                       cl.sendText(g.mid,"Spam")986                       cl.sendText(g.mid,"Spam")987                       cl.sendText(g.mid,"Spam")988                       cl.sendText(g.mid,"Spam")989                       cl.sendText(g.mid,"Spam")990                       cl.sendText(g.mid,"Spam")991                       cl.sendText(g.mid,"Spam")992                       cl.sendText(g.mid,"Spam")993                       cl.sendText(g.mid,"Spam")994                       cl.sendText(g.mid,"Spam")995                       cl.sendText(g.mid,"Spam")996                       cl.sendText(g.mid,"Spam")997                       cl.sendText(g.mid,"Spam")998                       cl.sendText(g.mid,"Spam")999                       cl.sendText(g.mid,"Spam")1000                       cl.sendText(g.mid,"Spam")1001                       cl.sendText(g.mid,"Spam")1002                       cl.sendText(g.mid,"Spam")1003                       cl.sendText(g.mid,"Spam")1004                       cl.sendText(g.mid,"Spam")1005                       cl.sendText(g.mid,"Spam")1006                       cl.sendText(g.mid,"Spam")1007                       cl.sendText(g.mid,"Spam")1008                       cl.sendText(g.mid,"Spam") 1009                       cl.sendText(g.mid,"Spam")1010                       cl.sendText(g.mid,"Spam")1011                       cl.sendText(g.mid,"Spam")1012                       cl.sendText(g.mid,"Spam")1013                       cl.sendText(g.mid,"Spam")1014                       cl.sendText(g.mid,"Spam")1015                       cl.sendText(g.mid,"Spam")1016                       cl.sendText(g.mid,"Spam")1017                       cl.sendText(g.mid,"Spam")1018                       cl.sendText(g.mid,"Spam")1019                       cl.sendText(g.mid,"Spam")1020                       cl.sendText(g.mid,"Spam")1021                       cl.sendText(g.mid,"Spam")1022                       cl.sendText(g.mid,"Spam")1023                       cl.sendText(g.mid,"Spam")1024                       cl.sendText(g.mid,"Spam")1025                       cl.sendText(g.mid,"Spam")1026                       cl.sendText(g.mid,"Spam")1027                       cl.sendText(g.mid,"Spam")1028                       cl.sendText(g.mid,"Spam")1029                       cl.sendText(g.mid,"Spam")1030                       cl.sendText(g.mid,"Spam")1031                       cl.sendText(g.mid,"Spam")1032                       cl.sendText(g.mid,"Spam")1033                       cl.sendText(g.mid,"Spam")1034                       cl.sendText(g.mid,"Spam")1035                       cl.sendText(g.mid,"Spam")1036                       cl.sendText(g.mid,"Spam")1037                       cl.sendText(g.mid,"Spam")1038                       cl.sendText(g.mid,"Spam")1039                       cl.sendText(g.mid,"Spam") 1040                       cl.sendText(g.mid,"Spam")1041                       cl.sendText(g.mid,"Spam")1042                       cl.sendText(g.mid,"Spam")1043                       cl.sendText(g.mid,"Spam")1044                       cl.sendText(g.mid,"Spam")1045                       cl.sendText(g.mid,"Spam")1046                       cl.sendText(g.mid,"Spam")1047                       cl.sendText(g.mid,"Spam")1048                       cl.sendText(g.mid,"Spam")1049                       cl.sendText(g.mid,"Spam")1050                       cl.sendText(g.mid,"Spam")1051                       cl.sendText(g.mid,"Spam")1052                       cl.sendText(g.mid,"Spam")1053                       cl.sendText(g.mid,"Spam")1054                       cl.sendText(g.mid,"Spam")1055                       cl.sendText(g.mid,"Spam")1056                       cl.sendText(g.mid,"Spam")1057                       cl.sendText(g.mid,"Spam")1058                       cl.sendText(g.mid,"Spam")1059                       cl.sendText(g.mid,"Spam")1060                       cl.sendText(g.mid,"Spam")1061                       cl.sendText(g.mid,"Spam")1062                       cl.sendText(g.mid,"Spam")1063                       cl.sendText(g.mid,"Spam")1064                       cl.sendText(g.mid,"Spam")1065                       cl.sendText(g.mid,"Spam")1066                       cl.sendText(g.mid,"Spam")1067                       cl.sendText(g.mid,"Spam")1068                       cl.sendText(g.mid,"Spam")1069                       cl.sendText(g.mid,"Spam")1070                       cl.sendText(g.mid,"Spam") 1071                       cl.sendText(g.mid,"Spam")1072                       cl.sendText(g.mid,"Spam")1073                       cl.sendText(g.mid,"Spam")1074                       cl.sendText(g.mid,"Spam")1075                       cl.sendText(g.mid,"Spam")1076                       cl.sendText(g.mid,"Spam")1077                       cl.sendText(g.mid,"Spam")1078                       cl.sendText(g.mid,"Spam")1079                       cl.sendText(g.mid,"Spam")1080                       cl.sendText(g.mid,"Spam")1081                       cl.sendText(g.mid,"Spam")1082                       cl.sendText(g.mid,"Spam")1083                       cl.sendText(g.mid,"Spam")1084                       cl.sendText(g.mid,"Spam")1085                       cl.sendText(g.mid,"Spam")1086                       cl.sendText(g.mid,"Spam")1087                       cl.sendText(g.mid,"Spam")1088                       cl.sendText(g.mid,"Spam")1089                       cl.sendText(g.mid,"Spam")1090                       cl.sendText(g.mid,"Spam")1091                       cl.sendText(g.mid,"Spam")1092                       cl.sendText(g.mid,"Spam")1093                       cl.sendText(g.mid,"Spam")1094                       cl.sendText(g.mid,"Spam")1095                       cl.sendText(g.mid,"Spam")1096                       cl.sendText(g.mid,"Spam")1097                       cl.sendText(g.mid,"Spam")1098                       cl.sendText(g.mid,"Spam")1099                       cl.sendText(g.mid,"Spam")1100                       cl.sendText(g.mid,"Spam")1101                       cl.sendText(g.mid,"Spam") 1102                       cl.sendText(g.mid,"Spam")1103                       cl.sendText(g.mid,"Spam")1104                       cl.sendText(g.mid,"Spam")1105                       cl.sendText(g.mid,"Spam")1106                       cl.sendText(g.mid,"Spam")1107                       cl.sendText(g.mid,"Spam")1108                       cl.sendText(g.mid,"Spam")1109                       cl.sendText(g.mid,"Spam")1110                       cl.sendText(g.mid,"Spam")1111                       cl.sendText(g.mid,"Spam")1112                       cl.sendText(g.mid,"Spam")1113                       cl.sendText(g.mid,"Spam")1114                       cl.sendText(g.mid,"Spam")1115                       cl.sendText(g.mid,"Spam")1116                       cl.sendText(g.mid,"Spam")1117                       cl.sendText(g.mid,"Spam")1118                       cl.sendText(g.mid,"Spam")1119                       cl.sendText(g.mid,"Spam")1120                       cl.sendText(g.mid,"Spam")1121                       cl.sendText(g.mid,"Spam")1122                       cl.sendText(g.mid,"Spam")1123                       cl.sendText(g.mid,"Spam")1124                       cl.sendText(g.mid,"Spam")1125                       cl.sendText(g.mid,"Spam")1126                       cl.sendText(g.mid,"Spam")1127                       cl.sendText(g.mid,"Spam")1128                       cl.sendText(g.mid,"Spam")1129                       cl.sendText(g.mid,"Spam")1130                       cl.sendText(g.mid,"Spam")1131                       cl.sendText(g.mid,"Spam")1132                       cl.sendText(g.mid,"Spam") 1133                       cl.sendText(g.mid,"Spam")1134                       cl.sendText(g.mid,"Spam")1135                       cl.sendText(g.mid,"Spam")1136                       cl.sendText(g.mid,"Spam")1137                       cl.sendText(g.mid,"Spam")1138                       cl.sendText(g.mid,"Spam")1139                       cl.sendText(g.mid,"Spam")1140                       cl.sendText(g.mid,"Spam")1141                       cl.sendText(g.mid,"Spam")1142                       cl.sendText(g.mid,"Spam")1143                       cl.sendText(g.mid,"Spam")1144                       cl.sendText(g.mid,"Spam")1145                       cl.sendText(g.mid,"Spam")1146                       cl.sendText(g.mid,"Spam")1147                       cl.sendText(g.mid,"Spam")1148                       cl.sendText(g.mid,"Spam")1149                       cl.sendText(g.mid,"Spam")1150                       cl.sendText(g.mid,"Spam")1151                       cl.sendText(g.mid,"Spam")1152                       cl.sendText(g.mid,"Spam")1153                       cl.sendText(g.mid,"Spam")1154                       cl.sendText(g.mid,"Spam")1155                       cl.sendText(g.mid,"Spam")1156                       cl.sendText(g.mid,"Spam")1157                       cl.sendText(g.mid,"Spam")1158                       cl.sendText(g.mid,"Spam")1159                       cl.sendText(g.mid,"Spam")1160                       cl.sendText(g.mid,"Spam")1161                       cl.sendText(g.mid,"Spam")1162                       cl.sendText(g.mid,"Spam")1163                       cl.sendText(g.mid,"Spam") 1164                       cl.sendText(g.mid,"Spam")1165                       cl.sendText(g.mid,"Spam")1166                       cl.sendText(g.mid,"Spam")1167                       cl.sendText(g.mid,"Spam")1168                       cl.sendText(g.mid,"Spam")1169                       cl.sendText(g.mid,"Spam")1170                       cl.sendText(g.mid,"Spam")1171                       cl.sendText(g.mid,"Spam")1172                       cl.sendText(g.mid,"Spam")1173                       cl.sendText(g.mid,"Spam")1174                       cl.sendText(g.mid,"Spam")1175                       cl.sendText(g.mid,"Spam")1176                       cl.sendText(g.mid,"Spam")1177                       cl.sendText(g.mid,"Spam")1178                       cl.sendText(g.mid,"Spam")1179                       cl.sendText(g.mid,"Spam")1180                       cl.sendText(g.mid,"Spam")1181                       cl.sendText(g.mid,"Spam")1182                       cl.sendText(g.mid,"Spam")1183                       cl.sendText(g.mid,"Spam")1184                       cl.sendText(g.mid,"Spam")1185                       cl.sendText(g.mid,"Spam")1186                       cl.sendText(g.mid,"Spam")1187                       cl.sendText(g.mid,"Spam")1188                       cl.sendText(g.mid,"Spam")1189                       cl.sendText(g.mid,"Spam")1190                       cl.sendText(g.mid,"Spam")1191                       cl.sendText(g.mid,"Spam")1192                       cl.sendText(g.mid,"Spam")1193                       cl.sendText(g.mid,"Spam")1194                       cl.sendText(g.mid,"Spam") 1195                       cl.sendText(g.mid,"Spam")1196                       cl.sendText(g.mid,"Spam")1197                       cl.sendText(g.mid,"Spam")1198                       cl.sendText(g.mid,"Spam")1199                       cl.sendText(g.mid,"Spam")1200                       cl.sendText(g.mid,"Spam")1201                       cl.sendText(g.mid,"Spam")1202                       cl.sendText(g.mid,"Spam")1203                       cl.sendText(g.mid,"Spam")1204                       cl.sendText(g.mid,"Spam")1205                       cl.sendText(g.mid,"Spam")1206                       cl.sendText(g.mid,"Spam")1207                       cl.sendText(g.mid,"Spam")1208                       cl.sendText(g.mid,"Spam")1209                       cl.sendText(g.mid,"Spam")1210                       cl.sendText(g.mid,"Spam")1211                       cl.sendText(g.mid,"Spam")1212                       cl.sendText(g.mid,"Spam")1213                       cl.sendText(g.mid,"Spam")1214                       cl.sendText(g.mid,"Spam")1215                       cl.sendText(g.mid,"Spam")1216                       cl.sendText(g.mid,"Spam")1217                       cl.sendText(g.mid,"Spam")1218                       cl.sendText(g.mid,"Spam")1219                       cl.sendText(g.mid,"Spam")1220                       cl.sendText(g.mid,"Spam")1221                       cl.sendText(g.mid,"Spam")1222                       cl.sendText(g.mid,"Spam")1223                       cl.sendText(g.mid,"Spam")1224                       cl.sendText(g.mid,"Spam")1225                       cl.sendText(g.mid,"Spam") 1226                       cl.sendText(g.mid,"Spam")1227                       cl.sendText(g.mid,"Spam")1228                       cl.sendText(g.mid,"Spam")1229                       cl.sendText(g.mid,"Spam")1230                       cl.sendText(g.mid,"Spam")1231                       cl.sendText(g.mid,"Spam")1232                       cl.sendText(g.mid,"Spam")1233                       cl.sendText(g.mid,"Spam")1234                       cl.sendText(g.mid,"Spam")1235                       cl.sendText(g.mid,"Spam")1236                       cl.sendText(g.mid,"Spam")1237                       cl.sendText(g.mid,"Spam")1238                       cl.sendText(g.mid,"Spam")1239                       cl.sendText(g.mid,"Spam")1240                       cl.sendText(g.mid,"Spam")1241                       cl.sendText(g.mid,"Spam")1242                       cl.sendText(g.mid,"Spam")1243                       cl.sendText(g.mid,"Spam")1244                       cl.sendText(g.mid,"Spam")1245                       cl.sendText(g.mid,"Spam")1246                       cl.sendText(g.mid,"Spam")1247                       cl.sendText(g.mid,"Spam")1248                       cl.sendText(g.mid,"Spam")1249                       cl.sendText(g.mid,"Spam")1250                       cl.sendText(g.mid,"Spam")1251                       cl.sendText(g.mid,"Spam")1252                       cl.sendText(g.mid,"Spam")1253                       cl.sendText(g.mid,"Spam")1254                       cl.sendText(g.mid,"Spam")1255                       cl.sendText(g.mid,"Spam")1256                       cl.sendText(g.mid,"Spam") 1257                       cl.sendText(g.mid,"Spam")1258                       cl.sendText(g.mid,"Spam")1259                       cl.sendText(g.mid,"Spam")1260                       cl.sendText(g.mid,"Spam")1261                       cl.sendText(g.mid,"Spam")1262                       cl.sendText(g.mid,"Spam")1263                       cl.sendText(g.mid,"Spam")1264                       cl.sendText(g.mid,"Spam")1265                       cl.sendText(g.mid,"Spam")1266                       cl.sendText(g.mid,"Spam")1267                       cl.sendText(g.mid,"Spam")1268                       cl.sendText(g.mid,"Spam")1269                       cl.sendText(g.mid,"Spam")1270                       cl.sendText(g.mid,"Spam")1271                       cl.sendText(g.mid,"Spam")1272                       cl.sendText(g.mid,"Spam")1273                       cl.sendText(g.mid,"Spam")1274                       cl.sendText(g.mid,"Spam")1275                       cl.sendText(g.mid,"Spam")1276                       cl.sendText(g.mid,"Spam")1277                       cl.sendText(g.mid,"Spam")1278                       cl.sendText(g.mid,"Spam")1279                       cl.sendText(g.mid,"Spam")1280                       cl.sendText(g.mid,"Spam")1281                       cl.sendText(g.mid,"Spam")1282                       cl.sendText(g.mid,"Spam")1283                       cl.sendText(g.mid,"Spam")1284                       cl.sendText(g.mid,"Spam")1285                       cl.sendText(g.mid,"Spam")1286                       cl.sendText(g.mid,"Spam")1287                       cl.sendText(g.mid,"Spam") 1288                       cl.sendText(g.mid,"Spam")1289                       cl.sendText(g.mid,"Spam")1290                       cl.sendText(g.mid,"Spam")1291                       cl.sendText(g.mid,"Spam")1292                       cl.sendText(g.mid,"Spam")1293                       cl.sendText(g.mid,"Spam")1294                       cl.sendText(g.mid,"Spam")1295                       cl.sendText(g.mid,"Spam")1296                       cl.sendText(g.mid,"Spam")1297                       cl.sendText(g.mid,"Spam")1298                       cl.sendText(g.mid,"Spam")1299                       cl.sendText(g.mid,"Spam")1300                       cl.sendText(g.mid,"Spam")1301                       cl.sendText(g.mid,"Spam")1302                       cl.sendText(g.mid,"Spam")1303                       cl.sendText(g.mid,"Spam")1304                       cl.sendText(g.mid,"Spam")1305                       cl.sendText(g.mid,"Spam")1306                       cl.sendText(g.mid,"Spam")1307                       cl.sendText(g.mid,"Spam")1308                       cl.sendText(g.mid,"Spam")1309                       cl.sendText(g.mid,"Spam")1310                       cl.sendText(g.mid,"Spam")1311                       cl.sendText(g.mid,"Spam")1312                       cl.sendText(g.mid,"Spam")1313                       cl.sendText(g.mid,"Spam")1314                       cl.sendText(g.mid,"Spam")1315                       cl.sendText(g.mid,"Spam")1316                       cl.sendText(g.mid,"Spam")1317                       cl.sendText(g.mid,"Spam")1318                       cl.sendText(g.mid,"Spam") 1319                       cl.sendText(g.mid,"Spam")1320                       cl.sendText(g.mid,"Spam")1321                       cl.sendText(g.mid,"Spam")1322                       cl.sendText(g.mid,"Spam")1323                       cl.sendText(g.mid,"Spam")1324                       cl.sendText(g.mid,"Spam")1325                       cl.sendText(g.mid,"Spam")1326                       cl.sendText(g.mid,"Spam")1327                       cl.sendText(g.mid,"Spam")1328                       cl.sendText(g.mid,"Spam")1329                       cl.sendText(g.mid,"Spam")1330                       cl.sendText(g.mid,"Spam")1331                       cl.sendText(g.mid,"Spam")1332                       cl.sendText(g.mid,"Spam")1333                       cl.sendText(g.mid,"Spam")1334                       cl.sendText(g.mid,"Spam")1335                       cl.sendText(g.mid,"Spam")1336                       cl.sendText(g.mid,"Spam")1337                       cl.sendText(g.mid,"Spam")1338                       cl.sendText(g.mid,"Spam")1339                       cl.sendText(g.mid,"Spam")1340                       cl.sendText(g.mid,"Spam")1341                       cl.sendText(g.mid,"Spam")1342                       cl.sendText(g.mid,"Spam")1343                       cl.sendText(g.mid,"Spam")1344                       cl.sendText(g.mid,"Spam")1345                       cl.sendText(g.mid,"Spam")1346                       cl.sendText(g.mid,"Spam")1347                       cl.sendText(g.mid,"Spam")1348                       cl.sendText(g.mid,"Spam")1349                       cl.sendText(g.mid,"Spam") 1350                       cl.sendText(g.mid,"Spam")1351                       cl.sendText(g.mid,"Spam")1352                       cl.sendText(g.mid,"Spam")1353                       cl.sendText(g.mid,"Spam")1354                       cl.sendText(g.mid,"Spam")1355                       cl.sendText(g.mid,"Spam")1356                       cl.sendText(g.mid,"Spam")1357                       cl.sendText(g.mid,"Spam")1358                       cl.sendText(g.mid,"Spam")1359                       cl.sendText(g.mid,"Spam")1360                       cl.sendText(g.mid,"Spam")1361                       cl.sendText(g.mid,"Spam")1362                       cl.sendText(g.mid,"Spam")1363                       cl.sendText(g.mid,"Spam")1364                       cl.sendText(g.mid,"Spam")1365                       cl.sendText(g.mid,"Spam")1366                       cl.sendText(g.mid,"Spam")1367                       cl.sendText(g.mid,"Spam")1368                       cl.sendText(g.mid,"Spam")1369                       cl.sendText(g.mid,"Spam")1370                       cl.sendText(g.mid,"Spam")1371                       cl.sendText(g.mid,"Spam")1372                       cl.sendText(g.mid,"Spam")1373                       cl.sendText(g.mid,"Spam")1374                       cl.sendText(g.mid,"Spam")1375                       cl.sendText(g.mid,"Spam")1376                       cl.sendText(g.mid,"Spam")1377                       cl.sendText(g.mid,"Spam")1378                       cl.sendText(g.mid,"Spam")1379                       cl.sendText(g.mid,"Spam")1380                       cl.sendText(g.mid,"Spam") 1381                       cl.sendText(g.mid,"Spam")1382                       cl.sendText(g.mid,"Spam")1383                       cl.sendText(g.mid,"Spam")1384                       cl.sendText(g.mid,"Spam")1385                       cl.sendText(g.mid,"Spam")1386                       cl.sendText(g.mid,"Spam")1387                       cl.sendText(g.mid,"Spam")1388                       cl.sendText(g.mid,"Spam")1389                       cl.sendText(g.mid,"Spam")1390                       cl.sendText(g.mid,"Spam")1391                       cl.sendText(g.mid,"Spam")1392                       cl.sendText(g.mid,"Spam")1393                       cl.sendText(g.mid,"Spam")1394                       cl.sendText(g.mid,"Spam")1395                       cl.sendText(g.mid,"Spam")1396                       cl.sendText(g.mid,"Spam")1397                       cl.sendText(g.mid,"Spam")1398                       cl.sendText(g.mid,"Spam")1399                       cl.sendText(g.mid,"Spam")1400                       cl.sendText(g.mid,"Spam")1401                       cl.sendText(g.mid,"Spam")1402                       cl.sendText(g.mid,"Spam")1403                       cl.sendText(g.mid,"Spam")1404                       cl.sendText(g.mid,"Spam")1405                       cl.sendText(g.mid,"Spam")1406                       cl.sendText(g.mid,"Spam")1407                       cl.sendText(g.mid,"Spam")1408                       cl.sendText(g.mid,"Spam")1409                       cl.sendText(g.mid,"Spam")1410                       cl.sendText(g.mid,"Spam")1411                       cl.sendText(g.mid,"Spam") 1412                       cl.sendText(g.mid,"Spam")1413                       cl.sendText(g.mid,"Spam")1414                       cl.sendText(g.mid,"Spam")1415                       cl.sendText(g.mid,"Spam")1416                       cl.sendText(g.mid,"Spam")1417                       cl.sendText(g.mid,"Spam")1418                       cl.sendText(g.mid,"Spam")1419                       cl.sendText(g.mid,"Spam")1420                       cl.sendText(g.mid,"Spam")1421                       cl.sendText(g.mid,"Spam")1422                       cl.sendText(g.mid,"Spam")1423                       cl.sendText(g.mid,"Spam")1424                       cl.sendText(g.mid,"Spam")1425                       cl.sendText(g.mid,"Spam")1426                       cl.sendText(g.mid,"Spam")1427                       cl.sendText(g.mid,"Spam")1428                       cl.sendText(g.mid,"Spam")1429                       cl.sendText(g.mid,"Spam")1430                       cl.sendText(g.mid,"Spam")1431                       cl.sendText(g.mid,"Spam")1432                       cl.sendText(g.mid,"Spam")1433                       cl.sendText(g.mid,"Spam")1434                       cl.sendText(g.mid,"Spam")1435                       cl.sendText(g.mid,"Spam")1436                       cl.sendText(g.mid,"Spam")1437                       cl.sendText(msg.to, "Done")1438                       print " Spammed !"1439                       1440#--------------------------CEK SIDER------------------------------1441            elif "Lurk" in msg.text:1442                subprocess.Popen("echo '' > dataSeen/"+msg.to+".txt", shell=True, stdout=subprocess.PIPE)1443                cl.sendText(msg.to, "Checkpoint checked!")1444                print "@setview"1445            elif "View" in msg.text:1446	        lurkGroup = ""1447	        dataResult, timeSeen, contacts, userList, timelist, recheckData = [], [], [], [], [], []1448                with open('dataSeen/'+msg.to+'.txt','r') as rr:1449                    contactArr = rr.readlines()1450                    for v in xrange(len(contactArr) -1,0,-1):1451                        num = re.sub(r'\n', "", contactArr[v])1452                        contacts.append(num)1453                        pass1454                    contacts = list(set(contacts))1455                    for z in range(len(contacts)):1456                        arg = contacts[z].split('|')1457                        userList.append(arg[0])1458                        timelist.append(arg[1])1459                    uL = list(set(userList))1460                    for ll in range(len(uL)):1461                        try:1462                            getIndexUser = userList.index(uL[ll])1463                            timeSeen.append(time.strftime("%H:%M:%S", time.localtime(int(timelist[getIndexUser]) / 1000)))1464                            recheckData.append(userList[getIndexUser])1465                        except IndexError:1466                            conName.append('nones')1467                            pass1468                    contactId = cl.getContacts(recheckData)1469                    for v in range(len(recheckData)):1470                        dataResult.append(contactId[v].displayName + ' ('+timeSeen[v]+')')1471                        pass1472                    if len(dataResult) > 0:1473                        tukang = "++++TERCIDUK++++\n*"1474                        grp = '\n* '.join(str(f) for f in dataResult)1475                        total = '\n\nTotal %i viewers (%s)' % (len(dataResult), datetime.now().strftime('%H:%M:%S') )1476                        cl.sendText(msg.to, "%s %s %s" % (tukang, grp, total))1477                    else:1478                        cl.sendText(msg.to, "Belum ada viewers")1479                    print "@viewseen"1480#--------------------------------------------------------1481#KICK_BY_TAG1482	    elif "Kick " in msg.text:1483		if 'MENTION' in msg.contentMetadata.keys()!= None:1484		    names = re.findall(r'@(\w+)', msg.text)1485		    mention = ast.literal_eval(msg.contentMetadata['MENTION'])1486		    mentionees = mention['MENTIONEES']1487		    print mentionees1488		    for mention in mentionees:1489			cl.kickoutFromGroup(msg.to,[mention['M']])1490#--------------------------------------------------------1491	    elif "Add all" in msg.text:1492		thisgroup = cl.getGroups([msg.to])1493		Mids = [contact.mid for contact in thisgroup[0].members]1494		mi_d = Mids[:33]1495		cl.findAndAddContactsByMids(mi_d)1496		cl.sendText(msg.to,"Success Add all")1497#--------------------------------------------------------1498	    elif "Recover" in msg.text:1499		thisgroup = cl.getGroups([msg.to])1500		Mids = [contact.mid for contact in thisgroup[0].members]1501		mi_d = Mids[:33]1502		cl.createGroup("Recover", mi_d)1503		cl.sendText(msg.to,"Success recover")1504#--------------------------------------------------------1505	    elif msg.text in ["Remove all chat"]:1506		cl.removeAllMessages(op.param2)1507		cl.sendText(msg.to,"Removed all chat")1508#--------------------------------------------------------1509            elif ("Gn: " in msg.text):1510                if msg.toType == 2:1511                    X = cl.getGroup(msg.to)1512                    X.name = msg.text.replace("Gn: ","")1513                    cl.updateGroup(X)1514                else:1515                    cl.sendText(msg.to,"It can't be used besides the group.")1516#--------------------------------------------------------1517            elif "Kick: " in msg.text:1518                midd = msg.text.replace("Kick: ","")1519		if midd not in admin:1520		    cl.kickoutFromGroup(msg.to,[midd])1521		else:1522		    cl.sendText(msg.to,"Admin Detected")1523#--------------------------------------------------------1524            elif "Invite: " in msg.text:1525                midd = msg.text.replace("Invite: ","")1526                cl.findAndAddContactsByMid(midd)1527                cl.inviteIntoGroup(msg.to,[midd])1528#--------------------------------------------------------1529            elif msg.text in ["#welcome","Welcome","welcome","Welkam","welkam"]:1530                gs = cl.getGroup(msg.to)1531                cl.sendText(msg.to,"สวัสà¸à¸µà¸¢à¸´à¸à¸à¸µà¸à¸à¸à¸£à¸±à¸à¹à¸à¹à¸²à¸à¸¥à¸¸à¹à¸¡à¸à¸£à¸±à¸ "+ gs.name)1532#--------------------------------------------------------1533	    elif "Bc: " in msg.text:1534		bc = msg.text.replace("Bc: ","")1535		gid = cl.getGroupIdsJoined()1536		for i in gid:1537		    cl.sendText(i,"[BROADCAST]\n"+bc+"\n#SorryBroadcast")1538		cl.sendText(msg.to,"Success BC BosQ")1539#--------------------------------------------------------1540            elif msg.text in ["ลà¸à¸£à¸±à¸"]:1541                gid = cl.getGroupIdsInvited()1542                for i in gid:1543                    cl.rejectGroupInvitation(i)1544                cl.sendText(msg.to,"ลà¸à¸à¸³à¹à¸à¸´à¸à¹à¸à¹à¸²à¸£à¹à¸§à¸¡à¸à¸¥à¸¸à¹à¸¡à¸à¸±à¹à¸à¸«à¸¡à¸à¹à¸¥à¹à¸§à¸à¹à¸²à¸")1545#--------------------------------------------------------1546            elif msg.text in ["Gurl"]:1547                if msg.toType == 2:1548                    x = cl.getGroup(msg.to)1549                    if x.preventJoinByTicket == True:1550                        x.preventJoinByTicket = False1551                        cl.updateGroup(x)1552                    gurl = cl.reissueGroupTicket(msg.to)1553                    cl.sendText(msg.to,"line://ti/g/" + gurl)1554                else:1555                    if wait["lang"] == "JP":1556                        cl.sendText(msg.to,"Can't be used outside the group")1557                    else:1558                        cl.sendText(msg.to,"Not for use less than group")1559#--------------------------------------------------------1560	    elif msg.text in ["Self Like","Self like"]:1561		try:1562		    print "activity"1563		    url = cl.activity(limit=1)1564		    print url1565		    cl.like(url['result']['posts'][0]['userInfo']['mid'], url['result']['posts'][0]['postInfo']['postId'], likeType=1001)1566		    cl.comment(url['result']['posts'][0]['userInfo']['mid'], url['result']['posts'][0]['postInfo']['postId'], "Auto Liked By Amii\n\nSuport By Bakekok á´á´á´á´ Êá´á´s")1567		    cl.sendText(msg.to, "Success~")1568		except Exception as E:1569		    try:1570			cl.sendText(msg.to,str(E))1571		    except:1572			pass1573#--------------------------------------------------------1574       #-------------Fungsi Speedbot Start---------------------#1575            elif msg.text in ["Speed","Sp"]:1576              if msg.from_ in owner:1577                start = time.time()1578                cl.sendText(msg.to, "à¸à¸°à¹à¸£à¸¢à¸±à¸à¹à¸à¸«à¸§à¹à¸²à¸²...")1579                elapsed_time = time.time() - start1580                cl.sendText(msg.to, "%à¹à¸«à¹à¸à¸à¸" % (elapsed_time))1581      #-------------Fungsi Speedbot Finish---------------------#1582#--------------------------------------------------------1583            elif msg.text in ["Ban","à¹à¸à¸"]:1584                wait["wblacklist"] = True1585                cl.sendText(msg.to,"สà¹à¸ à¸à¸à¸à¹à¸à¸à¸¡à¸²à¸«à¸³")1586            elif msg.text in ["Unban","ยà¸à¹à¸à¸"]:1587                wait["dblacklist"] = True1588                cl.sendText(msg.to,"สà¹à¸à¸à¸à¸à¹à¸à¸à¸¡à¸²à¸«à¸³")1589#--------------------------------------------------------1590	    elif "à¸à¸¥à¸±à¸à¸£à¹à¸²à¸" in msg.text:1591		try:1592		    cl.updateDisplayPicture(profile.pictureStatus)1593		    cl.updateProfile(profile)1594		    cl.sendText(msg.to, "Berhasil Seperti Semula")1595		except Exception as e:1596		    cl.sendText(msg.to, str(e))1597#--------------------------------------------------------1598	    elif "à¹à¸à¸¥à¸à¸£à¹à¸²à¸ " in msg.text:1599                copy0 = msg.text.replace("Copy ","")1600                copy1 = copy0.lstrip()1601                copy2 = copy1.replace("@","")1602                copy3 = copy2.rstrip()1603                _name = copy31604		group = cl.getGroup(msg.to)1605		for contact in group.members:1606		    cname = cl.getContact(contact.mid).displayName1607		    if cname == _name:1608			cl.CloneContactProfile(contact.mid)1609			cl.sendText(msg.to, "ยัà¸à¸à¸¡à¸´à¸ªà¸¡à¸à¸¹à¸£à¸à¹")1610		    else:1611			pass1612		1613#--------------------------------------------------------1614            elif "Ban @" in msg.text:1615                if msg.toType == 2:1616                    print "@Ban by mention"1617                    _name = msg.text.replace("Ban @","")1618                    _nametarget = _name.rstrip('  ')1619                    gs = cl.getGroup(msg.to)1620                    targets = []1621                    for g in gs.members:1622                        if _nametarget == g.displayName:1623                            targets.append(g.mid)1624                    if targets == []:1625                        cl.sendText(msg.to,"Not found")1626                    else:1627                        for target in targets:1628			    if target not in admin:1629                                try:1630                                    wait["blacklist"][target] = True1631                                    f=codecs.open('st2__b.json','w','utf-8')1632                                    json.dump(wait["blacklist"], f, sort_keys=True, indent=4,ensure_ascii=False)1633                                    cl.sendText(msg.to,"Succes BosQ")1634                                except:1635                                    cl.sendText(msg.to,"Error")1636			    else:1637				cl.sendText(msg.to,"Admin Detected~")1638            elif 'wikipedia ' in msg.text.lower():1639                  try:1640                      wiki = msg.text.lower().replace("wikipedia ","")1641                      wikipedia.set_lang("id")1642                      pesan="Title ("1643                      pesan+=wikipedia.page(wiki).title1644                      pesan+=")\n\n"1645                      pesan+=wikipedia.summary(wiki, sentences=1)1646                      pesan+="\n"1647                      pesan+=wikipedia.page(wiki).url1648                      cl.sendText(msg.to, pesan)1649                  except:1650                          try:1651                              pesan="Over Text Limit! Please Click link\n"1652                              pesan+=wikipedia.page(wiki).url1653                              cl.sendText(msg.to, pesan)1654                          except Exception as e:1655                              cl.sendText(msg.to, str(e))1656            elif '.instagram ' in msg.text.lower():1657                try:1658                    instagram = msg.text.lower().replace(".instagram ","")1659                    html = requests.get('https://www.instagram.com/' + instagram + '/?')1660                    soup = BeautifulSoup(html.text, 'html5lib')1661                    data = soup.find_all('meta', attrs={'property':'og:description'})1662                    text = data[0].get('content').split()1663                    data1 = soup.find_all('meta', attrs={'property':'og:image'})1664                    text1 = data1[0].get('content').split()1665                    user = "Name: " + text[-2] + "\n"1666                    user1 = "Username: " + text[-1] + "\n"1667                    followers = "Followers: " + text[0] + "\n"1668                    following = "Following: " + text[2] + "\n"1669                    post = "Post: " + text[4] + "\n"1670                    link = "Link: " + "https://www.instagram.com/" + instagram1671                    detail = "========INSTAGRAM INFO USER========\n"1672                    details = "\n========INSTAGRAM INFO USER========"1673                    cl.sendText(msg.to, detail + user + user1 + followers + following + post + link + details)1674                    cl.sendImageWithURL(msg.to, text1[0])1675                except Exception as njer:1676                	cl.sendText(msg.to, str(njer))1677            elif 'music ' in msg.text.lower():1678                try:1679                    songname = msg.text.lower().replace('music ','')1680                    params = {'songname': songname}1681                    r = requests.get('http://ide.fdlrcn.com/workspace/yumi-apis/joox?' + urllib.urlencode(params))1682                    data = r.text1683                    data = json.loads(data)1684                    for song in data:1685                        hasil = 'This is Your Music\n'1686                        hasil += 'Judul : ' + song[0]1687                        hasil += '\nDurasi : ' + song[1]1688                        hasil += '\nLink Download : ' + song[4]1689                        cl.sendText(msg.to, hasil)1690                        cl.sendText(msg.to, "Please Wait for audio...")1691                        cl.sendAudioWithURL(msg.to, song[4])1692		except Exception as njer:1693		        cl.sendText(msg.to, str(njer))1694#-----------------------------------------------1695            elif "/say " in msg.text:1696                 psn = msg.text.replace("/say ","")1697                 tts = gTTS(psn, lang='id', slow=False)1698                 tts.save('tts.mp3')1699                 cl.sendAudio(msg.to, 'tts.mp3')1700            elif 'Vidio ' in msg.text:1701	      if msg.from_ in admin:1702                try:1703                    textToSearch = (msg.text).replace('Vidio ', "").strip()1704                    query = urllib.quote(textToSearch)1705                    url = "https://www.youtube.com/results?search_query=" + query1706                    response = urllib2.urlopen(url)1707                    html = response.read()1708                    soup = BeautifulSoup(html, "html.parser")1709                    results = soup.find(attrs={'class':'yt-uix-tile-link'})1710                    ght=('https://www.youtube.com' + results['href'])1711		    cl.sendVideoWithURL(msg.to,ght)1712                except:1713                    cl.sendText(msg.to,"Could not find it")1714#--------------------------------------------------------1715            elif msg.text in ["Banlist"]:1716                if wait["blacklist"] == {}:1717                    cl.sendText(msg.to,"nothing")1718                else:1719                    mc = ""1720                    for mi_d in wait["blacklist"]:1721                        mc += "->" +cl.getContact(mi_d).displayName + "\n"1722                    cl.sendText(msg.to,"===[Blacklist User]===\n"+mc)1723            elif "Steal bio" in msg.text:1724              if msg.from_ in admin:1725                key = eval(msg.contentMetadata["MENTION"])1726                key1 = key["MENTIONEES"][0]["M"]1727                contact = cl.getContact(key1)1728                cu = cl.channel.getCover(key1)1729                try:1730                    cl.sendText(msg.to,contact.statusMessage)1731                except:1732                    cl.sendText(msg.to,contact.statusMessage)1733            elif "Steal cover @" in msg.text:1734              if msg.from_ in admin:            1735                print "[Command]dp executing"1736                _name = msg.text.replace("Steal cover @","")1737                _nametarget = _name.rstrip('  ')1738                gs = cl.getGroup(msg.to)1739                targets = []1740                for g in gs.members:1741                    if _nametarget == g.displayName:1742                        targets.append(g.mid)1743                if targets == []:1744                    cl.sendText(msg.to,"Contact not found")1745                else:1746                    for target in targets:1747                        try:1748                            contact = cl.getContact(target)1749                            cu = cl.channel.getCover(target)1750                            path = str(cu)1751                            cl.sendImageWithURL(msg.to, path)1752                        except:1753                            pass1754                print "[Command]dp executed"1755            elif "Steal pict " in msg.text:1756              if msg.from_ in admin:1757                if msg.toType == 2:1758                    msg.contentType = 01759                    steal0 = msg.text.replace("Steal pict ","")1760                    steal1 = steal0.lstrip()1761                    steal2 = steal1.replace("@","")1762                    steal3 = steal2.rstrip()1763                    _name = steal31764                    group = cl.getGroup(msg.to)1765                    targets = []1766                    for g in group.members:1767                        if _name == g.displayName:1768                            targets.append(g.mid)1769                    if targets == []:1770                        cl.sendText(msg.to,"not found")1771                    else:1772                        for target in targets:1773                            try:1774                                contact = cl.getContact(target)1775                                try:1776                                    image = "http://dl.profile.line-cdn.net/" + contact.pictureStatus1777                                except:1778                                    image = "https://www.1and1.co.uk/digitalguide/fileadmin/DigitalGuide/Teaser/not-found-t.jpg"1779                                try:1780                                    cl.sendImageWithURL(msg.to,image)1781                                except Exception as error:1782                                    cl.sendText(msg.to,(error))1783                                    pass1784                            except:1785                                cl.sendText(msg.to,"Error!")1786                                break1787                else:1788                    cl.sendText(msg.to,"Tidak bisa dilakukan di luar grup")1789            elif "Steal mid" in msg.text:1790              if msg.from_ in admin:1791                key = eval(msg.contentMetadata["MENTION"])1792                key1 = key["MENTIONEES"][0]["M"]1793                cl.sendText(msg.to,"Mc: " + key1)1794            elif "Steal contact" in msg.text:1795              if msg.from_ in admin:1796                key = eval(msg.contentMetadata["MENTION"])1797                key1 = key["MENTIONEES"][0]["M"]                1798                mmid = cl.getContact(key1)1799                msg.contentType = 131800                msg.contentMetadata = {"mid": key1}1801                cl.sendMessage(msg)1802            elif "Steal group pict" in msg.text:1803              if msg.from_ in admin:1804					group = cl.getGroup(msg.to)1805					path = "http://dl.profile.line-cdn.net/" + group.pictureStatus1806                                        cl.sendImageWithURL(msg.to,path)1807#--------------------------------------------------------1808            elif "Unban @" in msg.text:1809                if msg.toType == 2:1810                    print "@Unban by mention"1811                    _name = msg.text.replace("Unban @","")1812                    _nametarget = _name.rstrip('  ')1813                    gs = cl.getGroup(msg.to)1814                    targets = []1815                    for g in gs.members:1816                        if _nametarget == g.displayName:1817                            targets.append(g.mid)1818                    if targets == []:1819                        cl.sendText(msg.to,"Not found")1820                    else:1821                        for target in targets:1822                            try:1823                                del wait["blacklist"][target]1824                                f=codecs.open('st2__b.json','w','utf-8')1825                                json.dump(wait["blacklist"], f, sort_keys=True, indent=4,ensure_ascii=False)1826                                cl.sendText(msg.to,"Succes BosQ")1827                            except:1828                                cl.sendText(msg.to,"Succes BosQ")1829#--------------------------------------------------------1830            elif msg.text in ["Kill ban"]:1831                if msg.toType == 2:1832                    group = cl.getGroup(msg.to)1833                    gMembMids = [contact.mid for contact in group.members]1834                    matched_list = []1835                    for tag in wait["blacklist"]:1836                        matched_list+=filter(lambda str: str == tag, gMembMids)1837                    if matched_list == []:1838                        cl.sendText(msg.to,"There was no blacklist user")1839                        return1840                    for jj in matched_list:1841                        cl.kickoutFromGroup(msg.to,[jj])1842                    cl.sendText(msg.to,"Blacklist emang pantas tuk di usir")1843#--------------------------------------------------------1844#            elif "Cleanse" in msg.text:1845#                if msg.toType == 2:1846#                    print "Kick all member"1847#                    _name = msg.text.replace("Cleanse","")1848#                    gs = cl.getGroup(msg.to)1849#                    cl.sendText(msg.to,"âFuck You Allâ")1850#                    targets = []1851#                    for g in gs.members:1852#                        if _name in g.displayName:1853#                            targets.append(g.mid)1854#                    if targets == []:1855#                        cl.sendText(msg.to,"Not found.")1856#                    else:1857#                        for target in targets:1858#			     if target not in admin:1859#                                try:1860#                                    cl.kickoutFromGroup(msg.to,[target])1861#                                    print (msg.to,[g.mid])1862#                                except Exception as e:1863#                                    cl.sendText(msg.to,str(e))1864#			 cl.inviteIntoGroup(msg.to, targets)1865#--------------------------------------------------------1866#Restart_Program1867	    elif msg.text in ["Bot:restart","Restart","restart","รีà¸à¸à¸","Bot Restart"]:1868		cl.sendText(msg.to, "Bot has been restarted")1869		restart_program()1870		print "@Restart"1871            elif "Shutdown" in msg.text:1872               if msg.from_ in owner:1873                 try:1874                     import sys1875                     sys.exit()1876                 except:1877                     pass1878#--------------------------------------------------------1879        if op.type == 59:1880            print op1881    except Exception as error:1882        print error1883#thread2 = threading.Thread(target=nameUpdate)1884#thread2.daemon = True1885#thread2.start()1886while True:1887    try:1888        Ops = cl.fetchOps(cl.Poll.rev, 5)1889    except EOFError:1890        raise Exception("It might be wrong revision\n" + str(cl.Poll.rev))1891    for Op in Ops:1892        if (Op.type != OpType.END_OF_OPERATION):1893            cl.Poll.rev = max(cl.Poll.rev, Op.revision)...test_introspect.py
Source:test_introspect.py  
...61            ('spam.', None, 'spam.'),62            ('spam.', '.', 'spam.'),63            ('spam.', '(', 'spam.'),64            65            ('spam(', '', 'spam('),66            ('spam(', None, 'spam('),67            ('spam(', '.', 'spam('),68            ('spam(', '(', 'spam('),69            70            ('spam.eggs', '.', 'spam.'),71            ('spam.eggs.', '.', 'spam.eggs.'),72            ('spam.eggs(', '(', 'spam.eggs('),73            ('spam.eggs.', '(', 'spam.eggs.'),74            ('spam.eggs(', '.', 'spam.'),75            76            ('x = spam.', '.', 'x = spam.'),77            ('x = spam.eggs', '.', 'x = spam.'),78            ('x = spam.eggs.', '.', 'x = spam.eggs.'),79            ('x = spam.eggs(', '(', 'x = spam.eggs('),80        )81        for input, terminator, output in values:82            result = introspect.rtrimTerminus(input, terminator)83            self.assertEqual(result, output,84                             ':in: %r :t: %r :out: %r :result: %r' %85                             (input, terminator, output, result))86class GetRootTestCase(unittest.TestCase):87    def _checkRoot(self, input, terminator, output):88        root = introspect.getRoot(command=input, terminator=terminator)89        self.assertEqual(root, output,90                         ':in: %r :t: %r :out: %r :root: %r' %91                         (input, terminator, output, root))92    def test_getRoot(self):93        values = (94            ('', '', ''),95            ('', None, ''),96            ('', '.', ''),97            ('', '(', ''),98            99            ('.', '', '.'),100            ('.', None, '.'),101            ('.', '.', ''),102            ('.', '(', '.'),103            104            ('(', '', ''),105            ('(', None, ''),106            ('(', '.', ''),107            ('(', '(', ''),108            109            ('spam', '', 'spam'),110            ('spam', None, 'spam'),111            ('spam', '.', ''),112            ('spam', '(', 'spam'),113            114            ('spam.', '', 'spam.'),115            ('spam.', None, 'spam.'),116            ('spam.', '.', 'spam'),117            ('spam.', '(', 'spam.'),118            119            ('spam(', '', ''),120            ('spam(', None, ''),121            ('spam(', '.', ''),122            ('spam(', '(', 'spam'),123            124            ('spam.eggs', '.', 'spam'),125            ('spam.eggs.', '.', 'spam.eggs'),126            ('spam.eggs(', '(', 'spam.eggs'),127            ('spam.eggs.', '(', 'spam.eggs.'),128            ('spam.eggs(', '.', 'spam'),129            130            ('x = spam.', '.', 'spam'),131            ('x = spam.eggs', '.', 'spam'),132            ('x = spam.eggs.', '.', 'spam.eggs'),133            ('x = spam.eggs(', '(', 'spam.eggs'),134            ('for n in range(3):\n    d.', '.', 'd'),135            ('for n in range(3):\n...    d.', '.', 'd'),136        )137        for input, terminator, output in values:138            self._checkRoot(input, terminator, output)139    def test_getRoot_Advanced(self):140        values = (141            ('spam_', '', 'spam_'),142            ('spam_', None, 'spam_'),143            ('spam_', '.', ''),144            ('spam_', '(', 'spam_'),145            146            ('_spam', '', '_spam'),147            ('_spam', None, '_spam'),148            ('_spam', '.', ''),149            ('_spam', '(', '_spam'),150            151            ('spam_eggs', '', 'spam_eggs'),152            ('spam_eggs', None, 'spam_eggs'),153            ('spam_eggs', '.', ''),154            ('spam_eggs', '(', 'spam_eggs'),155            156            ('spam123', '', 'spam123'),157            ('spam123', None, 'spam123'),158            ('spam123', '.', ''),159            ('spam123', '(', 'spam123'),160            ('spam_123', '', 'spam_123'),161            ('spam_123', None, 'spam_123'),162            ('spam_123', '.', ''),163            ('spam_123', '(', 'spam_123'),164        )165        for input, terminator, output in values:166            self._checkRoot(input, terminator, output)167## The original intent was to detect when we were inside a string.168## That has proven to be very difficult, for little benefit.169## The fact that autocomplete or calltips might be triggered inside170## a string is not a big deal. Sometimes it is even helpful.171##    def test_getRoot_InsideStrings(self):172##        values = (173##            ('x = ".', '.', ''),174##            ("x = '.", '.', ''),175##            ('x = """.', '.', ''),176##            ("x = '''.", '.', ''),177##178##            ('x = "(', '(', ''),179##            ("x = '(", '(', ''),180##            ('x = """(', '(', ''),181##            ("x = '''(", '(', ''),182##183##            ('x = "spam', '.', ''),184##            ('x = "spam.', '.', ''),185##            ("x = 'spam.", '.', ''),186##            ('x = """spam.', '.', ''),187##            ("x = '''spam.", '.', ''),188##            189##            ('x = "spam', '(', ''),190##            ('x = "spam(', '(', ''),191##            ("x = 'spam(", '(', ''),192##            ('x = """spam(', '(', ''),193##            ("x = '''spam(", '(', ''),194##            195##            ('x = "spam.eggs.', '.', ''),196##            ("x = 'spam.eggs.", '.', ''),197##            ('x = """spam.eggs.', '.', ''),198##            ("x = '''spam.eggs.", '.', ''),199##            200##            ('x = "spam.eggs(', '(', ''),201##            ("x = 'spam.eggs(", '(', ''),202##            ('x = """spam.eggs(', '(', ''),203##            ("x = '''spam.eggs(", '(', ''),204##        )205##        for input, terminator, output in values:206##            self._checkRoot(input, terminator, output)207    def test_getRoot_EmptyTypes(self):208        values = (209            ("''.", '.', "''"),210            ('"".', '.', '""'),211            ('"""""".', '.', '""""""'),212            ("''''''.", '.', "''''''"),213            ('[].', '.', '[]'),214            ('().', '.', '()'),215            ('{}.', '.', '{}'),216            217            ('[](', '(', '[]'),218            ('()(', '(', '()'),219            ('{}(', '(', '{}'),220            221            ("x = ''.", '.', "''"),222            ('x = "".', '.', '""'),223            ('x = """""".', '.', '""""""'),224            ("x = ''''''.", '.', "''''''"),225            ('x = [].', '.', '[]'),226            ('x = ().', '.', '()'),227            ('x = {}.', '.', '{}'),228            229            ('x = [](', '(', '[]'),230            ('x = ()(', '(', '()'),231            ('x = {}(', '(', '{}'),232            ('print [].', '.', '[]'),233            ('print ().', '.', '()'),234            ('print {}.', '.', '{}'),235            236            ('print [](', '(', '[]'),237            ('print ()(', '(', '()'),238            ('print {}(', '(', '{}'),239            ("''.attr.", '.', "''.attr"),240            ('"".attr.', '.', '"".attr'),241            ('"""""".attr.', '.', '"""""".attr'),242            ("''''''.attr.", '.', "''''''.attr"),243            ('[].attr.', '.', '[].attr'),244            ('().attr.', '.', '().attr'),245            ('{}.attr.', '.', '{}.attr'),246            247            ('[].attr(', '(', '[].attr'),248            ('().attr(', '(', '().attr'),249            ('{}.attr(', '(', '{}.attr'),250            ('spam().', '.', ''),251            ('spam_().', '.', ''),252            ('spam5().', '.', ''),253            ('spam[]().', '.', ''),254            ('spam()[].', '.', ''),255            ('spam[]{}.', '.', ''),256            ("spam(''.", '.', "''"),257            ('spam("".', '.', '""'),258            ('spam("""""".', '.', '""""""'),259            ("spam(''''''.", '.', "''''''"),260            ('spam([].', '.', '[]'),261            ('spam(().', '.', '()'),262            ('spam({}.', '.', '{}'),263            ('spam[[].', '.', '[]'),264            ('spam[().', '.', '()'),265            ('spam[{}.', '.', '{}'),266            ('x = {[].', '.', '[]'),267            ('x = {().', '.', '()'),268            ('x = {{}.', '.', '{}'),269            ('spam,[].', '.', '[]'),270            ('spam+[].', '.', '[]'),271            ('spam-[].', '.', '[]'),272            ('spam*[].', '.', '[]'),273            ('spam/[].', '.', '[]'),274            ('spam=[].', '.', '[]'),275            ('spam%[].', '.', '[]'),276            ('spam<[].', '.', '[]'),...test_dynamicclassattribute.py
Source:test_dynamicclassattribute.py  
...15class BaseClass(object):16    def __init__(self):17        self._spam = 518    @DynamicClassAttribute19    def spam(self):20        """BaseClass.getter"""21        return self._spam22    @spam.setter23    def spam(self, value):24        self._spam = value25    @spam.deleter26    def spam(self):27        del self._spam28class SubClass(BaseClass):29    spam = BaseClass.__dict__['spam']30    @spam.getter31    def spam(self):32        """SubClass.getter"""33        raise PropertyGet(self._spam)34    @spam.setter35    def spam(self, value):36        raise PropertySet(self._spam)37    @spam.deleter38    def spam(self):39        raise PropertyDel(self._spam)40class PropertyDocBase(object):41    _spam = 142    def _get_spam(self):43        return self._spam44    spam = DynamicClassAttribute(_get_spam, doc="spam spam spam")45class PropertyDocSub(PropertyDocBase):46    spam = PropertyDocBase.__dict__['spam']47    @spam.getter48    def spam(self):49        """The decorator does not use this doc string"""50        return self._spam51class PropertySubNewGetter(BaseClass):52    spam = BaseClass.__dict__['spam']53    @spam.getter54    def spam(self):55        """new docstring"""56        return 557class PropertyNewGetter(object):58    @DynamicClassAttribute59    def spam(self):60        """original docstring"""61        return 162    @spam.getter63    def spam(self):64        """new docstring"""65        return 866class ClassWithAbstractVirtualProperty(metaclass=abc.ABCMeta):67    @DynamicClassAttribute68    @abc.abstractmethod69    def color():70        pass71class ClassWithPropertyAbstractVirtual(metaclass=abc.ABCMeta):72    @abc.abstractmethod73    @DynamicClassAttribute74    def color():75        pass76class PropertyTests(unittest.TestCase):77    def test_property_decorator_baseclass(self):78        # see #162079        base = BaseClass()80        self.assertEqual(base.spam, 5)81        self.assertEqual(base._spam, 5)82        base.spam = 1083        self.assertEqual(base.spam, 10)84        self.assertEqual(base._spam, 10)85        delattr(base, "spam")86        self.assertTrue(not hasattr(base, "spam"))87        self.assertTrue(not hasattr(base, "_spam"))88        base.spam = 2089        self.assertEqual(base.spam, 20)90        self.assertEqual(base._spam, 20)91    def test_property_decorator_subclass(self):92        # see #162093        sub = SubClass()94        self.assertRaises(PropertyGet, getattr, sub, "spam")95        self.assertRaises(PropertySet, setattr, sub, "spam", None)96        self.assertRaises(PropertyDel, delattr, sub, "spam")97    @unittest.skipIf(sys.flags.optimize >= 2,98                     "Docstrings are omitted with -O2 and above")99    def test_property_decorator_subclass_doc(self):100        sub = SubClass()101        self.assertEqual(sub.__class__.__dict__['spam'].__doc__, "SubClass.getter")102    @unittest.skipIf(sys.flags.optimize >= 2,103                     "Docstrings are omitted with -O2 and above")104    def test_property_decorator_baseclass_doc(self):105        base = BaseClass()106        self.assertEqual(base.__class__.__dict__['spam'].__doc__, "BaseClass.getter")107    def test_property_decorator_doc(self):108        base = PropertyDocBase()109        sub = PropertyDocSub()110        self.assertEqual(base.__class__.__dict__['spam'].__doc__, "spam spam spam")111        self.assertEqual(sub.__class__.__dict__['spam'].__doc__, "spam spam spam")112    @unittest.skipIf(sys.flags.optimize >= 2,113                     "Docstrings are omitted with -O2 and above")114    def test_property_getter_doc_override(self):115        newgettersub = PropertySubNewGetter()116        self.assertEqual(newgettersub.spam, 5)117        self.assertEqual(newgettersub.__class__.__dict__['spam'].__doc__, "new docstring")118        newgetter = PropertyNewGetter()119        self.assertEqual(newgetter.spam, 8)120        self.assertEqual(newgetter.__class__.__dict__['spam'].__doc__, "new docstring")121    def test_property___isabstractmethod__descriptor(self):122        for val in (True, False, [], [1], '', '1'):123            class C(object):124                def foo(self):125                    pass126                foo.__isabstractmethod__ = val127                foo = DynamicClassAttribute(foo)128            self.assertIs(C.__dict__['foo'].__isabstractmethod__, bool(val))129        # check that the DynamicClassAttribute's __isabstractmethod__ descriptor does the130        # right thing when presented with a value that fails truth testing:131        class NotBool(object):132            def __bool__(self):133                raise ValueError()134            __len__ = __bool__135        with self.assertRaises(ValueError):136            class C(object):137                def foo(self):138                    pass139                foo.__isabstractmethod__ = NotBool()140                foo = DynamicClassAttribute(foo)141    def test_abstract_virtual(self):142        self.assertRaises(TypeError, ClassWithAbstractVirtualProperty)143        self.assertRaises(TypeError, ClassWithPropertyAbstractVirtual)144        class APV(ClassWithPropertyAbstractVirtual):145            pass146        self.assertRaises(TypeError, APV)147        class AVP(ClassWithAbstractVirtualProperty):148            pass149        self.assertRaises(TypeError, AVP)150        class Okay1(ClassWithAbstractVirtualProperty):151            @DynamicClassAttribute152            def color(self):153                return self._color154            def __init__(self):155                self._color = 'cyan'156        with self.assertRaises(AttributeError):157            Okay1.color158        self.assertEqual(Okay1().color, 'cyan')159        class Okay2(ClassWithAbstractVirtualProperty):160            @DynamicClassAttribute161            def color(self):162                return self._color163            def __init__(self):164                self._color = 'magenta'165        with self.assertRaises(AttributeError):166            Okay2.color167        self.assertEqual(Okay2().color, 'magenta')168# Issue 5890: subclasses of DynamicClassAttribute do not preserve method __doc__ strings169class PropertySub(DynamicClassAttribute):170    """This is a subclass of DynamicClassAttribute"""171class PropertySubSlots(DynamicClassAttribute):172    """This is a subclass of DynamicClassAttribute that defines __slots__"""173    __slots__ = ()174class PropertySubclassTests(unittest.TestCase):175    @unittest.skipIf(hasattr(PropertySubSlots, '__doc__'),176            "__doc__ is already present, __slots__ will have no effect")177    def test_slots_docstring_copy_exception(self):178        try:179            class Foo(object):180                @PropertySubSlots181                def spam(self):182                    """Trying to copy this docstring will raise an exception"""183                    return 1184                print('\n',spam.__doc__)185        except AttributeError:186            pass187        else:188            raise Exception("AttributeError not raised")189    @unittest.skipIf(sys.flags.optimize >= 2,190                     "Docstrings are omitted with -O2 and above")191    def test_docstring_copy(self):192        class Foo(object):193            @PropertySub194            def spam(self):195                """spam wrapped in DynamicClassAttribute subclass"""196                return 1197        self.assertEqual(198            Foo.__dict__['spam'].__doc__,199            "spam wrapped in DynamicClassAttribute subclass")200    @unittest.skipIf(sys.flags.optimize >= 2,201                     "Docstrings are omitted with -O2 and above")202    def test_property_setter_copies_getter_docstring(self):203        class Foo(object):204            def __init__(self): self._spam = 1205            @PropertySub206            def spam(self):207                """spam wrapped in DynamicClassAttribute subclass"""208                return self._spam209            @spam.setter210            def spam(self, value):211                """this docstring is ignored"""212                self._spam = value213        foo = Foo()214        self.assertEqual(foo.spam, 1)215        foo.spam = 2216        self.assertEqual(foo.spam, 2)217        self.assertEqual(218            Foo.__dict__['spam'].__doc__,219            "spam wrapped in DynamicClassAttribute subclass")220        class FooSub(Foo):221            spam = Foo.__dict__['spam']222            @spam.setter223            def spam(self, value):224                """another ignored docstring"""225                self._spam = 'eggs'226        foosub = FooSub()227        self.assertEqual(foosub.spam, 1)228        foosub.spam = 7229        self.assertEqual(foosub.spam, 'eggs')230        self.assertEqual(231            FooSub.__dict__['spam'].__doc__,232            "spam wrapped in DynamicClassAttribute subclass")233    @unittest.skipIf(sys.flags.optimize >= 2,234                     "Docstrings are omitted with -O2 and above")235    def test_property_new_getter_new_docstring(self):236        class Foo(object):237            @PropertySub238            def spam(self):239                """a docstring"""240                return 1241            @spam.getter242            def spam(self):243                """a new docstring"""244                return 2245        self.assertEqual(Foo.__dict__['spam'].__doc__, "a new docstring")246        class FooBase(object):247            @PropertySub248            def spam(self):249                """a docstring"""250                return 1251        class Foo2(FooBase):252            spam = FooBase.__dict__['spam']253            @spam.getter254            def spam(self):255                """a new docstring"""256                return 2257        self.assertEqual(Foo.__dict__['spam'].__doc__, "a new docstring")258if __name__ == '__main__':...test_property.py
Source:test_property.py  
...14class BaseClass(object):15    def __init__(self):16        self._spam = 517    @property18    def spam(self):19        """BaseClass.getter"""20        return self._spam21    @spam.setter22    def spam(self, value):23        self._spam = value24    @spam.deleter25    def spam(self):26        del self._spam27class SubClass(BaseClass):28    @BaseClass.spam.getter29    def spam(self):30        """SubClass.getter"""31        raise PropertyGet(self._spam)32    @spam.setter33    def spam(self, value):34        raise PropertySet(self._spam)35    @spam.deleter36    def spam(self):37        raise PropertyDel(self._spam)38class PropertyDocBase(object):39    _spam = 140    def _get_spam(self):41        return self._spam42    spam = property(_get_spam, doc="spam spam spam")43class PropertyDocSub(PropertyDocBase):44    @PropertyDocBase.spam.getter45    def spam(self):46        """The decorator does not use this doc string"""47        return self._spam48class PropertySubNewGetter(BaseClass):49    @BaseClass.spam.getter50    def spam(self):51        """new docstring"""52        return 553class PropertyNewGetter(object):54    @property55    def spam(self):56        """original docstring"""57        return 158    @spam.getter59    def spam(self):60        """new docstring"""61        return 862class PropertyTests(unittest.TestCase):63    def test_property_decorator_baseclass(self):64        # see #162065        base = BaseClass()66        self.assertEqual(base.spam, 5)67        self.assertEqual(base._spam, 5)68        base.spam = 1069        self.assertEqual(base.spam, 10)70        self.assertEqual(base._spam, 10)71        delattr(base, "spam")72        self.assertTrue(not hasattr(base, "spam"))73        self.assertTrue(not hasattr(base, "_spam"))74        base.spam = 2075        self.assertEqual(base.spam, 20)76        self.assertEqual(base._spam, 20)77    def test_property_decorator_subclass(self):78        # see #162079        sub = SubClass()80        self.assertRaises(PropertyGet, getattr, sub, "spam")81        self.assertRaises(PropertySet, setattr, sub, "spam", None)82        self.assertRaises(PropertyDel, delattr, sub, "spam")83    @unittest.skipIf(sys.flags.optimize >= 2,84                     "Docstrings are omitted with -O2 and above")85    def test_property_decorator_subclass_doc(self):86        sub = SubClass()87        self.assertEqual(sub.__class__.spam.__doc__, "SubClass.getter")88    @unittest.skipIf(sys.flags.optimize >= 2,89                     "Docstrings are omitted with -O2 and above")90    def test_property_decorator_baseclass_doc(self):91        base = BaseClass()92        self.assertEqual(base.__class__.spam.__doc__, "BaseClass.getter")93    def test_property_decorator_doc(self):94        base = PropertyDocBase()95        sub = PropertyDocSub()96        self.assertEqual(base.__class__.spam.__doc__, "spam spam spam")97        self.assertEqual(sub.__class__.spam.__doc__, "spam spam spam")98    @unittest.skipIf(sys.flags.optimize >= 2,99                     "Docstrings are omitted with -O2 and above")100    def test_property_getter_doc_override(self):101        newgettersub = PropertySubNewGetter()102        self.assertEqual(newgettersub.spam, 5)103        self.assertEqual(newgettersub.__class__.spam.__doc__, "new docstring")104        newgetter = PropertyNewGetter()105        self.assertEqual(newgetter.spam, 8)106        self.assertEqual(newgetter.__class__.spam.__doc__, "new docstring")107    def test_property___isabstractmethod__descriptor(self):108        for val in (True, False, [], [1], '', '1'):109            class C(object):110                def foo(self):111                    pass112                foo.__isabstractmethod__ = val113                foo = property(foo)114            self.assertIs(C.foo.__isabstractmethod__, bool(val))115        # check that the property's __isabstractmethod__ descriptor does the116        # right thing when presented with a value that fails truth testing:117        class NotBool(object):118            def __bool__(self):119                raise ValueError()120            __len__ = __bool__121        with self.assertRaises(ValueError):122            class C(object):123                def foo(self):124                    pass125                foo.__isabstractmethod__ = NotBool()126                foo = property(foo)127            C.foo.__isabstractmethod__128    @unittest.skipIf(sys.flags.optimize >= 2,129                     "Docstrings are omitted with -O2 and above")130    def test_property_builtin_doc_writable(self):131        p = property(doc='basic')132        self.assertEqual(p.__doc__, 'basic')133        p.__doc__ = 'extended'134        self.assertEqual(p.__doc__, 'extended')135    @unittest.skipIf(sys.flags.optimize >= 2,136                     "Docstrings are omitted with -O2 and above")137    def test_property_decorator_doc_writable(self):138        class PropertyWritableDoc(object):139            @property140            def spam(self):141                """Eggs"""142                return "eggs"143        sub = PropertyWritableDoc()144        self.assertEqual(sub.__class__.spam.__doc__, 'Eggs')145        sub.__class__.spam.__doc__ = 'Spam'146        self.assertEqual(sub.__class__.spam.__doc__, 'Spam')147    @support.refcount_test148    def test_refleaks_in___init__(self):149        gettotalrefcount = support.get_attribute(sys, 'gettotalrefcount')150        fake_prop = property('fget', 'fset', 'fdel', 'doc')151        refs_before = gettotalrefcount()152        for i in range(100):153            fake_prop.__init__('fget', 'fset', 'fdel', 'doc')154        self.assertAlmostEqual(gettotalrefcount() - refs_before, 0, delta=10)155# Issue 5890: subclasses of property do not preserve method __doc__ strings156class PropertySub(property):157    """This is a subclass of property"""158class PropertySubSlots(property):159    """This is a subclass of property that defines __slots__"""160    __slots__ = ()161class PropertySubclassTests(unittest.TestCase):162    def test_slots_docstring_copy_exception(self):163        try:164            class Foo(object):165                @PropertySubSlots166                def spam(self):167                    """Trying to copy this docstring will raise an exception"""168                    return 1169        except AttributeError:170            pass171        else:172            raise Exception("AttributeError not raised")173    @unittest.skipIf(sys.flags.optimize >= 2,174                     "Docstrings are omitted with -O2 and above")175    def test_docstring_copy(self):176        class Foo(object):177            @PropertySub178            def spam(self):179                """spam wrapped in property subclass"""180                return 1181        self.assertEqual(182            Foo.spam.__doc__,183            "spam wrapped in property subclass")184    @unittest.skipIf(sys.flags.optimize >= 2,185                     "Docstrings are omitted with -O2 and above")186    def test_property_setter_copies_getter_docstring(self):187        class Foo(object):188            def __init__(self): self._spam = 1189            @PropertySub190            def spam(self):191                """spam wrapped in property subclass"""192                return self._spam193            @spam.setter194            def spam(self, value):195                """this docstring is ignored"""196                self._spam = value197        foo = Foo()198        self.assertEqual(foo.spam, 1)199        foo.spam = 2200        self.assertEqual(foo.spam, 2)201        self.assertEqual(202            Foo.spam.__doc__,203            "spam wrapped in property subclass")204        class FooSub(Foo):205            @Foo.spam.setter206            def spam(self, value):207                """another ignored docstring"""208                self._spam = 'eggs'209        foosub = FooSub()210        self.assertEqual(foosub.spam, 1)211        foosub.spam = 7212        self.assertEqual(foosub.spam, 'eggs')213        self.assertEqual(214            FooSub.spam.__doc__,215            "spam wrapped in property subclass")216    @unittest.skipIf(sys.flags.optimize >= 2,217                     "Docstrings are omitted with -O2 and above")218    def test_property_new_getter_new_docstring(self):219        class Foo(object):220            @PropertySub221            def spam(self):222                """a docstring"""223                return 1224            @spam.getter225            def spam(self):226                """a new docstring"""227                return 2228        self.assertEqual(Foo.spam.__doc__, "a new docstring")229        class FooBase(object):230            @PropertySub231            def spam(self):232                """a docstring"""233                return 1234        class Foo2(FooBase):235            @FooBase.spam.getter236            def spam(self):237                """a new docstring"""238                return 2239        self.assertEqual(Foo.spam.__doc__, "a new docstring")240if __name__ == '__main__':...Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
