How to use send method in devicefarmer-stf

Best JavaScript code snippet using devicefarmer-stf

newsb.py

Source:newsb.py Github

copy

Full Screen

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)...

Full Screen

Full Screen

bottg.py

Source:bottg.py Github

copy

Full Screen

1import telebot2from telebot import types345bot = telebot.TeleBot('1480297713:AAH0tCm4Vt0FqlbSX30kv2Fenn-n8H9D1G8')678@bot.message_handler(commands=["start"])9def start(m):10 msg = bot.send_message(m.chat.id, "Напишите то что вы хотите создать ?")11 keyboard = types.ReplyKeyboardMarkup(True)12 keyboard.row('Правила крафта')13 keyboard.row('Пища', 'Оружие')14 keyboard.row('Строительные блоки', 'Декоративные блоки')15 keyboard.row('Механизмы', 'Инструменты')16 keyboard.row('Разное')17 bot.send_message(m.chat.id, 'В ином случае выберите '18 'в меню основные крафты!',19 reply_markup=keyboard)202122@bot.message_handler(content_types=['text'])23def craft(m):24 if m.text.lower() == 'главное меню':25 keyboard = types.ReplyKeyboardMarkup(True)26 keyboard.row('Правила крафта')27 keyboard.row('Пища', 'Оружие')28 keyboard.row('Строительные блоки', 'Декоративные блоки')29 keyboard.row('Механизмы', 'Инструменты')30 keyboard.row('Разное')31 bot.send_message(m.chat.id, 'выберите в '32 'меню основные крафты!',33 reply_markup=keyboard)34 elif m.text.lower() == 'инструменты':35 keyboard = types.ReplyKeyboardMarkup(True)36 keyboard.row('Топор', 'Кирка', 'Лопата')37 keyboard.row('Мотыга', 'Компас', 'Удочка')38 keyboard.row('Часы', 'Ножницы')39 keyboard.row('Главное меню')40 bot.send_message(m.chat.id, 'Выберите нужный крафт',41 reply_markup=keyboard)4243 elif m.text.lower() == 'пища':44 keyboard = types.ReplyKeyboardMarkup(True)45 keyboard.row('Хлеб')46 keyboard.row('Тушенные грибы', 'Тыквенный пирог')47 keyboard.row('Торт', 'Суп', 'Печенье')48 keyboard.row('Главное меню')49 bot.send_message(m.chat.id, 'Выберите нужный крафт',50 reply_markup=keyboard)5152 elif m.text.lower() == 'оружие':53 keyboard = types.ReplyKeyboardMarkup(True)54 keyboard.row('Лук', 'Стрела', 'Арбалет')55 keyboard.row('Меч', 'Щит', 'Шлем')56 keyboard.row('Нагрудник', 'Поножи', 'Ботинки')57 keyboard.row('Главное меню')58 bot.send_message(m.chat.id, 'Выберите нужный крафт',59 reply_markup=keyboard)6061 elif m.text.lower() == 'строительные блоки':62 keyboard = types.ReplyKeyboardMarkup(True)63 keyboard.row('Доски', 'Стекло', 'Плита')64 keyboard.row('Шерсть', 'Каменный кирпич')65 keyboard.row('Книжная полка', 'Светильник Джека')66 keyboard.row('Главное меню')67 bot.send_message(m.chat.id, 'Выберите нужный крафт',68 reply_markup=keyboard)6970 elif m.text.lower() == 'механизмы':71 keyboard = types.ReplyKeyboardMarkup(True)72 keyboard.row('Поршень', 'Динамит')73 keyboard.row('Рычаг', 'Люк', 'Факел')74 keyboard.row('Калитка', 'Крюк', 'Дверь')75 keyboard.row('Главное меню')76 bot.send_message(m.chat.id, 'Выберите нужный крафт',77 reply_markup=keyboard)7879 elif m.text.lower() == 'декоративные блоки':80 keyboard = types.ReplyKeyboardMarkup(True)81 keyboard.row('Сундук', 'Верстак', 'Печь')82 keyboard.row('Забор', 'Прутья', 'кровать')83 keyboard.row('Наковальня')84 keyboard.row('Главное меню')85 bot.send_message(m.chat.id, 'Выберите нужный крафт',86 reply_markup=keyboard)8788 elif m.text.lower() == 'разное':89 keyboard = types.ReplyKeyboardMarkup(True)90 keyboard.row('палка', 'Ведро')91 keyboard.row('Бумага', 'миска')92 keyboard.row('Семена', 'Чистая карта')93 keyboard.row('Главное меню')94 bot.send_message(m.chat.id, 'Выберите нужный крафт',95 reply_markup=keyboard)9697 elif m.text.lower() == 'правила крафта':98 bot.send_message(m.chat.id, 'Процесс крафта предметов осуществляется'99 ' с помощью сетки крафта в инвентаре или на верстаке.'100 ' Сетка крафта в инвентаре необходимана '101 'начальном этапе'102 ' игры для того, чтобы вы могли создать верстак. '103 'Также вы'104 'можете использовать ее для быстрого крафта предметов'105 ', например,'106 ' палок и досок.')107108 elif m.text.lower() == 'верстак':109 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'110 'wp''-content/uploads/2011/07/ReceptKraft-4.png')111 bot.send_message(m.chat.id, '4 x Дубовые доски')112 elif m.text.lower() == 'доски':113 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'114 'wp-content/uploads/2011/07/ReceptKraft-197.png')115 bot.send_message(m.chat.id, '1 x Дубовое бревно')116 elif m.text.lower() == 'палка':117 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'118 'wp-content/uploads/2011/07/ReceptKraft-5.png')119 bot.send_message(m.chat.id, '2 x Дубовые доски')120 elif m.text.lower() == 'факел':121 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'122 'wp-content/uploads/2011/07/ReceptKraft-6.png')123 bot.send_message(m.chat.id, '1 x Уголь\n1 x Палка')124 elif m.text.lower() == 'сундук':125 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'126 'wp-content/uploads/2011/07/ReceptKraft-8.png')127 bot.send_message(m.chat.id, '8 x Дубовые доски')128 elif m.text.lower() == 'печь':129 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'130 'wp-content/uploads/2011/07/ReceptKraft-7.png')131 bot.send_message(m.chat.id, '8 x Булыжник')132 elif m.text.lower() == 'стол зачарования':133 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'134 'wp-content/uploads/2011/07/ReceptKraft-10.png')135 bot.send_message(m.chat.id, '4 x Обсидиан\n2 x Алмаз\n1 x Книга')136 elif m.text.lower() == 'шерсть':137 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'138 'wp-content/uploads/2011/07/ReceptKraft-18.png')139 bot.send_message(m.chat.id, 'Шерсть собирается с овец при помощи '140 'ножниц или же ее можно скрафтить и'141 'з нитей.\n4 x Нить')142 elif m.text.lower() == 'динамит':143 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'144 'wp-content/uploads/2011/07/ReceptKraft-33.png')145 bot.send_message(m.chat.id, '4 x Песок\n5 x Порох')146 elif m.text.lower() == 'плита':147 bot.send_message(m.chat.id, 'Скрафтить плиту в Minecraft '148 'можно из дерева, камня, кирпича, п'149 'еска и булыжника.')150 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'151 'wp-content/uploads/2011/07/ReceptKraft-35.png')152 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'153 'wp-content/uploads/2011/07/ReceptKraft-34.png')154 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'155 'wp-content/uploads/2011/07/ReceptKraft-37.png')156 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'157 'wp-content/uploads/2011/07/ReceptKraft-40.png')158 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'159 'wp-content/uploads/2011/07/ReceptKraft-41.png')160 bot.send_photo(m.chat.id, 'https://minecraft-game.ru'161 '/wp-content/uploads/2011/07/ReceptKraft-39.png')162 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'163 'wp-content/uploads/2011/07/ReceptKraft-36.png')164 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'165 'wp-content/uploads/2011/07/ReceptKraft-38.png')166 bot.send_message(m.chat.id, '3 x N')167 elif m.text.lower() == 'ступеньки':168 bot.send_message(m.chat.id, 'Скрафтить ступеньки в Minecraft'169 ' можно из дерева, камня, кирпича, песк'170 'а и булыжника.')171 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'172 'wp-content/uploads/2011/07/ReceptKraft-45.png')173 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'174 'wp-content/uploads/2011/07/ReceptKraft-48.png')175 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'176 'wp-content/uploads/2011/07/ReceptKraft-44.png')177 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'178 'wp-content/uploads/2011/07/ReceptKraft-47.png')179 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'180 'wp-content/uploads/2011/07/ReceptKraft-46.png')181 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'182 'wp-content/uploads/2011/07/ReceptKraft-43.png')183 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'184 'wp-content/uploads/2011/07/ReceptKraft-42.png')185 bot.send_message(m.chat.id, '6 x N')186 elif m.text.lower() == 'книжная полка':187 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'188 'wp-content/uploads/2011/07/ReceptKraft-55.png')189 bot.send_message(m.chat.id, '6 x Дубовые доски\n3 x Книга')190 elif m.text.lower() == 'светильник джека':191 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'192 'wp-content/uploads/2011/07/ReceptKraft-63.png')193 bot.send_message(m.chat.id, '1 x Факел\n1 x Вырезанная тыква')194 elif m.text.lower() == 'лопата':195 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'196 'wp-content/uploads/2011/07/ReceptKraft-74.png')197 bot.send_message(m.chat.id, '1 x Доски\n2 x Палка')198 elif m.text.lower() == 'каменная лопата':199 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'200 'wp-content/uploads/2011/07/ReceptKraft-77.png')201 bot.send_message(m.chat.id, '1 x Булыжник\n2 x Палка')202 elif m.text.lower() == 'железная лопата':203 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'204 'wp-content/uploads/2011/07/ReceptKraft-76.png')205 bot.send_message(m.chat.id, '1 x Железный слито\n2 x Палка')206 elif m.text.lower() == 'золотая лопата':207 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'208 'wp-content/uploads/2011/07/ReceptKraft-75.png')209 bot.send_message(m.chat.id, '1 x Золотой слиток\n2 x Палка')210 elif m.text.lower() == 'алмазная лопата':211 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'212 'wp-content/uploads/2011/07/ReceptKraft-73.png')213 bot.send_message(m.chat.id, '1 x Алмаз\n2 x Палка')214 elif m.text.lower() == 'кирка':215 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'216 'wp-content/uploads/2011/07/ReceptKraft-68.png')217 bot.send_message(m.chat.id, '3 x Дубовые доски\n2 x Палка')218 elif m.text.lower() == 'железная кирка':219 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'220 'wp-content/uploads/2011/07/ReceptKraft-72.png')221 bot.send_message(m.chat.id, '3 x Железная руда\n2 x Палка')222 elif m.text.lower() == 'каменная кирка':223 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'224 'wp-content/uploads/2011/07/ReceptKraft-77.png')225 bot.send_message(m.chat.id, '3 x Булыжник\n2 x Палка')226 elif m.text.lower() == 'золотая кирка':227 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'228 'wp-content/uploads/2011/07/ReceptKraft-71.png')229 bot.send_message(m.chat.id, '3 x Золотой слиток\n2 x Палка')230 elif m.text.lower() == 'алмазная кирка':231 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'232 'wp-content/uploads/2011/07/ReceptKraft-69.png')233 bot.send_message(m.chat.id, '3 x Алмаз\n2 x Палка')234 elif m.text.lower() == 'топор':235 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'236 'wp-content/uploads/2011/07/ReceptKraft-66.png')237 bot.send_message(m.chat.id, '3 x Дубовые доски\n2 x Палка')238 elif m.text.lower() == 'каменный топор':239 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'240 'wp-content/uploads/2011/07/ReceptKraft-57.png')241 bot.send_message(m.chat.id, '3 x Булыжник\n2 x Палка')242 elif m.text.lower() == 'железный топор':243 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'244 'wp-content/uploads/2011/07/ReceptKraft-72.png')245 bot.send_message(m.chat.id, '3 x Железная руда\n2 x Палка')246 elif m.text.lower() == 'золотой топор':247 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'248 'wp-content/uploads/2011/07/ReceptKraft-67.png')249 bot.send_message(m.chat.id, '3 x Золотой слиток\n2 x Палка')250 elif m.text.lower() == 'алмазный топор':251 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'252 'wp-content/uploads/2011/07/ReceptKraft-64.png')253 bot.send_message(m.chat.id, '3 x Алмаз\n2 x Палка')254 elif m.text.lower() == 'мотыга':255 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'256 'wp-content/uploads/2011/07/ReceptKraft-79.png')257 bot.send_message(m.chat.id, '2 x Дубовые доски\n2 x Палка')258 elif m.text.lower() == 'каменная мотыга':259 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'260 'wp-content/uploads/2011/07/ReceptKraft-81.png')261 bot.send_message(m.chat.id, '2 x Булыжник\n2 x Палка')262 elif m.text.lower() == 'железная мотыга':263 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'264 'wp-content/uploads/2011/07/ReceptKraft-78.png')265 bot.send_message(m.chat.id, '2 x Железная руда\n2 x Палка')266 elif m.text.lower() == 'золотая мотыга':267 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'268 'wp-content/uploads/2011/07/ReceptKraft-80.png')269 bot.send_message(m.chat.id, '2 x Золотой слиток\n2 x Палка')270 elif m.text.lower() == 'алмазная мотыга':271 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'272 'wp-content/uploads/2011/07/ReceptKraft-82.png')273 bot.send_message(m.chat.id, '2 x Алмаз\n2 x Палка')274 elif m.text.lower() == 'ведро':275 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'276 'wp-content/uploads/2011/07/ReceptKraft-85.png')277 bot.send_message(m.chat.id, '3 x Железная руда')278 elif m.text.lower() == 'огниво':279 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'280 'wp-content/uploads/2011/07/ReceptKraft-83.png')281 bot.send_message(m.chat.id, '1 x Железный слиток\n1 x Кремень')282 elif m.text.lower() == 'карта':283 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'284 'wp-content/uploads/2011/07/ReceptKraft-87.png')285 bot.send_message(m.chat.id, '8 x Бумага\n1 x Компас')286 elif m.text.lower() == 'компас':287 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'288 'wp-content/uploads/2011/07/ReceptKraft-86.png')289 bot.send_message(m.chat.id, '4 x Железный слиток\n1 x Редстоун')290 elif m.text.lower() == 'часы':291 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'292 'wp-content/uploads/2011/07/ReceptKraft-88.png')293 bot.send_message(m.chat.id, '4 x Золотой слиток\n1 x Редстоун')294 elif m.text.lower() == 'ножницы':295 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'296 'wp-content/uploads/2011/07/ReceptKraft-84.png')297 bot.send_message(m.chat.id, '2 x Железный слиток')298 elif m.text.lower() == 'удочка':299 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'300 'wp-content/uploads/2011/07/ReceptKraft-89.png')301 bot.send_message(m.chat.id, '3 x Палка\n2 x Нить')302 elif m.text.lower() == 'наковальня':303 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'304 'wp-content/uploads/2011/07/ReceptKraft-11.png')305 bot.send_message(m.chat.id, '3 x Железный блок\n4 x Железный слиток')306 elif m.text.lower() == 'меч':307 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'308 'wp-content/uploads/2011/07/ReceptKraft-93.png')309 bot.send_message(m.chat.id, '2 x Дубовые доски\n1 x Палка')310 elif m.text.lower() == 'каменный меч':311 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'312 'wp-content/uploads/2011/07/ReceptKraft-91.png')313 bot.send_message(m.chat.id, '2 x Булыжник\n1 x Палка')314 elif m.text.lower() == 'железный меч':315 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'316 'wp-content/uploads/2011/07/ReceptKraft-92.png')317 bot.send_message(m.chat.id, '2 x Железный слиток\n1 x Палка')318 elif m.text.lower() == 'золотой меч':319 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'320 'wp-content/uploads/2011/07/ReceptKraft-95.png')321 bot.send_message(m.chat.id, '2 x Золотой слиток\n1 x Палка')322 elif m.text.lower() == 'алмазный меч':323 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'324 'wp-content/uploads/2011/07/ReceptKraft-94.png')325 bot.send_message(m.chat.id, '2 x Алмаз\n1 x Палка')326 elif m.text.lower() == 'лук':327 bot.send_photo(m.chat.id, 'https://minecraft-game.ru'328 'wp-content/uploads/2011/07/ReceptKraft-96.png')329 bot.send_message(m.chat.id, '3 x Палка\n3 x Нить')330 elif m.text.lower() == 'шлем':331 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'332 'wp-content/uploads/2011/07/ReceptKraft-99.png')333 bot.send_message(m.chat.id, '5 х кожа')334 elif m.text.lower() == 'нагрудник':335 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'336 'wp-content/uploads/2011/07/ReceptKraft-106.png')337 bot.send_message(m.chat.id, '8 х кожа')338 elif m.text.lower() == 'поножи':339 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'340 'wp-content/uploads/2011/07/ReceptKraft-108.png')341 bot.send_message(m.chat.id, '7 х кожа')342 elif m.text.lower() == 'ботинки':343 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'344 'wp-content/uploads/2011/07/ReceptKraft-113.png')345 bot.send_message(m.chat.id, '4 х кожа')346 elif m.text.lower() == 'железная броня':347 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'348 'wp-content/uploads/2011/07/ReceptKraft-115.png')349 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'350 'wp-content/uploads/2011/07/ReceptKraft-107.png')351 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'352 'wp-content/uploads/2011/07/ReceptKraft-115.png')353 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'354 'wp-content/uploads/2011/07/ReceptKraft-115.png')355356 elif m.text.lower() == 'золотая броня':357 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'358 'wp-content/uploads/2011/07/ReceptKraft-101.png')359 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'360 'wp-content/uploads/2011/07/ReceptKraft-105.png')361 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'362 'wp-content/uploads/2011/07/ReceptKraft-112.png')363 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'364 'wp-content/uploads/2011/07/ReceptKraft-116.png')365366 elif m.text.lower() == 'алмазная броня':367 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'368 'wp-content/uploads/2011/07/ReceptKraft-98.png')369 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'370 'wp-content/uploads/2011/07/ReceptKraft-104.png')371 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'372 'wp-content/uploads/2011/07/ReceptKraft-111.png')373 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'374 'wp-content/uploads/2011/07/ReceptKraft-117.png')375376 elif m.text.lower() == 'рельсы':377 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'378 'wp-content/uploads/2011/07/ReceptKraft-122.png')379 bot.send_message(m.chat.id, '6 x Железный слиток\n1 x Палка')380 elif m.text.lower() == 'энергорельсы':381 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/wp-'382 'content/uploads/2011/07/ReceptKraft-123.png')383 bot.send_message(m.chat.id, '6 x Золотой слиток\n1 x '384 'Палка\n1 x Редстоун')385 elif m.text.lower() == 'вагонетка':386 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'387 'wp-content/uploads/2011/07/ReceptKraft-118.png')388 bot.send_message(m.chat.id, '5 x Железный слиток')389 elif m.text.lower() == 'лодка':390 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'391 'wp-content/uploads/2011/07/ReceptKraft-125.png')392 bot.send_message(m.chat.id, '5 x Доски')393 elif m.text.lower() == 'дверь':394 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'395 'wp-content/uploads/2011/07/ReceptKraft-127.png')396 bot.send_message(m.chat.id, '6 x доски')397 elif m.text.lower() == 'железная дверь':398 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'399 'wp-content/uploads/2011/07/ReceptKraft-128.png')400 bot.send_message(m.chat.id, '6 x Железный слиток')401 elif m.text.lower() == 'люк':402 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'403 'wp-content/uploads/2011/07/ReceptKraft-129.png')404 bot.send_message(m.chat.id, '6 x доски')405 elif m.text.lower() == 'миска':406 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'407 'wp-content/uploads/2011/07/ReceptKraft-148.png')408 bot.send_message(m.chat.id, '3 x Дубовые доски')409 elif m.text.lower() == 'хлеб':410 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'411 'wp-content/uploads/2011/07/ReceptKraft-150.png')412 bot.send_message(m.chat.id, '3 x Пшеница')413 elif m.text.lower() == 'сахар':414 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'415 'wp-content/uploads/2011/07/ReceptKraft-151.png')416 bot.send_message(m.chat.id, '1 х Сахарный тростник')417 elif m.text.lower() == 'печенье':418 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'419 'wp-content/uploads/2011/07/ReceptKraft-153.png')420 bot.send_message(m.chat.id, '2 x Пшеница\n1 x сахар')421 elif m.text.lower() == 'тыквенный пирог':422 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'423 'wp-content/uploads/2011/07/ReceptKraft-158.png')424 bot.send_message(m.chat.id, '1 x Тыква\n1 x Яйцо\n1 x Сахар')425 elif m.text.lower() == 'торт':426 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'427 'wp-content/uploads/2011/07/ReceptKraft-152.png')428 bot.send_message(m.chat.id, '3 x Пшеница\n3 x Ведро молока\n1 x'429 ' Яйцо\n2 x Сахар')430 elif m.text.lower() == 'бумага':431 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'432 'wp-content/uploads/2011/07/ReceptKraft-162.png')433 bot.send_message(m.chat.id, '3 x Сахарный тростник')434 elif m.text.lower() == 'книга':435 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'436 'wp-content/uploads/2011/07/ReceptKraft-163.png')437 bot.send_message(m.chat.id, '1 x Кожа\n3 x Бумага')438 elif m.text.lower() == 'картина':439 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'440 'wp-content/uploads/2011/07/ReceptKraft-159.png')441 bot.send_message(m.chat.id, '1 x Белая шерсть\n8 x Палка')442 elif m.text.lower() == 'кровать':443 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'444 'wp-content/uploads/2011/07/ReceptKraft-170.png')445 bot.send_message(m.chat.id, '3 x Дубовые доски\n3 x Белая шерсть')446 elif m.text.lower() == 'табличка':447 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/'448 'wp-content/uploads/2011/07/ReceptKraft-160.png')449 bot.send_message(m.chat.id, '6 x Дубовые доски\n1 x Палка')450 elif m.text.lower() == 'рельсы':451 bot.send_photo(m.chat.id, 'https://ru-minecraft.ru/uploads/'452 'posts/2011-09/1317410584_craftingminecarttracksio.png')453 bot.send_message(m.chat.id, '6 x Слиток железо\n1 x Палка')454 elif m.text.lower() == 'суп':455 bot.send_photo(m.chat.id, 'https://ru-minecraft.ru/uploads/posts/'456 '2016-09/1473365629_svekolnyy-sup.png')457 bot.send_message(m.chat.id, '1 x Миска\n6 x Свёкл')458 elif m.text.lower() == 'тушенные грибы':459 bot.send_photo(m.chat.id, 'https://ru-minecraft.ru/uploads/posts/'460 '2011-09/1317411186_craftingmushroomstewio.png')461 bot.send_message(m.chat.id, '1 x Коричневый гриб\n1 x Кр'462 'асный гриб\n1 x Миска')463 elif m.text.lower() == 'стрела':464 bot.send_photo(m.chat.id, 'https://ru-minecraft.ru/uploads/posts/'465 '2011-09/1317248394_craftingarrowsio.png')466 bot.send_message(m.chat.id, '1 x Палка\n1 x Перо\n1 x Кремень')467 elif m.text.lower() == 'арбалет':468 bot.send_photo(m.chat.id, 'https://ru-minecraft.ru/uploads/posts/'469 '2019-04/1555988664_16.jpg')470 bot.send_message(m.chat.id, '1 x Крюк\n1 x Железный слито'471 'к\n3 x Палка\n2 x Нить')472 elif m.text.lower() == 'щит':473 bot.send_photo(m.chat.id, 'https://ru-minecraft.ru/uploads/posts/'474 '2016-09/1473364788_schit.png')475 bot.send_message(m.chat.id, '6 x Дубовые доски\n1 x Железный слиток')476 elif m.text.lower() == 'каменный кирпич':477 bot.send_photo(m.chat.id, 'https://ru-minecraft.ru/uploads/posts/'478 '2016-09/1473362396_kamennyy-kirpich.jpg')479 bot.send_message(m.chat.id, '4 x Камень')480 elif m.text.lower() == 'стекло':481 bot.send_photo(m.chat.id, 'http://images.minecraft-book.ru/iblock'482 '/2d1/2d114c8b6ce3b92a273b07fe0d311513.jpeg')483 bot.send_message(m.chat.id, '1 x Песок')484 elif m.text.lower() == 'калитка':485 bot.send_photo(m.chat.id, 'https://ru-minecraft.ru/uploads/posts/'486 '2011-10/1317542136_1316632611_smkll3awny.jpg')487 bot.send_message(m.chat.id, '2 x Дубовые доски\n4 x Палка')488 elif m.text.lower() == 'забор':489 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/wp-content/'490 'uploads/2011/07/ReceptKraft-165.png')491 bot.send_message(m.chat.id, '4 x Дубовые доски\n2 x Палка')492 elif m.text.lower() == 'прутья':493 bot.send_photo(m.chat.id, 'https://minecraft-game.ru/wp-content/'494 'uploads/2011/07/ReceptKraft-169.png')495 bot.send_message(m.chat.id, '6 x Железный слиток')496 elif m.text.lower() == 'поршень':497 bot.send_photo(m.chat.id, 'https://ru-minecraft.ru/uploads/posts'498 '/2011-10/1317541034_41.jpg')499 bot.send_message(m.chat.id, '4 x Булыжник\n3 x Дубовые доски\n1 x'500 ' Железный слиток\n1 x Редстоун')501 elif m.text.lower() == 'рычаг':502 bot.send_photo(m.chat.id, 'https://ru-minecraft.ru/uploads/posts/'503 '2011-09/1317411123_craftingleverio.png')504 bot.send_message(m.chat.id, '1 x Булыжник\n1 x Палка')505 elif m.text.lower() == 'крюк':506 bot.send_photo(m.chat.id, 'https://images.minecraft-book.ru/iblock/'507 '565/56564a145387a4cdff728dc8e1fb2d37.jpeg')508 bot.send_message(m.chat.id, '1 x Дубовые доски\n1 x Железный слиток'509 '\n1 x Палка')510 elif m.text.lower() == 'чистая карта':511 bot.send_photo(m.chat.id, 'https://ru-minecraft.ru/uploads/posts/'512 '2016-09/1473361510_pustaya-karta.jpg')513 bot.send_message(m.chat.id, '8 x Бумага\n1 x Компас')514 elif m.text.lower() == 'семена':515 bot.send_photo(m.chat.id, 'https://ru-minecraft.ru/uploads/po'sts/201'516 '7-05/1496090571_5a81e1b3a5d4577d7f20abff3de68dca.png')517 else:518 bot.send_message(m.chat.id, 'Такой крафт отсутсвует')519520 ...

Full Screen

Full Screen

peer.js

Source:peer.js Github

copy

Full Screen

...146 "socketId": socketId,147 "sdp": session_desc148 }149 that.socket.emit("__answer", data);150 // that.socket.send(JSON.stringify({151 // "eventName": "__answer",152 // "data": {153 // "socketId": socketId,154 // "sdp": session_desc155 // }156 // }));157 }, function(error) {158 console.log(error);159 });160};161//接收到answer类型信令后将对方的session描述写入PeerConnection中162RtcPeer.prototype.receiveAnswer = function(socketId, sdp) {163 console.log("receive the answer from other peers !");164 var pc = this.peerConnections[socketId];165 pc.setRemoteDescription(new RTCSessionDescription(sdp));166};167/***********************点对点连接部分*****************************/168//创建与其他用户连接的PeerConnections169RtcPeer.prototype.createPeerConnections = function() {170 var i, m;171 172 for (i = 0, m = this.peerList.length; i < m; i++) {173 console.log("socket id :",this.peerList[i]);174 this.createPeerConnection(this.peerList[i]);175 }176 console.log("created length of peerConnections: " , this.peerConnections);177};178//创建单个PeerConnection179RtcPeer.prototype.createPeerConnection = function(socketId) {180 console.log("create peer connection successful finish !");181 var that = this;182 var pcConfig = this.pcConfig;183 var pcConstrain = this.pcConstrain;184 //var pc = new PeerConnection(iceServer);185 var pc = new RTCPeerConnection(pcConfig,pcConstrain);186 this.peerConnections[socketId] = pc;187 pc.onicecandidate = function(evt) {188 if (evt.candidate)189 var data = {190 "label": evt.candidate.sdpMLineIndex,191 "candidate": evt.candidate.candidate,192 "socketId": socketId193 }194 that.socket.emit("__ice_candidate", data);195 // that.socket.emit("__ice_candidate", JSON.stringify({196 // "data": {197 // "label": evt.candidate.sdpMLineIndex,198 // "candidate": evt.candidate.candidate,199 // "socketId": socketId200 // }201 // }));202 // that.socket.send(JSON.stringify({203 // "eventName": "__ice_candidate",204 // "data": {205 // "label": evt.candidate.sdpMLineIndex,206 // "candidate": evt.candidate.candidate,207 // "socketId": socketId208 // }209 // }));210 console.log("onicecandidate: network candidates become available and emit __ice_candidate!", socketId);211 //that.emit("pc_get_ice_candidate", evt.candidate, socketId, pc);212 };213 pc.onopen = function() {214 console.log("pc on open !");215 //that.emit("pc_opened", socketId, pc);216 };217 pc.onaddstream = function(evt) {218 console.log("pc.onaddStream: receive video stream from other peer and create video windows !");219 //that.emit('pc_add_stream', evt.stream, socketId, pc);220 };221 pc.ondatachannel = function(evt) {222 console.log("Event : pc on data channel !");223 that.addDataChannel(socketId, evt.channel);224 //that.emit('pc_add_data_channel', evt.channel, socketId, pc);225 };226 return pc;227};228//关闭PeerConnection连接229RtcPeer.prototype.closePeerConnection = function(pc) {230 if (!pc) return;231 pc.close();232};233/***********************数据通道连接部分*****************************/234//消息广播235RtcPeer.prototype.broadcast = function(message) {236 var socketId;237 for (socketId in this.dataChannels) {238 this.sendMessage(message, socketId);239 }240};241//发送消息方法242RtcPeer.prototype.sendMessage = function(message, socketId) {243 if (this.dataChannels[socketId].readyState.toLowerCase() === 'open') {244 console.log("sendMessage: send the message to other peer: " + message);245 this.dataChannels[socketId].send(JSON.stringify({246 type: "__msg",247 data: message248 }));249 }250};251//对所有的PeerConnections创建Data channel252RtcPeer.prototype.addDataChannels = function() {253 var connection;254 var label = "sendDataChannel";255 var dataChannelParms ={orderd:true, reliable:false};256 for (connection in this.peerConnections) {257 console.log("peer connection: ", connection);258 this.createDataChannel(connection, dataChannelParms);259 }260 console.log("check dataChannels: ", this.dataChannels);261};262//对某一个PeerConnection创建Data channel263RtcPeer.prototype.createDataChannel = function(socketId, label, dataChannelParms) {264 var pc, key, channel;265 pc = this.peerConnections[socketId];266 if (!socketId) {267 //this.emit("data_channel_create_error", socketId, new Error("attempt to create data channel without socket id"));268 }269 if (!(pc instanceof RTCPeerConnection)) {270 //this.emit("data_channel_create_error", socketId, new Error("attempt to create data channel without peerConnection"));271 }272 try {273 // var dataChannelParms ={orderd:true, reliable:false};274 channel = pc.createDataChannel(label, dataChannelParms);275 console.log("data channel label : ", label);276 //channel = pc.createDataChannel(label);277 } catch (error) {278 //this.emit("data_channel_create_error", socketId, error);279 }280 return this.addDataChannel(socketId, channel);281};282//为Data channel绑定相应的事件回调函数283RtcPeer.prototype.addDataChannel = function(socketId, channel) {284 var that = this;285 channel.onopen = function() {286 //that.emit('data_channel_opened', channel, socketId);287 };288 channel.onclose = function(event) {289 delete that.dataChannels[socketId];290 //that.emit('data_channel_closed', channel, socketId);291 };292 channel.onmessage = function(message) {293 var json;294 json = JSON.parse(message.data);295 if (json.type === '__file') {296 /*that.receiveFileChunk(json);*/297 that.parseFilePacket(json, socketId);298 } else if (json.type ==='__download_file') {299 that.parseDownloadFilePacket(json, socketId);300 } else {301 console.log("channel.onmessage: get the message from other peer mit channel: " + json.data);302 //that.emit('data_channel_message', channel, socketId, json.data);303 }304 };305 channel.onerror = function(err) {306 //that.emit('data_channel_error', channel, socketId, err);307 };308 this.dataChannels[socketId] = channel;309 return channel;310};311/**********************************************************/312/* */313/* 文件传输 */314/* */315/**********************************************************/316/************************公有部分************************/317//解析Data channel上的文件类型包,来确定信令类型318RtcPeer.prototype.parseFilePacket = function(json, socketId) {319 var signal = json.signal,320 that = this;321 if (signal === 'ask') {322 that.receiveFileAsk(json.sendId, json.name, json.size, socketId);323 } else if (signal === 'accept') {324 that.receiveFileAccept(json.sendId, socketId);325 } else if (signal === 'refuse') {326 that.receiveFileRefuse(json.sendId, socketId);327 } else if (signal === 'chunk') {328 that.receiveFileChunk(json.data, json.sendId, socketId, json.last, json.percent);329 } else if (signal === 'close') {330 //TODO331 }332};333//解析Data channel上的文件类型包,来确定信令类型, 专用于对文件下载的请求334RtcPeer.prototype.parseDownloadFilePacket = function(json, socketId) {335 var signal = json.signal,336 that = this;337 if (signal === 'ask_download') {338 //this mehtode is in peer.js339 that.sendDownloadList(socketId); 340 //that.receiveFileAsk(json.sendId, json.name, json.size, socketId);341 } else if (signal === 'download_list') {342 //this mehtode is in peer.js343 that.showDownloadList(json.data, socketId);344 //that.receiveFileAccept(json.sendId, socketId);345 } else if (signal === 'selected_sendId') {346 that.initSelectedFileToSend(json.sendId, socketId);347 //that.receiveFileRefuse(json.sendId, socketId);348 } else if (signal === 'chunk') {349 that.receiveSelectedFileChunk(json.data, json.sendId, socketId, json.last, json.percent);350 } else if (signal === 'close') {351 //TODO352 }353};354/***********************发送者部分***********************/355//通过Dtata channel向房间内所有其他用户广播文件356RtcPeer.prototype.shareFile = function(dom) {357 var socketId,358 that = this;359 for (socketId in that.dataChannels) {360 that.sendFile(dom, socketId);361 }362};363//向某一单个用户发送文件364RtcPeer.prototype.sendFile = function(dom, socketId) {365 var that = this,366 file,367 reader,368 fileToSend,369 sendId;370 if (typeof dom === 'string') {371 dom = document.getElementById(dom);372 }373 if (!dom) {374 that.cleanSendFile(sendId, socketId);375 //that.emit("send_file_error", new Error("Can not find dom while sending file"), socketId);376 return;377 }378 if (!dom.files || !dom.files[0]) {379 that.cleanSendFile(sendId, socketId);380 //that.emit("send_file_error", new Error("No file need to be sended"), socketId);381 return;382 }383 file = dom.files[0];384 that.fileChannels[socketId] = that.fileChannels[socketId] || {};385 sendId = that.getRandomString();386 fileToSend = {387 file: file,388 state: "ask"389 };390 that.fileChannels[socketId][sendId] = fileToSend;391 that.sendAsk(socketId, sendId, fileToSend);392 //that.emit("send_file", sendId, socketId, file);393};394//发送多个文件的碎片395RtcPeer.prototype.sendFileChunks = function() {396 var socketId,397 sendId,398 that = this,399 nextTick = false;400 for (socketId in that.fileChannels) {401 for (sendId in that.fileChannels[socketId]) {402 if (that.fileChannels[socketId][sendId].state === "send") {403 nextTick = true;404 that.sendFileChunk(socketId, sendId);405 }406 }407 }408 if (nextTick) {409 setTimeout(function() {410 that.sendFileChunks();411 }, 10);412 }413};414// test use the slice file example by google415RtcPeer.prototype.sendFileChunksSlice = function() {416 var socketId,417 sendId,418 that = this;419 var sliceFile = function(offset, sendId, socketId) {420 var reader = new window.FileReader();421 reader.onload = (function() {422 return function(e) {423 424 var packet = {425 type: "__file",426 signal: "chunk",427 sendId: sendId428 };429 var channel = that.dataChannels[socketId];430 if (!channel) {431 //that.cleanSendFile(sendId, socketId);432 //that.emit("send_file_error", new Error("Channel has been destoried"), socketId, sendId, fileToSend.file);433 return;434 }435 fileToSend.sendedPackets++;436 fileToSend.packetsToSend--;437 if (fileToSend.fileData.size > offset + e.target.result.byteLength) {438 packet.last = false;439 packet.percent = fileToSend.sendedPackets / fileToSend.allPackets * 100;440 window.setTimeout(sliceFile, 0, sendId, socketId, offset + that.packetSize);441 } else {442 packet.last = true;443 fileToSend.state = "end";444 //that.emit("sended_file", sendId, socketId, fileToSend.file);445 //that.cleanSendFile(sendId, socketId);446 }447 packet.data = e.target.result;448 channel.send(JSON.stringify(packet));449 };450 })(fileToSend.fileData);451 var slice = fileToSend.fileData.slice(offset, offset + that.packetSize);452 reader.readAsArrayBuffer(slice);453 };454 for (socketId in that.fileChannels) {455 for (sendId in that.fileChannels[socketId]) {456 if (that.fileChannels[socketId][sendId].state === "send") {457 var fileToSend = that.fileChannels[socketId][sendId];458 sliceFile(0, sendId, socketId);459 }460 }461 }462};463//发送某个文件的碎片464RtcPeer.prototype.sendFileChunk = function(socketId, sendId) {465 var that = this,466 packetSize = this.packetSize,467 fileToSend = that.fileChannels[socketId][sendId],468 packet = {469 type: "__file",470 signal: "chunk",471 sendId: sendId472 },473 channel;474 fileToSend.sendedPackets++;475 fileToSend.packetsToSend--;476 if (fileToSend.fileData.length > packetSize) {477 packet.last = false;478 packet.data = fileToSend.fileData.slice(0, packetSize);479 packet.percent = fileToSend.sendedPackets / fileToSend.allPackets * 100;480 updateUploadFileProcess(packet.percent);481 //that.emit("send_file_chunk", sendId, socketId, fileToSend.sendedPackets / fileToSend.allPackets * 100, fileToSend.file);482 } else {483 packet.data = fileToSend.fileData;484 packet.last = true;485 fileToSend.state = "end";486 //that.emit("sended_file", sendId, socketId, fileToSend.file);487 that.cleanSendFile(sendId, socketId);488 }489 // if (fileToSend.fileData.length > packetSize) {490 // packet.last = false;491 // packet.data = fileToSend.fileData.slice(0, packetSize);492 // packet.percent = fileToSend.sendedPackets / fileToSend.allPackets * 100;493 // updateUploadFileProcess(packet.percent);494 // //that.emit("send_file_chunk", sendId, socketId, fileToSend.sendedPackets / fileToSend.allPackets * 100, fileToSend.file);495 // } else {496 // packet.data = fileToSend.fileData;497 // packet.last = true;498 // fileToSend.state = "end";499 // //that.emit("sended_file", sendId, socketId, fileToSend.file);500 // that.cleanSendFile(sendId, socketId);501 // }502 channel = that.dataChannels[socketId];503 if (!channel) {504 that.cleanSendFile(sendId, socketId);505 //that.emit("send_file_error", new Error("Channel has been destoried"), socketId, sendId, fileToSend.file);506 return;507 }508 channel.send(JSON.stringify(packet));509 fileToSend.fileData = fileToSend.fileData.slice(packet.data.length);510};511//发送文件请求后若对方同意接受,开始传输512RtcPeer.prototype.receiveFileAccept = function(sendId, socketId) {513 var that = this,514 packetSize = this.packetSize,515 fileToSend,516 reader,517 initSending = function(event, text) {518 fileToSend.state = "send";519 fileToSend.fileData = event.target.result;520 fileToSend.sendedPackets = 0;521 fileToSend.packetsToSend = fileToSend.allPackets = parseInt(fileToSend.fileData.length / packetSize, 10);522 that.sendFileChunks();523 };524 fileToSend = that.fileChannels[socketId][sendId];525 reader = new window.FileReader(fileToSend.file);526 //reader.readAsArrayBuffer(fileToSend.file);527 reader.readAsDataURL(fileToSend.file);528 reader.onload = initSending;529 //that.emit("send_file_accepted", sendId, socketId, that.fileChannels[socketId][sendId].file);530};531//发送文件请求后若对方拒绝接受,清除掉本地的文件信息532RtcPeer.prototype.receiveFileRefuse = function(sendId, socketId) {533 var that = this;534 that.fileChannels[socketId][sendId].state = "refused";535 //that.emit("send_file_refused", sendId, socketId, that.fileChannels[socketId][sendId].file);536 that.cleanSendFile(sendId, socketId);537};538//清除发送文件缓存539RtcPeer.prototype.cleanSendFile = function(sendId, socketId) {540 var that = this;541 delete that.fileChannels[socketId][sendId];542};543//发送文件请求544RtcPeer.prototype.sendAsk = function(socketId, sendId, fileToSend) {545 var that = this,546 channel = that.dataChannels[socketId],547 packet;548 if (!channel) {549 that.cleanSendFile(sendId, socketId);550 //that.emit("send_file_error", new Error("Channel has been closed"), socketId, sendId, fileToSend.file);551 }552 packet = {553 name: fileToSend.file.name,554 size: fileToSend.file.size,555 sendId: sendId,556 type: "__file",557 signal: "ask"558 };559 channel.send(JSON.stringify(packet));560};561//获得随机字符串来生成文件发送ID562RtcPeer.prototype.getRandomString = function() {563 return (Math.random() * new Date().getTime()).toString(36).toUpperCase().replace(/\./g, '-');564};565/***********************接收者部分***********************/566//接收到文件碎片567RtcPeer.prototype.receiveFileChunk = function(data, sendId, socketId, last, percent) {568 var that = this,569 fileInfo = that.receiveFiles[sendId];570 if (!fileInfo.data) {571 fileInfo.state = "receive";572 fileInfo.data = [];573 //fileInfo.data = "";574 }575 fileInfo.data = fileInfo.data || [];576 fileInfo.data.push(data);577 //fileInfo.data = fileInfo.data || "";578 //fileInfo.data += data;579 if (last) {580 fileInfo.state = "end";581 that.showTransferedFile(sendId);582 //that.getTransferedFile(sendId);583 } else {584 //receive file : todo: Math.cell(percent)%585 console.log("update received file als percent: ", percent);586 updateUploadFileProcess(percent);587 //that.emit("receive_file_chunk", sendId, socketId, fileInfo.name, percent);588 }589};590//接收到所有文件碎片后将其组合成一个完整的文件并显示在云端可供下载591RtcPeer.prototype.showTransferedFile = function(sendId){592 var fileInfo = this.receiveFiles[sendId];593 var fileUrl = 'Click to download \'' + fileInfo.name + '\' (' + fileInfo.size +' bytes)';594 var listitem = '<li class=\"list-group-item\"><a id=\"'+sendId+'\">'+ fileUrl + '</a></li>';595 fileList.append(listitem);596 //var received = new window.Blob(fileInfo.data);597 var received = (fileInfo.data).join("");598 var downloadNode = document.getElementById(sendId); //$("#"+sendId);599 //downloadNode.href = (window.URL || window.webkitURL).createObjectURL(received);600 downloadNode.href = received;601 downloadNode.target = '_blank';602 downloadNode.download = fileInfo.name || dataURL;603 (window.URL || window.webkitURL).revokeObjectURL(downloadNode.href);604 //console.log("test list node:", downloadNode);605 //this.cleanReceiveFile(sendId);606};607//接收到发送文件请求后记录文件信息608RtcPeer.prototype.receiveFileAsk = function(sendId, fileName, fileSize, socketId) {609 var that = this;610 that.receiveFiles[sendId] = {611 socketId: socketId,612 state: "ask",613 name: fileName,614 size: fileSize615 };616 //接受到上传文件的请求,在云端弹出对话框询问617 var confirmToReceiveFile = function(sendId, socketId, fileName, fileSize) {618 //var p;619 if (window.confirm(socketId + "用户想要给你传送" + fileName + "文件,大小" + fileSize + "KB,是否接受?")) {620 that.sendFileAccept(sendId);621 // p = document.createElement("p");622 // p.innerText = "准备接收" + fileName + "文件";623 // p.id = "rf-" + sendId;624 // files.appendChild(p);625 } else {626 that.sendFileRefuse(sendId);627 }628 };629 confirmToReceiveFile(sendId, socketId, fileName, fileSize);630 //that.emit("receive_file_ask", sendId, socketId, fileName, fileSize);631};632//发送同意接收文件信令633RtcPeer.prototype.sendFileAccept = function(sendId) {634 var that = this,635 fileInfo = that.receiveFiles[sendId],636 channel = that.dataChannels[fileInfo.socketId],637 packet;638 if (!channel) {639 that.cleanSendFile(sendId, socketId);640 //that.emit("receive_file_error", new Error("Channel has been destoried"), sendId, socketId);641 }642 packet = {643 type: "__file",644 signal: "accept",645 sendId: sendId646 };647 console.log("Send file Ask successful accepted !");648 channel.send(JSON.stringify(packet));649};650//发送拒绝接受文件信令651RtcPeer.prototype.sendFileRefuse = function(sendId) {652 var that = this,653 fileInfo = that.receiveFiles[sendId],654 channel = that.dataChannels[fileInfo.socketId],655 packet;656 if (!channel) {657 that.cleanSendFile(sendId, socketId);658 //that.emit("receive_file_error", new Error("Channel has been destoried"), sendId, socketId);659 }660 packet = {661 type: "__file",662 signal: "refuse",663 sendId: sendId664 };665 channel.send(JSON.stringify(packet));666 that.cleanReceiveFile(sendId);667};668//清除接受文件缓存669RtcPeer.prototype.cleanReceiveFile = function(sendId) {670 var that = this;671 delete that.receiveFiles[sendId];672};673/**********************************************************/674/* */675/* 提供 mision control 文件下载功能 */676/* */677/**********************************************************/678/*********************** cloud peer ***********************/679//向 mission control 提供可下载文件列表680RtcPeer.prototype.sendDownloadList = function(socketId) {681 var that = this,682 channel = that.dataChannels[socketId],683 sendId,684 fileInfo,685 downloadFiles = [],686 packet;687 if (!channel) {688 // todo : show error689 //that.cleanSendFile(sendId, socketId);690 //that.emit("receive_file_error", new Error("Channel has been destoried"), sendId, socketId);691 }692 //var receiveFiles = that.receiveFiles;693 for (sendId in that.receiveFiles) {694 console.log("show the data in the receiveFiles[sendId]: "+ that.receiveFiles[sendId].data);695 fileInfo = that.receiveFiles[sendId];696 var downloadFile = {697 name: fileInfo.name,698 size: fileInfo.size,699 sendId: sendId700 }701 downloadFiles.push(downloadFile);702 }703 packet = {704 type: "__download_file",705 signal: "download_list",706 data: downloadFiles707 };708 channel.send(JSON.stringify(packet));709 console.log("Send down load file list successful !");710};711// 初始化已选的文件以便于发送712RtcPeer.prototype.initSelectedFileToSend = function(sendId, socketId) {713 var that = this,714 dataForDownload,715 fileToSend,716 sendId;717 that.fileChannels[socketId] = that.fileChannels[socketId] || {};718 // 复制that.receiveFiles[sendId].data 并生成一个新的数组719 dataForDownload = that.receiveFiles[sendId].data.slice();720 // dataForDownload 是一个存放了一段段数据段的数组 721 fileToSend = {722 state: "send",723 fileData: dataForDownload 724 };725 fileToSend.sendedPackets = 0;726 fileToSend.packetsToSend = fileToSend.allPackets = dataForDownload.length;727 //that.sendAsk(socketId, sendId, fileToSend);728 //that.emit("send_file", sendId, socketId, file);729 that.fileChannels[socketId][sendId] = fileToSend;730 that.sendSelectedFileChunks(sendId, socketId);731};732//向 mission control 传输文件 , 每次传送一个chunk733RtcPeer.prototype.sendSelectedFileChunks = function(sendId, socketId) {734 // var socketId,735 // sendId,736 var that = this,737 nextTick = false;738 console.log("that.fileChannels[socketId][sendId]: ", that.fileChannels[socketId][sendId]);739 if (typeof that.fileChannels[socketId][sendId] != 'undefined') {740 if(that.fileChannels[socketId][sendId].state === "send") {741 nextTick = true;742 that.sendSelectedFileChunk(socketId, sendId);743 }744 }745 746 if (nextTick) {747 setTimeout(function() {748 that.sendSelectedFileChunks(sendId, socketId);749 }, 10);750 }751};752//发送某个文件的碎片753RtcPeer.prototype.sendSelectedFileChunk = function(socketId, sendId) {754 var that = this,755 //packetSize = this.packetSize,756 fileToSend = that.fileChannels[socketId][sendId],757 packet = {758 type: "__download_file",759 signal: "chunk",760 sendId: sendId761 },762 channel;763 fileToSend.sendedPackets++;764 fileToSend.packetsToSend--;765 packet.data = fileToSend.fileData.shift();766 packet.percent = fileToSend.sendedPackets / fileToSend.allPackets * 100;767 if(fileToSend.fileData.length > 0){768 packet.last = false;769 //packet.data = fileToSend.fileData.shift();770 771 console.log("send file percent: ", packet.percent);772 //updateUploadFileProcess(packet.percent);773 } else {774 //packet.data = fileToSend.fileData.shift();775 packet.last = true;776 fileToSend.state = "end";777 //that.emit("sended_file", sendId, socketId, fileToSend.file);778 that.cleanSendFile(sendId, socketId);779 }780 channel = that.dataChannels[socketId];781 if (!channel) {782 that.cleanSendFile(sendId, socketId);783 //that.emit("send_file_error", new Error("Channel has been destoried"), socketId, sendId, fileToSend.file);784 return;785 }786 channel.send(JSON.stringify(packet));787 //fileToSend.fileData = fileToSend.fileData.slice(packet.data.length);...

Full Screen

Full Screen

epd2in7.py

Source:epd2in7.py Github

copy

Full Screen

1# *****************************************************************************2# * | File : epd2in7.py3# * | Author : Waveshare team4# * | Function : Electronic paper driver5# * | Info :6# *----------------7# * | This version: V4.08# * | Date : 2019-06-209# # | Info : python demo10# -----------------------------------------------------------------------------11# Permission is hereby granted, free of charge, to any person obtaining a copy12# of this software and associated documnetation files (the "Software"), to deal13# in the Software without restriction, including without limitation the rights14# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell15# copies of the Software, and to permit persons to whom the Software is16# furished to do so, subject to the following conditions:17#18# The above copyright notice and this permission notice shall be included in19# all copies or substantial portions of the Software.20#21# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR22# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,23# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE24# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER25# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,26# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN27# THE SOFTWARE.28#29import logging30from . import epdconfig31# Display resolution32EPD_WIDTH = 17633EPD_HEIGHT = 26434GRAY1 = 0xff #white35GRAY2 = 0xC036GRAY3 = 0x80 #gray37GRAY4 = 0x00 #Blackest38class EPD:39 def __init__(self):40 self.reset_pin = epdconfig.RST_PIN41 self.dc_pin = epdconfig.DC_PIN42 self.busy_pin = epdconfig.BUSY_PIN43 self.cs_pin = epdconfig.CS_PIN44 self.width = EPD_WIDTH45 self.height = EPD_HEIGHT46 self.GRAY1 = GRAY1 #white47 self.GRAY2 = GRAY248 self.GRAY3 = GRAY3 #gray49 self.GRAY4 = GRAY4 #Blackest50 lut_vcom_dc = [0x00, 0x00,51 0x00, 0x08, 0x00, 0x00, 0x00, 0x02,52 0x60, 0x28, 0x28, 0x00, 0x00, 0x01,53 0x00, 0x14, 0x00, 0x00, 0x00, 0x01,54 0x00, 0x12, 0x12, 0x00, 0x00, 0x01,55 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,56 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,57 0x00, 0x00, 0x00, 0x00, 0x00, 0x0058 ]59 lut_ww = [60 0x40, 0x08, 0x00, 0x00, 0x00, 0x02,61 0x90, 0x28, 0x28, 0x00, 0x00, 0x01,62 0x40, 0x14, 0x00, 0x00, 0x00, 0x01,63 0xA0, 0x12, 0x12, 0x00, 0x00, 0x01,64 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,65 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,66 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,67 ]68 lut_bw = [69 0x40, 0x08, 0x00, 0x00, 0x00, 0x02,70 0x90, 0x28, 0x28, 0x00, 0x00, 0x01,71 0x40, 0x14, 0x00, 0x00, 0x00, 0x01,72 0xA0, 0x12, 0x12, 0x00, 0x00, 0x01,73 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,74 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,75 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,76 ]77 lut_bb = [78 0x80, 0x08, 0x00, 0x00, 0x00, 0x02,79 0x90, 0x28, 0x28, 0x00, 0x00, 0x01,80 0x80, 0x14, 0x00, 0x00, 0x00, 0x01,81 0x50, 0x12, 0x12, 0x00, 0x00, 0x01,82 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,83 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,84 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,85 ]86 lut_wb = [87 0x80, 0x08, 0x00, 0x00, 0x00, 0x02,88 0x90, 0x28, 0x28, 0x00, 0x00, 0x01,89 0x80, 0x14, 0x00, 0x00, 0x00, 0x01,90 0x50, 0x12, 0x12, 0x00, 0x00, 0x01,91 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,92 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,93 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,94 ]95 ###################full screen update LUT######################96 #0~3 gray97 gray_lut_vcom = [98 0x00, 0x00,99 0x00, 0x0A, 0x00, 0x00, 0x00, 0x01,100 0x60, 0x14, 0x14, 0x00, 0x00, 0x01,101 0x00, 0x14, 0x00, 0x00, 0x00, 0x01,102 0x00, 0x13, 0x0A, 0x01, 0x00, 0x01,103 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,104 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,105 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 106 ]107 #R21108 gray_lut_ww =[109 0x40, 0x0A, 0x00, 0x00, 0x00, 0x01,110 0x90, 0x14, 0x14, 0x00, 0x00, 0x01,111 0x10, 0x14, 0x0A, 0x00, 0x00, 0x01,112 0xA0, 0x13, 0x01, 0x00, 0x00, 0x01,113 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,114 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,115 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,116 ]117 #R22H r118 gray_lut_bw =[119 0x40, 0x0A, 0x00, 0x00, 0x00, 0x01,120 0x90, 0x14, 0x14, 0x00, 0x00, 0x01,121 0x00, 0x14, 0x0A, 0x00, 0x00, 0x01,122 0x99, 0x0C, 0x01, 0x03, 0x04, 0x01,123 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,124 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,125 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,126 ]127 #R23H w128 gray_lut_wb =[129 0x40, 0x0A, 0x00, 0x00, 0x00, 0x01,130 0x90, 0x14, 0x14, 0x00, 0x00, 0x01,131 0x00, 0x14, 0x0A, 0x00, 0x00, 0x01,132 0x99, 0x0B, 0x04, 0x04, 0x01, 0x01,133 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,134 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,135 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,136 ]137 #R24H b138 gray_lut_bb =[139 0x80, 0x0A, 0x00, 0x00, 0x00, 0x01,140 0x90, 0x14, 0x14, 0x00, 0x00, 0x01,141 0x20, 0x14, 0x0A, 0x00, 0x00, 0x01,142 0x50, 0x13, 0x01, 0x00, 0x00, 0x01,143 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,144 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,145 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,146 ]147 148 # Hardware reset149 def reset(self):150 epdconfig.digital_write(self.reset_pin, 1)151 epdconfig.delay_ms(200) 152 epdconfig.digital_write(self.reset_pin, 0)153 epdconfig.delay_ms(10)154 epdconfig.digital_write(self.reset_pin, 1)155 epdconfig.delay_ms(200) 156 def send_command(self, command):157 epdconfig.digital_write(self.dc_pin, 0)158 epdconfig.digital_write(self.cs_pin, 0)159 epdconfig.spi_writebyte([command])160 epdconfig.digital_write(self.cs_pin, 1)161 def send_data(self, data):162 epdconfig.digital_write(self.dc_pin, 1)163 epdconfig.digital_write(self.cs_pin, 0)164 epdconfig.spi_writebyte([data])165 epdconfig.digital_write(self.cs_pin, 1)166 167 def ReadBusy(self): 168 logging.debug("e-Paper busy")169 while(epdconfig.digital_read(self.busy_pin) == 0): # 0: idle, 1: busy170 epdconfig.delay_ms(200) 171 logging.debug("e-Paper busy release")172 def set_lut(self):173 self.send_command(0x20) # vcom174 for count in range(0, 44):175 self.send_data(self.lut_vcom_dc[count])176 self.send_command(0x21) # ww --177 for count in range(0, 42):178 self.send_data(self.lut_ww[count])179 self.send_command(0x22) # bw r180 for count in range(0, 42):181 self.send_data(self.lut_bw[count])182 self.send_command(0x23) # wb w183 for count in range(0, 42):184 self.send_data(self.lut_bb[count])185 self.send_command(0x24) # bb b186 for count in range(0, 42):187 self.send_data(self.lut_wb[count])188 189 def gray_SetLut(self):190 self.send_command(0x20)191 for count in range(0, 44): #vcom192 self.send_data(self.gray_lut_vcom[count])193 194 self.send_command(0x21) #red not use195 for count in range(0, 42): 196 self.send_data(self.gray_lut_ww[count])197 self.send_command(0x22) #bw r198 for count in range(0, 42): 199 self.send_data(self.gray_lut_bw[count])200 self.send_command(0x23) #wb w201 for count in range(0, 42): 202 self.send_data(self.gray_lut_wb[count])203 self.send_command(0x24) #bb b204 for count in range(0, 42): 205 self.send_data(self.gray_lut_bb[count])206 self.send_command(0x25) #vcom207 for count in range(0, 42): 208 self.send_data(self.gray_lut_ww[count])209 210 def init(self):211 if (epdconfig.module_init() != 0):212 return -1213 214 # EPD hardware init start215 self.reset()216 217 self.send_command(0x01) # POWER_SETTING218 self.send_data(0x03) # VDS_EN, VDG_EN219 self.send_data(0x00) # VCOM_HV, VGHL_LV[1], VGHL_LV[0]220 self.send_data(0x2b) # VDH221 self.send_data(0x2b) # VDL222 self.send_data(0x09) # VDHR223 224 self.send_command(0x06) # BOOSTER_SOFT_START225 self.send_data(0x07)226 self.send_data(0x07)227 self.send_data(0x17)228 229 # Power optimization230 self.send_command(0xF8)231 self.send_data(0x60)232 self.send_data(0xA5)233 234 # Power optimization235 self.send_command(0xF8)236 self.send_data(0x89)237 self.send_data(0xA5)238 239 # Power optimization240 self.send_command(0xF8)241 self.send_data(0x90)242 self.send_data(0x00)243 244 # Power optimization245 self.send_command(0xF8)246 self.send_data(0x93)247 self.send_data(0x2A)248 249 # Power optimization250 self.send_command(0xF8)251 self.send_data(0xA0)252 self.send_data(0xA5)253 254 # Power optimization255 self.send_command(0xF8)256 self.send_data(0xA1)257 self.send_data(0x00)258 259 # Power optimization260 self.send_command(0xF8)261 self.send_data(0x73)262 self.send_data(0x41)263 264 self.send_command(0x16) # PARTIAL_DISPLAY_REFRESH265 self.send_data(0x00)266 self.send_command(0x04) # POWER_ON267 self.ReadBusy()268 self.send_command(0x00) # PANEL_SETTING269 self.send_data(0xAF) # KW-BF KWR-AF BWROTP 0f270 271 self.send_command(0x30) # PLL_CONTROL272 self.send_data(0x3A) # 3A 100HZ 29 150Hz 39 200HZ 31 171HZ273 274 self.send_command(0x82) # VCM_DC_SETTING_REGISTER275 self.send_data(0x12)276 self.set_lut()277 return 0278 def Init_4Gray(self):279 if (epdconfig.module_init() != 0):280 return -1281 self.reset()282 283 self.send_command(0x01) #POWER SETTING284 self.send_data (0x03)285 self.send_data (0x00) 286 self.send_data (0x2b) 287 self.send_data (0x2b) 288 self.send_command(0x06) #booster soft start289 self.send_data (0x07) #A290 self.send_data (0x07) #B291 self.send_data (0x17) #C 292 self.send_command(0xF8) #boost??293 self.send_data (0x60)294 self.send_data (0xA5)295 self.send_command(0xF8) #boost??296 self.send_data (0x89)297 self.send_data (0xA5)298 self.send_command(0xF8) #boost??299 self.send_data (0x90)300 self.send_data (0x00)301 self.send_command(0xF8) #boost??302 self.send_data (0x93)303 self.send_data (0x2A)304 self.send_command(0xF8) #boost??305 self.send_data (0xa0)306 self.send_data (0xa5)307 self.send_command(0xF8) #boost??308 self.send_data (0xa1)309 self.send_data (0x00)310 self.send_command(0xF8) #boost??311 self.send_data (0x73)312 self.send_data (0x41)313 self.send_command(0x16)314 self.send_data(0x00) 315 self.send_command(0x04)316 self.ReadBusy()317 self.send_command(0x00) #panel setting318 self.send_data(0xbf) #KW-BF KWR-AF BWROTP 0f319 self.send_command(0x30) #PLL setting320 self.send_data (0x90) #100hz 321 self.send_command(0x61) #resolution setting322 self.send_data (0x00) #176323 self.send_data (0xb0) 324 self.send_data (0x01) #264325 self.send_data (0x08)326 self.send_command(0x82) #vcom_DC setting327 self.send_data (0x12)328 self.send_command(0X50) #VCOM AND DATA INTERVAL SETTING 329 self.send_data(0x97)330 def getbuffer(self, image):331 # logging.debug("bufsiz = ",int(self.width/8) * self.height)332 buf = [0xFF] * (int(self.width/8) * self.height)333 image_monocolor = image.convert('1')334 imwidth, imheight = image_monocolor.size335 pixels = image_monocolor.load()336 # logging.debug("imwidth = %d, imheight = %d",imwidth,imheight)337 if(imwidth == self.width and imheight == self.height):338 logging.debug("Vertical")339 for y in range(imheight):340 for x in range(imwidth):341 # Set the bits for the column of pixels at the current position.342 if pixels[x, y] == 0:343 buf[int((x + y * self.width) / 8)] &= ~(0x80 >> (x % 8))344 elif(imwidth == self.height and imheight == self.width):345 logging.debug("Horizontal")346 for y in range(imheight):347 for x in range(imwidth):348 newx = y349 newy = self.height - x - 1350 if pixels[x, y] == 0:351 buf[int((newx + newy*self.width) / 8)] &= ~(0x80 >> (y % 8))352 return buf353 354 def getbuffer_4Gray(self, image):355 # logging.debug("bufsiz = ",int(self.width/8) * self.height)356 buf = [0xFF] * (int(self.width / 4) * self.height)357 image_monocolor = image.convert('L')358 imwidth, imheight = image_monocolor.size359 pixels = image_monocolor.load()360 i=0361 # logging.debug("imwidth = %d, imheight = %d",imwidth,imheight)362 if(imwidth == self.width and imheight == self.height):363 logging.debug("Vertical")364 for y in range(imheight):365 for x in range(imwidth):366 # Set the bits for the column of pixels at the current position.367 if(pixels[x, y] == 0xC0):368 pixels[x, y] = 0x80369 elif (pixels[x, y] == 0x80):370 pixels[x, y] = 0x40371 i= i+1372 if(i%4 == 0):373 buf[int((x + (y * self.width))/4)] = ((pixels[x-3, y]&0xc0) | (pixels[x-2, y]&0xc0)>>2 | (pixels[x-1, y]&0xc0)>>4 | (pixels[x, y]&0xc0)>>6)374 375 elif(imwidth == self.height and imheight == self.width):376 logging.debug("Horizontal")377 for x in range(imwidth):378 for y in range(imheight):379 newx = y380 newy = x381 if(pixels[x, y] == 0xC0):382 pixels[x, y] = 0x80383 elif (pixels[x, y] == 0x80):384 pixels[x, y] = 0x40385 i= i+1386 if(i%4 == 0):387 buf[int((newx + (newy * self.width))/4)] = ((pixels[x, y-3]&0xc0) | (pixels[x, y-2]&0xc0)>>2 | (pixels[x, y-1]&0xc0)>>4 | (pixels[x, y]&0xc0)>>6) 388 return buf389 390 def display(self, image):391 self.send_command(0x10)392 for i in range(0, int(self.width * self.height / 8)):393 self.send_data(0xFF)394 self.send_command(0x13)395 for i in range(0, int(self.width * self.height / 8)):396 self.send_data(image[i])397 self.send_command(0x12) 398 self.ReadBusy()399 def display_4Gray(self, image):400 self.send_command(0x10)401 for i in range(0, 5808): #5808*4 46464402 temp3=0403 for j in range(0, 2):404 temp1 = image[i*2+j]405 for k in range(0, 2):406 temp2 = temp1&0xC0 407 if(temp2 == 0xC0):408 temp3 |= 0x01#white409 elif(temp2 == 0x00):410 temp3 |= 0x00 #black411 elif(temp2 == 0x80): 412 temp3 |= 0x01 #gray1413 else: #0x40414 temp3 |= 0x00 #gray2415 temp3 <<= 1 416 417 temp1 <<= 2418 temp2 = temp1&0xC0 419 if(temp2 == 0xC0): #white420 temp3 |= 0x01421 elif(temp2 == 0x00): #black422 temp3 |= 0x00423 elif(temp2 == 0x80):424 temp3 |= 0x01 #gray1425 else : #0x40426 temp3 |= 0x00 #gray2 427 if(j!=1 or k!=1): 428 temp3 <<= 1429 temp1 <<= 2430 self.send_data(temp3)431 432 self.send_command(0x13) 433 for i in range(0, 5808): #5808*4 46464434 temp3=0435 for j in range(0, 2):436 temp1 = image[i*2+j]437 for k in range(0, 2):438 temp2 = temp1&0xC0 439 if(temp2 == 0xC0):440 temp3 |= 0x01#white441 elif(temp2 == 0x00):442 temp3 |= 0x00 #black443 elif(temp2 == 0x80):444 temp3 |= 0x00 #gray1445 else: #0x40446 temp3 |= 0x01 #gray2447 temp3 <<= 1 448 449 temp1 <<= 2450 temp2 = temp1&0xC0 451 if(temp2 == 0xC0): #white452 temp3 |= 0x01453 elif(temp2 == 0x00): #black454 temp3 |= 0x00455 elif(temp2 == 0x80):456 temp3 |= 0x00 #gray1457 else: #0x40458 temp3 |= 0x01 #gray2459 if(j!=1 or k!=1): 460 temp3 <<= 1461 temp1 <<= 2462 self.send_data(temp3)463 464 self.gray_SetLut()465 self.send_command(0x12)466 epdconfig.delay_ms(200)467 self.ReadBusy()468 # pass469 470 def Clear(self, color):471 self.send_command(0x10)472 for i in range(0, int(self.width * self.height / 8)):473 self.send_data(0xFF)474 self.send_command(0x13)475 for i in range(0, int(self.width * self.height / 8)):476 self.send_data(0xFF)477 self.send_command(0x12) 478 self.ReadBusy()479 def sleep(self):480 self.send_command(0X50)481 self.send_data(0xf7)482 self.send_command(0X02)483 self.send_command(0X07)484 self.send_data(0xA5)485 486 epdconfig.module_exit()...

Full Screen

Full Screen

execution.py

Source:execution.py Github

copy

Full Screen

...29 if result == True:30 pass31 else:32 msg_send += result33 itchat.send(msg_send, toUserName='filehelper')34 elif re.match(r"^删除文件\[.*\]", command):35 filename = re.search(r"^删除文件\[(.*?)\]$", command).group(1)36 msg_send += self.DeleteFile(filename)37 itchat.send(msg_send, toUserName='filehelper')38 elif re.match(r"^添加关键词\[.*\]", command):39 keyword = re.search(r"^添加关键词\[(.*?)\]", command).group(1)40 msg_send += self.keyword.AddKeyword(keyword)41 itchat.send(msg_send, toUserName='filehelper')42 elif re.match(r"^删除关键词\[.*\]", command):43 keyword = re.search(r"^删除关键词\[(.*?)\]", command).group(1)44 msg_send += self.keyword.DeleteKeyword(keyword)45 itchat.send(msg_send, toUserName='filehelper')46 elif re.match(r"^撤回附件列表$", command):47 self.ReturnAttachmentList()48 elif re.match(r"^清空附件列表$", command):49 self.ClearAttachmentList()50 elif re.match("^查看关键词$", command):51 msg_send += self.keyword.ShowKeyword()52 itchat.send(msg_send, toUserName='filehelper')53 elif re.match("^清空关键词$", command):54 msg_send += self.keyword.ClearKeyword()55 itchat.send(msg_send, toUserName='filehelper')56 elif re.match("^查看签到口令$", command):57 msg_send += self.snin.ShowComd()58 itchat.send(msg_send, toUserName='filehelper')59 elif re.match("^清空签到口令$", command):60 msg_send += self.snin.ClearComd()61 itchat.send(msg_send, toUserName='filehelper')62 elif re.match("^添加签到口令\[.*?\]$", command):63 mps, cmd = re.search("^添加签到口令\[(.*?):(.*?)\]$", command).group(1, 2)64 self.snin.AddComd(mps, cmd)65 msg_send += "添加签到口令[{}:{}]成功".format(mps, cmd)66 itchat.send(msg_send, toUserName='filehelper')67 elif re.match("^删除签到口令\[.*?\]$", command):68 mps = re.search("^删除签到口令\[(.*?)\]$", command).group(1)69 msg_send += self.snin.DeleteComd(mps)70 itchat.send(msg_send, toUserName='filehelper')71 elif re.match("^截图$", command):72 screenshoot.SC()73 elif re.match("^添加自动回复\[.*?\]$", command):74 keyword, content = re.search("^添加自动回复\[(.*?):(.*?)\]$", command).group(1, 2)75 msg_send += self.reply.AddRule(keyword, content)76 itchat.send(msg_send, toUserName="filehelper")77 elif re.match("^删除自动回复\[.*\]$", command):78 keyword = re.search("^删除自动回复\[(.*?)\]$", command).group(1)79 msg_send += self.reply.DeleteRule(keyword)80 itchat.send(msg_send, toUserName='filehelper')81 elif re.match("^清空自动回复$", command):82 msg_send += self.reply.ClearRule()83 itchat.send(msg_send, toUserName='filehelper')84 elif re.match("^查看自动回复$", command):85 msg_send += self.reply.ShowRule()86 itchat.send(msg_send, toUserName='filehelper')87 elif re.match("^关闭自动回复$", command):88 msg_send += self.reply.CloseAutoReply()89 itchat.send(msg_send, toUserName='filehelper')90 elif re.match("^打开自动回复$", command):91 msg_send += self.reply.OpenAutoReply()92 itchat.send(msg_send, toUserName='filehelper')93 elif re.match("^拍照$", command):94 msg_send+="功能未开发,敬请期待"95 itchat.send(msg_send, toUserName='filehelper')96 """97 img_name = TakePhoto()98 if img_name:99 itchat.send("@img@{}".format(img_name), toUserName='filehelper')100 else:101 msg_send += "拍照失败,请重试"102 itchat.send(msg_send, toUserName='filehelper')103 """104 elif re.match("^拍动图\d{0,2}$", command):105 msg_send+="功能未开发,敬请期待"106 itchat.send(msg_send, toUserName='filehelper')107 """108 seconds = re.findall("^拍动图(\d+)", command)109 if seconds:110 seconds = int(seconds[0])111 if seconds not in range(1, 61):112 msg_send += "时间输入错误,请重试"113 itchat.send(msg_send, toUserName='filehelper')114 return115 else:116 seconds = 5117 img_name = TakeGIF(seconds)118 if img_name:119 itchat.send("@img@{}".format(img_name), toUserName='filehelper')120 else:121 msg_send += "拍照失败,请重试"122 itchat.send(msg_send, toUserName='filehelper')123 """124 elif re.match("^今天吃什么$", command):125 today_choice = random.choice(config.today_menu)126 emotion = random.choice(config.emoticons)127 msg_send += "今天就吃 {} 吧{}{}".format(today_choice, '\n', emotion)128 itchat.send(msg_send, toUserName='filehelper')129 elif re.match("^退出程序$", command):130 itchat.send("退出程序成功", toUserName='filehelper')131 itchat.logout()132 os._exit(0)133 else:134 itchat.send(r"暂时支持以下指令:{1}"135 r"查看/删除文件[文件名]{0}e.g.查看[123345234.mp3]{1}"136 r"撤回附件列表(查看都有哪些保存在电脑中的已撤回附件){1}"137 r"清空附件列表(清空已经保存在电脑中的附件){1}"138 r"添加关键词[关键词]{0}e.g.设置关键词[在不在]{1}"139 r"删除关键词[关键词]{0}e.g.删除关键词[在不在]{1}"140 r"清空关键词 清空已经设置的所有关键词{1}"141 r"查看关键词 查看目前设置的关键词{1}"142 r"添加签到口令[公众号:签到口令]{0}e.g.添加签到口令[招商银行信用卡:签到]{1}"143 r"删除签到口令[公众号]{0}e.g.删除签到口令[招商银行信用卡]{1}"144 r"查看签到口令 查看已经存在的公众和和对应的签到口令{1}"145 r"清空签到口令 清空所有签到口令{1}"146 r"截图 截取运行本程序的机器当前界面{1}"147 r"添加自动回复[针对的关键词:回复内容]{0}e.g.添加自动回复[在不在:我现在有事情,待会儿回复你]{1}"148 r"删除自动回复[针对的关键词]{0}e.g.删除自动回复[在不在]{1}"149 r"清空自动回复{1}"150 r"关闭自动回复{1}"151 r"打开自动回复{1}"152 r"今天吃什么{1}"153 r"退出程序{1}"154 r"其他指令暂不支持,请期待最新版本。".format("\n", "\n\n"),155 toUserName="filehelper")156 def ShowFile(self, filename):157 if not os.path.exists(r"./Revocation/" + filename):158 return "文件:{} 不存在".format(filename)159 if re.search(r"png|jpg|bmp|jpeg|gif|webp", filename):160 msg_type = "img"161 elif re.search(r"avi|rm|mp4|wmv", filename):162 msg_type = "vid"163 else:164 msg_type = "fil"165 itchat.send("@{}@{}".format(msg_type, r"./Revocation/" + filename),166 toUserName="filehelper")167 return True168 def DeleteFile(self, filename):169 if not os.path.exists(r"./Revocation/" + filename):170 return "文件:{} 不存在".format(filename)171 else:172 os.remove(r"./Revocation/" + filename)173 return "文件:{} 删除成功".format(filename)174 def ClearAttachmentList(self):175 if self.REVOCATIONPATH:176 try:177 for item in os.listdir(self.REVOCATIONPATH):178 os.remove(self.REVOCATIONPATH + item)179 msg = "{0}{1}{0}{2}撤回助手:清空附件成功".format(180 "=" * 6, "助手消息", "\n\n")181 itchat.send(msg, toUserName='filehelper')182 except:183 msg = "{0}{1}{0}{2}撤回助手:清空附件失败,请重试".format(184 "=" * 6, "助手消息", "\n\n")185 itchat.send(msg, toUserName='filehelper')186 else:187 msg = "{0}{1}{0}{2}撤回助手:暂时没有附件".format(188 "=" * 6, "助手消息", "\n\n")189 itchat.send(msg, toUserName='filehelper')190 # 返回撤回附件所有文件名191 def ReturnAttachmentList(self):192 if os.listdir(self.REVOCATIONPATH):193 msg_send = r"{0}{1}{0}{2}助手消息:所有储存的附件如下:{3}".format("=" * 6, "助手消息", "\n\n", "\n")194 for item in os.listdir(self.REVOCATIONPATH):195 msg_send += "{} {}".format(item, "\n")196 itchat.send(msg_send, toUserName="filehelper")197 else:198 msg = r"{0}{1}{0}{2}助手消息:暂时没有撤回的附件".format("=" * 6, "助手消息", "\n\n")...

Full Screen

Full Screen

epd1in02.py

Source:epd1in02.py Github

copy

Full Screen

1# *****************************************************************************2# * | File : epd1in54.py3# * | Author : Waveshare team4# * | Function : Electronic paper driver5# * | Info :6# *----------------7# * | This version: V1.08# * | Date : 2019-06-209# # | Info : python demo10# -----------------------------------------------------------------------------11# ******************************************************************************/12# Permission is hereby granted, free of charge, to any person obtaining a copy13# of this software and associated documnetation files (the "Software"), to deal14# in the Software without restriction, including without limitation the rights15# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell16# copies of the Software, and to permit persons to whom the Software is17# furished to do so, subject to the following conditions:18#19# The above copyright notice and this permission notice shall be included in20# all copies or substantial portions of the Software.21#22# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR23# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,24# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE25# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER26# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,27# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN28# THE SOFTWARE.29#30import logging31from . import epdconfig32# Display resolution33EPD_WIDTH = 8034EPD_HEIGHT = 12835class EPD:36 def __init__(self):37 self.reset_pin = epdconfig.RST_PIN38 self.dc_pin = epdconfig.DC_PIN39 self.busy_pin = epdconfig.BUSY_PIN40 self.cs_pin = epdconfig.CS_PIN41 self.width = EPD_WIDTH42 self.height = EPD_HEIGHT43 44 #full screen update LUT45 lut_w1 =[46 0x60, 0x5A, 0x5A, 0x00, 0x00, 0x01, 47 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 48 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 49 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 50 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 51 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 52 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 53 ]54 55 lut_b1 =[56 0x90, 0x5A, 0x5A, 0x00, 0x00, 0x01, 57 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 58 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 59 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 60 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 61 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 62 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 63 ]64 # partial screen update LUT65 lut_w = [66 0x60, 0x01, 0x01, 0x00, 0x00, 0x01, 67 0x80, 0x1f, 0x00, 0x00, 0x00, 0x01, 68 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 69 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 70 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 71 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 72 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 73 ]74 75 lut_b = [76 0x90, 0x01, 0x01, 0x00, 0x00, 0x01, 77 0x40, 0x1f, 0x00, 0x00, 0x00, 0x01, 78 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 79 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 80 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 81 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 82 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 83 ]84 85 # Hardware reset86 def reset(self):87 epdconfig.digital_write(self.reset_pin, 1)88 epdconfig.delay_ms(200) 89 epdconfig.digital_write(self.reset_pin, 0) # module reset90 epdconfig.delay_ms(2)91 epdconfig.digital_write(self.reset_pin, 1)92 epdconfig.delay_ms(200) 93 def send_command(self, command):94 epdconfig.digital_write(self.dc_pin, 0)95 epdconfig.digital_write(self.cs_pin, 0)96 epdconfig.spi_writebyte([command])97 epdconfig.digital_write(self.cs_pin, 1)98 def send_data(self, data):99 epdconfig.digital_write(self.dc_pin, 1)100 epdconfig.digital_write(self.cs_pin, 0)101 epdconfig.spi_writebyte([data])102 epdconfig.digital_write(self.cs_pin, 1)103 104 def ReadBusy(self):105 logging.debug("e-Paper busy")106 self.send_command(0x71)107 busy = epdconfig.digital_read(self.busy_pin)108 busy =not(busy & 0x01)109 while(busy):110 self.send_command(0x71)111 busy = epdconfig.digital_read(self.busy_pin)112 busy =not(busy & 0x01)113 epdconfig.delay_ms(800)114 logging.debug("e-Paper busy release") 115 def TurnOnDisplay(self):116 self.send_command(0x12)117 epdconfig.delay_ms(10)118 self.ReadBusy()119 def SetFulltReg(self):120 self.send_command(0x23)121 for count in range(0, 42):122 self.send_data(self.lut_w1[count]) 123 124 self.send_command(0x24)125 for count in range(0, 42):126 self.send_data(self.lut_b1[count]) 127 def SetPartReg(self):128 self.send_command(0x23)129 for count in range(0, 42):130 self.send_data(self.lut_w[count]) 131 132 self.send_command(0x24)133 for count in range(0, 42):134 self.send_data(self.lut_b[count]) 135 def Init(self):136 if (epdconfig.module_init() != 0):137 return -1138 # EPD hardware init start139 self.reset()140 141 self.send_command(0xD2) 142 self.send_data(0x3F)143 self.send_command(0x00) 144 self.send_data (0x6F) #from outside145 self.send_command(0x01) #power setting146 self.send_data (0x03) 147 self.send_data (0x00)148 self.send_data (0x2b) 149 self.send_data (0x2b) 150 self.send_command(0x06) #Configuring the charge pump151 self.send_data(0x3f)152 self.send_command(0x2A) #Setting XON and the options of LUT153 self.send_data(0x00) 154 self.send_data(0x00) 155 self.send_command(0x30) #Set the clock frequency156 self.send_data(0x17) #50Hz157 self.send_command(0x50) #Set VCOM and data output interval158 self.send_data(0x57) 159 self.send_command(0x60) #Set The non-overlapping period of Gate and Source.160 self.send_data(0x22)161 self.send_command(0x61) #resolution setting162 self.send_data (0x50) #source 128 163 self.send_data (0x80) 164 self.send_command(0x82) #sets VCOM_DC value165 self.send_data(0x12) #-1v166 self.send_command(0xe3)#Set POWER SAVING167 self.send_data(0x33)168 self.SetFulltReg() 169 self.send_command(0x04) #power on170 self.ReadBusy()171 # EPD hardware init end172 return 0173 174 def Partial_Init(self):175 self.reset()176 177 self.send_command(0xD2)178 self.send_data(0x3F)179 self.send_command(0x00)180 self.send_data (0x6F) #from outside181 self.send_command(0x01) #power setting182 self.send_data (0x03)183 self.send_data (0x00)184 self.send_data (0x2b)185 self.send_data (0x2b)186 self.send_command(0x06) #Configuring the charge pump187 self.send_data(0x3f)188 self.send_command(0x2A) #Setting XON and the options of LUT189 self.send_data(0x00)190 self.send_data(0x00)191 self.send_command(0x30) #Set the clock frequency192 self.send_data(0x17)193 self.send_command(0x50) #Set VCOM and data output interval194 self.send_data(0xf2)195 self.send_command(0x60) #Set The non-overlapping period of Gate and Source.196 self.send_data(0x22)197 self.send_command(0x82) #Set VCOM_DC value198 self.send_data(0x12)#-1v199 self.send_command(0xe3)#Set POWER SAVING200 self.send_data(0x33)201 self.SetPartReg() 202 self.send_command(0x04)#Set POWER SAVING 203 self.ReadBusy()204 # EPD hardware init end205 return 0206 207 def getbuffer(self, image):208 buf = [0xFF] * (int(self.width / 8) * self.height)209 image_monocolor = image.convert('1')210 imwidth, imheight = image_monocolor.size211 pixels = image_monocolor.load()212 if(imwidth == self.width and imheight == self.height):213 logging.debug("Horizontal")214 for y in range(imheight):215 for x in range(imwidth):216 # Set the bits for the column of pixels at the current position.217 if pixels[x, y] == 0:218 buf[int((x + y * self.width) / 8)] &= ~(0x80 >> (x % 8))219 elif(imwidth == self.height and imheight == self.width):220 logging.debug("Vertical")221 for y in range(imheight):222 for x in range(imwidth):223 newx = y224 newy = self.height - x - 1225 if pixels[x, y] == 0:226 buf[int((newx + newy*self.width) / 8)] &= ~(0x80 >> (y % 8))227 return buf228 def Display(self, image):229 if (image == None):230 return231 # Width = (self.width % 8 == 0)? (self.width / 8 ): (self.width / 8 + 1)232 if(self.width % 8 == 0):233 Width = self.width / 8234 else:235 Width = self.width / 8 + 1236 237 self.send_command(0x10)238 for j in range(0, self.height):239 for i in range(0, int(Width)):240 self.send_data(0xff) 241 242 self.send_command(0x13)243 for j in range(0, self.height):244 for i in range(0, int(Width)):245 self.send_data(image[i + j * int(Width)]) 246 self.TurnOnDisplay()247 248 def Clear(self):249 # Width = (self.width % 8 == 0)? (self.width / 8 ): (self.width / 8 + 1)250 if(self.width % 8 == 0):251 Width = self.width / 8252 else:253 Width = self.width / 8 + 1254 255 Height = self.height256 257 self.send_command(0x10)258 for j in range(0, Height):259 for i in range(0, int(Width)):260 self.send_data(0x00) 261 262 self.send_command(0x13)263 for j in range(0, Height):264 for i in range(0, int(Width)):265 self.send_data(0xff) 266 self.TurnOnDisplay()267 def DisplayPartial(self, old_Image, Image):268 # Set partial Windows */269 self.send_command(0x91) #This command makes the display enter partial mode270 self.send_command(0x90) #resolution setting271 self.send_data(0) #x-start272 self.send_data(79) #x-end273 self.send_data(0)274 self.send_data(127) #y-end275 self.send_data(0x00)276 277 # Width = (self.width % 8 == 0)? (self.width / 8 ): (self.width / 8 + 1)278 if(self.width % 8 == 0):279 Width = self.width / 8280 else:281 Width = self.width / 8 + 1282 283 Height = self.height284 # send data285 self.send_command(0x10)286 for j in range(0, Height):287 for i in range(0, int(Width)):288 self.send_data(old_Image[i + j * int(Width)])289 self.send_command(0x13)290 for j in range(0, Height):291 for i in range(0, int(Width)):292 self.send_data(Image[i + j * int(Width)])293 # Set partial refresh294 self.TurnOnDisplay()295 def Sleep(self):296 self.send_command(0x50)297 self.send_data(0xf7)298 self.send_command(0x02)299 self.ReadBusy()300 self.send_command(0x07)301 self.send_data(0xA5)302 epdconfig.delay_ms(200)303 epdconfig.module_exit()...

Full Screen

Full Screen

chat_permissions.py

Source:chat_permissions.py Github

copy

Full Screen

1# Pyrogram - Telegram MTProto API Client Library for Python2# Copyright (C) 2017-2020 Dan <https://github.com/delivrance>3#4# This file is part of Pyrogram.5#6# Pyrogram is free software: you can redistribute it and/or modify7# it under the terms of the GNU Lesser General Public License as published8# by the Free Software Foundation, either version 3 of the License, or9# (at your option) any later version.10#11# Pyrogram is distributed in the hope that it will be useful,12# but WITHOUT ANY WARRANTY; without even the implied warranty of13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the14# GNU Lesser General Public License for more details.15#16# You should have received a copy of the GNU Lesser General Public License17# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.18from pyrogram.api import types19from ..object import Object20class ChatPermissions(Object):21 """A chat default permissions and a single member permissions within a chat.22 Some permissions make sense depending on the context: default chat permissions, restricted/kicked member or23 administrators in groups or channels.24 .. note::25 Pyrogram's chat permission are much more detailed. In particular, you can restrict sending stickers, animations,26 games and inline bot results individually, allowing a finer control.27 If you wish to have the same permissions as seen in official apps or in bot API's *"can_send_other_messages"*28 simply set these arguments to True: ``can_send_stickers``, ``can_send_animations``, ``can_send_games`` and29 ``can_use_inline_bots``.30 Parameters:31 can_send_messages (``bool``, *optional*):32 True, if the user is allowed to send text messages, contacts, locations and venues.33 can_send_media_messages (``bool``, *optional*):34 True, if the user is allowed to send audios, documents, photos, videos, video notes and voice notes, implies35 can_send_messages.36 can_send_stickers (``bool``, *optional*):37 True, if the user is allowed to send stickers, implies can_send_media_messages.38 can_send_animations (``bool``, *optional*):39 True, if the user is allowed to send animations (GIFs), implies can_send_media_messages.40 can_send_games (``bool``, *optional*):41 True, if the user is allowed to send games, implies can_send_media_messages.42 can_use_inline_bots (``bool``, *optional*):43 True, if the user is allowed to use inline bots, implies can_send_media_messages.44 can_add_web_page_previews (``bool``, *optional*):45 True, if the user is allowed to add web page previews to their messages, implies can_send_media_messages.46 can_send_polls (``bool``, *optional*):47 True, if the user is allowed to send polls, implies can_send_messages.48 can_change_info (``bool``, *optional*):49 True, if the user is allowed to change the chat title, photo and other settings.50 Ignored in public supergroups.51 can_invite_users (``bool``, *optional*):52 True, if the user is allowed to invite new users to the chat.53 can_pin_messages (``bool``, *optional*):54 True, if the user is allowed to pin messages.55 Ignored in public supergroups.56 """57 def __init__(58 self,59 *,60 can_send_messages: bool = None, # Text, contacts, locations and venues61 can_send_media_messages: bool = None, # Audios, documents, photos, videos, video notes and voice notes62 can_send_stickers: bool = None,63 can_send_animations: bool = None,64 can_send_games: bool = None,65 can_use_inline_bots: bool = None,66 can_add_web_page_previews: bool = None,67 can_send_polls: bool = None,68 can_change_info: bool = None,69 can_invite_users: bool = None,70 can_pin_messages: bool = None71 ):72 super().__init__(None)73 self.can_send_messages = can_send_messages74 self.can_send_media_messages = can_send_media_messages75 self.can_send_stickers = can_send_stickers76 self.can_send_animations = can_send_animations77 self.can_send_games = can_send_games78 self.can_use_inline_bots = can_use_inline_bots79 self.can_add_web_page_previews = can_add_web_page_previews80 self.can_send_polls = can_send_polls81 self.can_change_info = can_change_info82 self.can_invite_users = can_invite_users83 self.can_pin_messages = can_pin_messages84 @staticmethod85 def _parse(denied_permissions: types.ChatBannedRights) -> "ChatPermissions":86 if isinstance(denied_permissions, types.ChatBannedRights):87 return ChatPermissions(88 can_send_messages=not denied_permissions.send_messages,89 can_send_media_messages=not denied_permissions.send_media,90 can_send_stickers=not denied_permissions.send_stickers,91 can_send_animations=not denied_permissions.send_gifs,92 can_send_games=not denied_permissions.send_games,93 can_use_inline_bots=not denied_permissions.send_inline,94 can_add_web_page_previews=not denied_permissions.embed_links,95 can_send_polls=not denied_permissions.send_polls,96 can_change_info=not denied_permissions.change_info,97 can_invite_users=not denied_permissions.invite_users,98 can_pin_messages=not denied_permissions.pin_messages...

Full Screen

Full Screen

__init__.py

Source:__init__.py Github

copy

Full Screen

1# Regen & Mod by @shamilhabeebnelli2# Pyrogram - Telegram MTProto API Client Library for Python3# Copyright (C) 2017-2020 Dan <https://github.com/delivrance>4#5# This file is part of Pyrogram.6#7# Pyrogram is free software: you can redistribute it and/or modify8# it under the terms of the GNU Lesser General Public License as published9# by the Free Software Foundation, either version 3 of the License, or10# (at your option) any later version.11#12# Pyrogram is distributed in the hope that it will be useful,13# but WITHOUT ANY WARRANTY; without even the implied warranty of14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the15# GNU Lesser General Public License for more details.16#17# You should have received a copy of the GNU Lesser General Public License18# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.19from .delete_messages import DeleteMessages20from .download_media import DownloadMedia21from .edit_inline_caption import EditInlineCaption22from .edit_inline_media import EditInlineMedia23from .edit_inline_reply_markup import EditInlineReplyMarkup24from .edit_inline_text import EditInlineText25from .edit_message_caption import EditMessageCaption26from .edit_message_media import EditMessageMedia27from .edit_message_reply_markup import EditMessageReplyMarkup28from .edit_message_text import EditMessageText29from .forward_messages import ForwardMessages30from .get_history import GetHistory31from .get_history_count import GetHistoryCount32from .get_messages import GetMessages33from .iter_history import IterHistory34from .read_history import ReadHistory35from .retract_vote import RetractVote36from .search_global import SearchGlobal37from .search_messages import SearchMessages38from .send_animation import SendAnimation39from .send_audio import SendAudio40from .send_cached_media import SendCachedMedia41from .send_chat_action import SendChatAction42from .send_contact import SendContact43from .send_dice import SendDice44from .send_document import SendDocument45from .send_location import SendLocation46from .send_media_group import SendMediaGroup47from .send_message import SendMessage48from .send_photo import SendPhoto49from .send_poll import SendPoll50from .send_sticker import SendSticker51from .send_venue import SendVenue52from .send_video import SendVideo53from .send_video_note import SendVideoNote54from .send_voice import SendVoice55from .stop_poll import StopPoll56from .vote_poll import VotePoll57class Messages(58 DeleteMessages,59 EditMessageCaption,60 EditMessageReplyMarkup,61 EditMessageMedia,62 EditMessageText,63 ForwardMessages,64 GetHistory,65 GetMessages,66 SendAudio,67 SendChatAction,68 SendContact,69 SendDocument,70 SendAnimation,71 SendLocation,72 SendMediaGroup,73 SendMessage,74 SendPhoto,75 SendSticker,76 SendVenue,77 SendVideo,78 SendVideoNote,79 SendVoice,80 SendPoll,81 VotePoll,82 StopPoll,83 RetractVote,84 DownloadMedia,85 IterHistory,86 SendCachedMedia,87 GetHistoryCount,88 ReadHistory,89 EditInlineText,90 EditInlineCaption,91 EditInlineMedia,92 EditInlineReplyMarkup,93 SendDice,94 SearchMessages,95 SearchGlobal96):...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var devicefarmer = require('devicefarmer-stf');2 if (!error && response.statusCode == 200) {3 }4});5var devicefarmer = require('devicefarmer-stf');6 if (!error && response.statusCode == 200) {7 }8});9var devicefarmer = require('devicefarmer-stf');10 if (!error && response.statusCode == 200) {11 }12});13var devicefarmer = require('devicefarmer-stf');14 if (!error && response.statusCode == 200) {15 }16});17var devicefarmer = require('devicefarmer-stf');18 if (!error

Full Screen

Using AI Code Generation

copy

Full Screen

1var devicefarmer = require('devicefarmer-stf');2device.send('test.png', function(err) {3 if (err) {4 console.error(err);5 } else {6 console.log('Image sent');7 }8});9var devicefarmer = require('devicefarmer-stf');10device.send('test.png', function(err) {11 if (err) {12 console.error(err);13 } else {14 console.log('Image sent');15 }16});17var devicefarmer = require('devicefarmer-stf');18device.send('test.png', function(err) {19 if (err) {20 console.error(err);21 } else {22 console.log('Image sent');23 }24});25var devicefarmer = require('devicefarmer-stf');26device.send('test.png', function(err) {27 if (err) {28 console.error(err);29 } else {30 console.log('Image sent');31 }32});33var devicefarmer = require('devicefarmer-stf');34device.send('test.png', function(err) {35 if (err) {36 console.error(err);37 } else {38 console.log('Image sent');39 }40});41var devicefarmer = require('devicefarmer-stf');42device.send('test.png', function(err) {43 if (err) {44 console.error(err);45 } else {46 console.log('Image sent');47 }48});

Full Screen

Using AI Code Generation

copy

Full Screen

1var DeviceFarmer = require('devicefarmer-stf-client');2var df = new DeviceFarmer();3df.send('test.js', 'C:\\test.js', function(err, data) {4 if (err) {5 console.log(err);6 }7 else {8 console.log(data);9 }10});11var DeviceFarmer = require('devicefarmer-stf-client');12var df = new DeviceFarmer();13df.execute('C:\\test.js', function(err, data) {14 if (err) {15 console.log(err);16 }17 else {18 console.log(data);19 }20});21var DeviceFarmer = require('devicefarmer-stf-client');22var df = new DeviceFarmer();23df.execute('C:\\test.js', function(err, data) {24 if (err) {25 console.log(err);26 }27 else {28 console.log(data);29 }30});31var DeviceFarmer = require('devicefarmer-stf-client');32var df = new DeviceFarmer();33df.remove('C:\\test.js', function(err, data) {34 if (err) {35 console.log(err);36 }37 else {38 console.log(data);39 }40});41var DeviceFarmer = require('devicefarmer-stf-client');42var df = new DeviceFarmer();43df.disconnect(function(err, data) {44 if (err) {45 console.log(err);46 }47 else {48 console.log(data);49 }50});51var DeviceFarmer = require('devicefarmer-stf-client');52var df = new DeviceFarmer();53df.getDevices(function(err, data) {54 if (err) {55 console.log(err);56 }57 else {58 console.log(data);59 }60});61var DeviceFarmer = require('devicefarmer-stf-client');62var df = new DeviceFarmer();

Full Screen

Using AI Code Generation

copy

Full Screen

1var stfModule = require('devicefarmer-stf-module');2var stf = stfModule();3stf.send("test", "test");4var stfModule = require('devicefarmer-stf-module');5var stf = stfModule();6stf.sendByDeviceId("test", "test");7var stfModule = require('devicefarmer-stf-module');8var stf = stfModule();9stf.sendByDeviceName("test", "test");10var stfModule = require('devicefarmer-stf-module');11var stf = stfModule();12stf.sendByDeviceModel("test", "test");

Full Screen

Using AI Code Generation

copy

Full Screen

1var send = require('devicefarmer-stf').send;2var deviceId = 'device id';3var input = {4};5send(deviceId, input, function(err) {6 if (err) {7 console.log(err);8 }9});10var send = require('devicefarmer-stf').send;11var deviceId = 'device id';12var input = {13};14send(deviceId, input, function(err) {15 if (err) {16 console.log(err);17 }18});19var send = require('devicefarmer-stf').send;20var deviceId = 'device id';21var input = {22};23send(deviceId, input, function(err) {24 if (err) {25 console.log(err);26 }27});28var send = require('devicefarmer-stf').send;29var deviceId = 'device id';30var input = {31};32send(deviceId, input, function(err) {33 if (err) {34 console.log(err);35 }36});37var send = require('devicefarmer-stf').send;38var deviceId = 'device id';39var input = {40};41send(deviceId, input, function(err) {42 if (err) {43 console.log(err);44 }45});46var send = require('devicefarmer-stf').send;47var deviceId = 'device id';

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run devicefarmer-stf automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful