Advertisement
ysfysf77

Untitled

Nov 20th, 2019
718
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 91.37 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2.  
  3. from LineAPI.linepy import *
  4. from LineAPI.akad.ttypes import Message
  5. from LineAPI.akad.ttypes import ContentType as Type
  6. from time import sleep
  7. from datetime import datetime, timedelta
  8. from bs4 import BeautifulSoup
  9. from googletrans import Translator
  10. from humanfriendly import format_timespan, format_size, format_number, format_length
  11. from ffmpy import FFmpeg
  12. import time, random, sys, json, codecs, threading, glob, re, string, os, requests, six, ast, pytz, pafy, urllib, urllib3, urllib.parse, traceback, atexit
  13. _session = requests.session()
  14.  
  15. #client = LINE()
  16. client = LINE("EGkeCbbYrzATXqP277i5.IqtJipTzyCWvcrgownX/bq.4XBPsVEgA7026AaR1xRJZwWLKDtGiFZf/u8AzICmhpc=")
  17. clientMid = client.profile.mid
  18. clientProfile = client.getProfile()
  19. clientSettings = client.getSettings()
  20. clientPoll = OEPoll(client)
  21.  
  22. ki = LINE("EGy32Tli1IAzR3aT8Ik0.YH5wDkVOE8aKs/geoBLz8a.nRPBtDxUuCsawDH7fW1ymbcvn9cDOo9Zoch14f5wegs=")
  23. #ki = LINE("EA9ws7qu8xUVtGL188j5.IqtJipTzyCWvcrgownX/bq.yQ/2KgspbDbXYrmE+DatSCSWkwk6kSQInqwG7AvFoEI=")
  24. kiMid = ki.profile.mid
  25. kiProfile = ki.getProfile()
  26. kiSettings = ki.getSettings()
  27. kiPoll = OEPoll(ki)
  28. botStart = time.time()
  29.  
  30. clientMID = client.profile.mid
  31. kiMID = ki.profile.mid
  32. middd = ["u8904e320fb5961cc1509118e58dc7e05"]
  33.  
  34. admin = ["u8904e320fb5961cc1509118e58dc7e05"]
  35.  
  36. msg_dict = {}
  37.  
  38. wordban = []
  39. images = {}
  40.  
  41. settingss = {
  42. "userAgent": [
  43. "Mozilla/5.0 (X11; U; Linux i586; de; rv:5.0) Gecko/20100101 Firefox/5.0",
  44. "Mozilla/5.0 (X11; U; Linux amd64; rv:5.0) Gecko/20100101 Firefox/5.0 (Debian)",
  45. "Mozilla/5.0 (X11; U; Linux amd64; en-US; rv:5.0) Gecko/20110619 Firefox/5.0",
  46. "Mozilla/5.0 (X11; Linux) Gecko Firefox/5.0",
  47. "Mozilla/5.0 (X11; Linux x86_64; rv:5.0) Gecko/20100101 Firefox/5.0 FirePHP/0.5",
  48. "Mozilla/5.0 (X11; Linux x86_64; rv:5.0) Gecko/20100101 Firefox/5.0 Firefox/5.0",
  49. "Mozilla/5.0 (X11; Linux x86_64) Gecko Firefox/5.0",
  50. "Mozilla/5.0 (X11; Linux ppc; rv:5.0) Gecko/20100101 Firefox/5.0",
  51. "Mozilla/5.0 (X11; Linux AMD64) Gecko Firefox/5.0",
  52. "Mozilla/5.0 (X11; FreeBSD amd64; rv:5.0) Gecko/20100101 Firefox/5.0",
  53. "Mozilla/5.0 (Windows NT 6.2; WOW64; rv:5.0) Gecko/20100101 Firefox/5.0",
  54. "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:5.0) Gecko/20110619 Firefox/5.0",
  55. "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:5.0) Gecko/20100101 Firefox/5.0",
  56. "Mozilla/5.0 (Windows NT 6.1; rv:6.0) Gecko/20100101 Firefox/5.0",
  57. "Mozilla/5.0 (Windows NT 6.1.1; rv:5.0) Gecko/20100101 Firefox/5.0",
  58. "Mozilla/5.0 (Windows NT 5.2; WOW64; rv:5.0) Gecko/20100101 Firefox/5.0",
  59. "Mozilla/5.0 (Windows NT 5.1; U; rv:5.0) Gecko/20100101 Firefox/5.0",
  60. "Mozilla/5.0 (Windows NT 5.1; rv:2.0.1) Gecko/20100101 Firefox/5.0",
  61. "Mozilla/5.0 (Windows NT 5.0; WOW64; rv:5.0) Gecko/20100101 Firefox/5.0",
  62. "Mozilla/5.0 (Windows NT 5.0; rv:5.0) Gecko/20100101 Firefox/5.0"
  63. ]
  64. }
  65.  
  66. settings = {
  67. "autoAdd": True,
  68. "autoJoin": True,
  69. "autoJoin2": True,
  70. "autoLeave": False,
  71. "autoRead": False,
  72. "autoRespon": False,
  73. "autoJoinTicket": True,
  74. "checkContact": False,
  75. "checkPost": False,
  76. "checkSticker": False,
  77. "suf": True,
  78. "simsimi": False,
  79. "ya": True,
  80. "lang": "JP",
  81. "changeVideoProfile": False,
  82. "changeVideoProfile2": False,
  83. "ChangeVideoProfilePicture": False,
  84. "ChangeVideoProfilePicture2": False,
  85. "changePictureProfile2": False,
  86. "ChangeVideoProfilevid": False,
  87. "ChangeVideoProfilevid2": False,
  88. "changePictureProfile": False,
  89. "cgp": False,
  90. "testo": False,
  91. "cgp2": False,
  92. "userMentioned": True,
  93. "changeGroupPicture": [],
  94. "changeGroupPicture2": [],
  95. "keyCommand": "",
  96. "myProfile": {
  97. "displayName": "",
  98. "coverId": "",
  99. "pictureStatus": "",
  100. "statusMessage": ""
  101. },
  102. "Addsticker":{
  103. "name": "",
  104. "status":False
  105. },
  106. "stk":{},
  107. "selfbot":True,
  108. "Images":{},
  109. "Img":{},
  110. "Addimage":{
  111. "name": "",
  112. "status":False
  113. },
  114. "Videos":{},
  115. "Addaudio":{
  116. "name": "",
  117. "status":False
  118. },
  119. "Addvideo":{
  120. "name": "",
  121. "status":False
  122. },
  123. "mimic": {
  124. "copy": False,
  125. "status": False,
  126. "target": {}
  127. },
  128. "setKey": False,
  129. "unsendMessage": False
  130. }
  131.  
  132. read = {
  133. "ROM": {},
  134. "readPoint": {},
  135. "readMember": {},
  136. "readTime": {}
  137. }
  138.  
  139. Setmain = {
  140. "ayam": {},
  141. "spaminv": {},
  142. }
  143.  
  144.  
  145. list_language = {
  146. "list_textToSpeech": {
  147. "id": "Indonesia",
  148. "af" : "Afrikaans",
  149. "sq" : "Albanian",
  150. "ar" : "Arabic",
  151. "hy" : "Armenian",
  152. "bn" : "Bengali",
  153. "ca" : "Catalan",
  154. "zh" : "Chinese",
  155. "zh-cn" : "Chinese (Mandarin/China)",
  156. "zh-tw" : "Chinese (Mandarin/Taiwan)",
  157. "zh-yue" : "Chinese (Cantonese)",
  158. "hr" : "Croatian",
  159. "cs" : "Czech",
  160. "da" : "Danish",
  161. "nl" : "Dutch",
  162. "en" : "English",
  163. "en-au" : "English (Australia)",
  164. "en-uk" : "English (United Kingdom)",
  165. "en-us" : "English (United States)",
  166. "eo" : "Esperanto",
  167. "fi" : "Finnish",
  168. "fr" : "French",
  169. "de" : "German",
  170. "el" : "Greek",
  171. "hi" : "Hindi",
  172. "hu" : "Hungarian",
  173. "is" : "Icelandic",
  174. "id" : "Indonesian",
  175. "it" : "Italian",
  176. "ja" : "Japanese",
  177. "km" : "Khmer (Cambodian)",
  178. "ko" : "Korean",
  179. "la" : "Latin",
  180. "lv" : "Latvian",
  181. "mk" : "Macedonian",
  182. "no" : "Norwegian",
  183. "pl" : "Polish",
  184. "pt" : "Portuguese",
  185. "ro" : "Romanian",
  186. "ru" : "Russian",
  187. "sr" : "Serbian",
  188. "si" : "Sinhala",
  189. "sk" : "Slovak",
  190. "es" : "Spanish",
  191. "es-es" : "Spanish (Spain)",
  192. "es-us" : "Spanish (United States)",
  193. "sw" : "Swahili",
  194. "sv" : "Swedish",
  195. "ta" : "Tamil",
  196. "th" : "Thai",
  197. "tr" : "Turkish",
  198. "uk" : "Ukrainian",
  199. "vi" : "Vietnamese",
  200. "cy" : "Welsh"
  201. },
  202. "list_translate": {
  203. "af": "afrikaans",
  204. "sq": "albanian",
  205. "am": "amharic",
  206. "ar": "arabic",
  207. "hy": "armenian",
  208. "az": "azerbaijani",
  209. "eu": "basque",
  210. "be": "belarusian",
  211. "bn": "bengali",
  212. "bs": "bosnian",
  213. "bg": "bulgarian",
  214. "ca": "catalan",
  215. "ceb": "cebuano",
  216. "ny": "chichewa",
  217. "zh-cn": "chinese (simplified)",
  218. "zh-tw": "chinese (traditional)",
  219. "co": "corsican",
  220. "hr": "croatian",
  221. "cs": "czech",
  222. "da": "danish",
  223. "nl": "dutch",
  224. "en": "english",
  225. "eo": "esperanto",
  226. "et": "estonian",
  227. "tl": "filipino",
  228. "fi": "finnish",
  229. "fr": "french",
  230. "fy": "frisian",
  231. "gl": "galician",
  232. "ka": "georgian",
  233. "de": "german",
  234. "el": "greek",
  235. "gu": "gujarati",
  236. "ht": "haitian creole",
  237. "ha": "hausa",
  238. "haw": "hawaiian",
  239. "iw": "hebrew",
  240. "hi": "hindi",
  241. "hmn": "hmong",
  242. "hu": "hungarian",
  243. "is": "icelandic",
  244. "ig": "igbo",
  245. "id": "indonesian",
  246. "ga": "irish",
  247. "it": "italian",
  248. "ja": "japanese",
  249. "jw": "javanese",
  250. "kn": "kannada",
  251. "kk": "kazakh",
  252. "km": "khmer",
  253. "ko": "korean",
  254. "ku": "kurdish (kurmanji)",
  255. "ky": "kyrgyz",
  256. "lo": "lao",
  257. "la": "latin",
  258. "lv": "latvian",
  259. "lt": "lithuanian",
  260. "lb": "luxembourgish",
  261. "mk": "macedonian",
  262. "mg": "malagasy",
  263. "ms": "malay",
  264. "ml": "malayalam",
  265. "mt": "maltese",
  266. "mi": "maori",
  267. "mr": "marathi",
  268. "mn": "mongolian",
  269. "my": "myanmar (burmese)",
  270. "ne": "nepali",
  271. "no": "norwegian",
  272. "ps": "pashto",
  273. "fa": "persian",
  274. "pl": "polish",
  275. "pt": "portuguese",
  276. "pa": "punjabi",
  277. "ro": "romanian",
  278. "ru": "russian",
  279. "sm": "samoan",
  280. "gd": "scots gaelic",
  281. "sr": "serbian",
  282. "st": "sesotho",
  283. "sn": "shona",
  284. "sd": "sindhi",
  285. "si": "sinhala",
  286. "sk": "slovak",
  287. "sl": "slovenian",
  288. "so": "somali",
  289. "es": "spanish",
  290. "su": "sundanese",
  291. "sw": "swahili",
  292. "sv": "swedish",
  293. "tg": "tajik",
  294. "ta": "tamil",
  295. "te": "telugu",
  296. "th": "thai",
  297. "tr": "turkish",
  298. "uk": "ukrainian",
  299. "ur": "urdu",
  300. "uz": "uzbek",
  301. "vi": "vietnamese",
  302. "cy": "welsh",
  303. "xh": "xhosa",
  304. "yi": "yiddish",
  305. "yo": "yoruba",
  306. "zu": "zulu",
  307. "fil": "Filipino",
  308. "he": "Hebrew"
  309. }
  310. }
  311.  
  312. try:
  313. with open("Log_data.json","r",encoding="utf_8_sig") as f:
  314. msg_dict = json.loads(f.read())
  315. except:
  316. print("Couldn't read Log data")
  317.  
  318. settings["myProfile"]["displayName"] = clientProfile.displayName
  319. settings["myProfile"]["statusMessage"] = clientProfile.statusMessage
  320. settings["myProfile"]["pictureStatus"] = clientProfile.pictureStatus
  321. coverId = client.getProfileDetail()["result"]["objectId"]
  322. settings["myProfile"]["coverId"] = coverId
  323.  
  324. imagesOpen = codecs.open("image.json","r","utf-8")
  325. images = json.load(imagesOpen)
  326.  
  327. stickersOpen = codecs.open("sticker.json","r","utf-8")
  328. stickers = json.load(stickersOpen)
  329.  
  330. def restartBot():
  331. print ("[ INFO ] BOT RESTART")
  332. python = sys.executable
  333. os.execl(python, python, *sys.argv)
  334.  
  335.  
  336. def logError(text):
  337. client.log("[ ERROR ] {}".format(str(text)))
  338. tz = pytz.timezone("Asia/Jakarta")
  339. timeNow = datetime.now(tz=tz)
  340. timeHours = datetime.strftime(timeNow,"(%H:%M)")
  341. day = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday","Friday", "Saturday"]
  342. hari = ["Minggu", "Senin", "Selasa", "Rabu", "Kamis", "Jumat", "Sabtu"]
  343. bulan = ["Januari", "Februari", "Maret", "April", "Mei", "Juni", "Juli", "Agustus", "September", "Oktober", "November", "Desember"]
  344. inihari = datetime.now(tz=tz)
  345. hr = inihari.strftime('%A')
  346. bln = inihari.strftime('%m')
  347. for i in range(len(day)):
  348. if hr == day[i]: hasil = hari[i]
  349. for k in range(0, len(bulan)):
  350. if bln == str(k): bln = bulan[k-1]
  351. time = "{}, {} - {} - {} | {}".format(str(hasil), str(inihari.strftime('%d')), str(bln), str(inihari.strftime('%Y')), str(inihari.strftime('%H:%M:%S')))
  352. with open("logError.txt","a") as error:
  353. error.write("\n[ {} ] {}".format(str(time), text))
  354.  
  355. def cTime_to_datetime(unixtime):
  356. return datetime.fromtimestamp(int(str(unixtime)[:len(str(unixtime))-3]))
  357. def dt_to_str(dt):
  358. return dt.strftime('%H:%M:%S')
  359.  
  360. def delete_log():
  361. ndt = datetime.now()
  362. for data in msg_dict:
  363. if (datetime.utcnow() - cTime_to_datetime(msg_dict[data]["createdTime"])) > timedelta(1):
  364. if "path" in msg_dict[data]:
  365. client.deleteFile(msg_dict[data]["path"])
  366. del msg_dict[data]
  367.  
  368. def sendSticker(to, version, packageId, stickerId):
  369. contentMetadata = {
  370. 'STKVER': version,
  371. 'STKPKGID': packageId,
  372. 'STKID': stickerId
  373. }
  374. client.sendMessage(to, '', contentMetadata, 7)
  375.  
  376. def sendMention(to, text="", mids=[]):
  377. arrData = ""
  378. arr = []
  379. mention = "@zeroxyuuki "
  380. if mids == []:
  381. raise Exception("Invalid mids")
  382. if "@!" in text:
  383. if text.count("@!") != len(mids):
  384. raise Exception("Invalid mids")
  385. texts = text.split("@!")
  386. textx = ""
  387. for mid in mids:
  388. textx += str(texts[mids.index(mid)])
  389. slen = len(textx)
  390. elen = len(textx) + 15
  391. arrData = {'S':str(slen), 'E':str(elen - 4), 'M':mid}
  392. arr.append(arrData)
  393. textx += mention
  394. textx += str(texts[len(mids)])
  395. else:
  396. textx = ""
  397. slen = len(textx)
  398. elen = len(textx) + 15
  399. arrData = {'S':str(slen), 'E':str(elen - 4), 'M':mids[0]}
  400. arr.append(arrData)
  401. textx += mention + str(text)
  402. ki.sendMessage(to, textx, {'MENTION': str('{"MENTIONEES":' + json.dumps(arr) + '}')}, 0)
  403.  
  404. def sendMessageWithMention(to, mid):
  405. try:
  406. aa = '{"S":"0","E":"3","M":'+json.dumps(mid)+'}'
  407. text_ = '@x '
  408. client.sendMessage(to, text_, contentMetadata={'MENTION':'{"MENTIONEES":['+aa+']}'}, contentType=0)
  409. except Exception as error:
  410. logError(error)
  411.  
  412. def userMentioned(to):
  413. try:
  414. mid = []
  415. for lu in settings["userMentioned"][to]:
  416. mid.append(lu)
  417. arrData = ""
  418. textx = "???[ List User ]\n".format(str(len(mid)))
  419. arr = []
  420. no = 0 + 1
  421. for i in mid:
  422. textx += "? {}. ".format(str(no))
  423. mention = "@x "
  424. slen = str(len(textx))
  425. elen = str(len(textx) + len(mention) - 1)
  426. arrData = {'S':slen, 'E':elen, 'M':i}
  427. arr.append(arrData)
  428. textx += mention
  429. textx += "#{}x\n".format(str(settings["userMentioned"][to][i]))
  430. no += 1
  431. textx += "[ Total {} User ]".format(str(len(mid)))
  432. settings["userMentioned"][to] = {}
  433. client.sendMessage(to, textx, {'MENTION': str('{"MENTIONEES":' + json.dumps(arr) + '}')}, 0)
  434. except Exception as error:
  435. logError(error)
  436.  
  437. def command(text):
  438. pesan = text.lower()
  439. if settings["setKey"] == True:
  440. if pesan.startswith(settings["keyCommand"]):
  441. cmd = pesan.replace(settings["keyCommand"],"")
  442. else:
  443. cmd = "Undefined command"
  444. else:
  445. cmd = text.lower()
  446. return cmd
  447. def removeCmd(cmd, text):
  448. key = settings["keyCommand"]
  449. if settings["setKey"] == False: key = ''
  450. rmv = len(key + cmd) + 1
  451. return text[rmv:]
  452.  
  453. #Dont sell it fcking bitch *Akhirnya bisa bhs inggris
  454. def changeVideoAndPictureProfile(pict, vids):
  455. try:
  456. files = {'file': open(vids, 'rb')}
  457. obs_params = client.genOBSParams({'oid': clientMID, 'ver': '2.0', 'type': 'video', 'cat': 'vp.mp4', 'name': 'Hello_World.mp4'})
  458. data = {'params': obs_params}
  459. r_vp = client.server.postContent('{}/talk/vp/upload.nhn'.format(str(client.server.LINE_OBS_DOMAIN)), data=data, files=files)
  460. if r_vp.status_code != 201:
  461. return "Failed update profile"
  462. client.updateProfilePicture(pict, 'vp')
  463. return "Success update profile"
  464. except Exception as e:
  465. raise Exception("Error change video and picture profile %s"%str(e))
  466.  
  467. def youtubeMp4(to, link):
  468. r = requests.get("http://api.zicor.ooo/yt.php?url={}".format(str(link)))
  469. data = r.text
  470. data = json.loads(data)
  471. ki.sendVideoWithURL(to, data["mp4"]["720"])
  472.  
  473. def changeVideoAndPictureProfile2(pict, vids):
  474. try:
  475. files = {'file': open(vids, 'rb')}
  476. obs_params = ki.genOBSParams({'oid': kiMID, 'ver': '2.0', 'type': 'video', 'cat': 'vp.mp4', 'name': 'Hello_World.mp4'})
  477. data = {'params': obs_params}
  478. r_vp = ki.server.postContent('{}/talk/vp/upload.nhn'.format(str(ki.server.LINE_OBS_DOMAIN)), data=data, files=files)
  479. if r_vp.status_code != 201:
  480. return "Failed update profile"
  481. ki.updateProfilePicture(pict, 'vp')
  482. return "Success update profile"
  483. except Exception as e:
  484. raise Exception("Error change video and picture profile %s"%str(e))
  485.  
  486. def clientBot(op):
  487. try:
  488. if op.type == 0:
  489. return
  490.  
  491. if op.type == 5:
  492. print ("[ 5 ] NOTIFIED ADD CONTACT")
  493. if settings["autoAdd"] == True:
  494. client.getContact(op.param1)
  495. a = "c4d8782318fde5433690531f21cd32d4b"
  496. client.sendContact(a, op.param1)
  497. client.sendMessage(a, "add")
  498.  
  499. if op.type == 13:
  500. print ("[ 13 ] NOTIFIED INVITE INTO GROUP")
  501. group = client.getGroup(op.param1)
  502. if settings["autoJoin"] and clientMID in op.param3:
  503. client.acceptGroupInvitation(op.param1)
  504.  
  505. if op.type == 13:
  506. print ("[ 13 ] NOTIFIED INVITE INTO GROUP")
  507. group = ki.getGroup(op.param1)
  508. if settings["autoJoin2"] and kiMID in op.param3:
  509. ki.acceptGroupInvitation(op.param1)
  510.  
  511. if op.type in [22, 24]:
  512. print ("[ 22 And 24 ] NOTIFIED INVITE INTO ROOM & NOTIFIED LEAVE ROOM")
  513. if settings["autoLeave"] == True:
  514. client.leaveRoom(op.param1)
  515.  
  516. if op.type == 25 or op.type == 26:
  517. try:
  518. msg = op.message
  519. text = msg.text
  520. msg_id = msg.id
  521. receiver = msg.to
  522. sender = msg._from
  523. setKey = settings["keyCommand"].title()
  524. if settings["setKey"] == False:
  525. setKey = ''
  526. if msg.toType == 0 or msg.toType == 1 or msg.toType == 2:
  527. if msg.toType == 0:
  528. if sender != client.profile.mid:
  529. to = sender
  530. else:
  531. to = receiver
  532. elif msg.toType == 1:
  533. to = receiver
  534. elif msg.toType == 2:
  535. to = receiver
  536. if msg.contentType == 0:
  537. if text is None:
  538. return
  539. else:
  540. for image in images:
  541. if sender in admin:
  542. if text.lower() == image:
  543. ki.sendImage(msg.to, images[image])
  544. cmd = command(text)
  545. if cmd == "983jwmslsuahoihelp":
  546. helpMessage = helpmessage()
  547. ki.sendMessage(to, str(helpMessage))
  548. elif cmd.startswith("baksksmdurjsend "):
  549. sep = text.split(" ")
  550. args = text.replace(sep[0] + " ","")
  551. mes = int(sep[1])
  552. #try:
  553. #mes = int(args[1])
  554. #except:
  555. #mes = 1
  556. M = client.getRecentMessagesV2(to, 1001)
  557. MId = []
  558. for ind,i in enumerate(M):
  559. if ind == 0:
  560. pass
  561. else:
  562. if i._from == client.profile.mid:
  563. MId.append(i.id)
  564. if len(MId) == mes:
  565. break
  566. def unsMes(id):
  567. client.unsendMessage(id)
  568. for i in MId:
  569. thread1 = threading.Thread(target=unsMes, args=(i,))
  570. thread1.daemon = True
  571. thread1.start()
  572. thread1.join()
  573. client.sendMessage(to, "succes unsend {} messages".format(len(MId)))
  574. elif cmd.startswith("ytmp4: "):
  575. if sender in admin:
  576. try:
  577. sep = msg.text.split(" ")
  578. textToSearch = msg.text.replace(sep[0] + " ","")
  579. query = urllib.parse.quote(textToSearch)
  580. search_url="https://www.youtube.com/results?search_query="
  581. mozhdr = {'User-Agent': 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3'}
  582. sb_url = search_url + query
  583. sb_get = requests.get(sb_url, headers = mozhdr)
  584. soupeddata = BeautifulSoup(sb_get.content, "html.parser")
  585. yt_links = soupeddata.find_all("a", class_ = "yt-uix-tile-link")
  586. x = (yt_links[1])
  587. yt_href = x.get("href")
  588. yt_href = yt_href.replace("watch?v=", "")
  589. qx = "https://youtu.be" + str(yt_href)
  590. vid = pafy.new(qx)
  591. stream = vid.streams
  592. best = vid.getbest()
  593. best.resolution, best.extension
  594. for s in stream:
  595. me = best.url
  596. client.sendMessage(to, "wait")
  597. client.sendVideoWithURL(to, me)
  598. break
  599. except Exception as e:
  600. client.sendMessage(to,str(e))
  601. elif cmd.startswith("youtubemp4 ") and sender == clientMID:
  602. try:
  603. link = removeCmd("youtubemp4", text)
  604. r = _session.get('http://api.corrykalam.net/apimp4.php?link='+link)
  605. data = r.text
  606. ki.sendVideoWithURL(to,str(data))
  607. except Exception as e:
  608. ki.sendMessage(to,str(e))
  609. elif cmd == "runtime":
  610. if msg._from in admin:
  611. timeNow = time.time()
  612. runtime = timeNow - botStart
  613. runtime = format_timespan(runtime)
  614. client.sendMessage(to, "Bot sudah berjalan selama {}".format(str(runtime)))
  615. elif cmd.startswith("yt "):
  616. if sender in admin:
  617. try:
  618. link = msg.text.replace("yt ","")
  619. youtubeMp4(to, link)
  620. except Exception as e:
  621. ki.sendMessage(to,str(e))
  622. elif cmd == "restart":
  623. if msg._from in admin:
  624. ki.sendMessage(to, "Berhasil merestart Bot")
  625. restartBot()
  626. elif cmd == "changeevp":
  627. if sender in admin:
  628. imag = "tmp/imag.jpg"
  629. vids = "tmp/download.mp4"
  630. changeVideoAndPictureProfile(imag, vids)
  631. print("succesa")
  632. elif cmd == "changeevp2":
  633. if sender in admin:
  634. imag = "tmp/imag.jpg"
  635. vids = "tmp/downloads.mp4"
  636. changeVideoAndPictureProfile(imag, vids)
  637. print("succesa")
  638. elif cmd in ["about kizuna","about trapchan"]:
  639. try:
  640. arr = []
  641. owner = "u8904e320fb5961cc1509118e58dc7e05"
  642. creator = ki.getContact(owner)
  643. contact = ki.getContact(kiMID)
  644. grouplist = ki.getGroupIdsJoined()
  645. contactlist = ki.getAllContactIds()
  646. blockedlist = ki.getBlockedContactIds()
  647. ret_ = "「 About @! 」"
  648. ret_ += "\n Name : {}".format(contact.displayName)
  649. ret_ += "\n Group : {}".format(str(len(grouplist)))
  650. ret_ += "\n Friend : {} ".format(str(len(contactlist)))
  651. ret_ += "\n Blocked : 736 "
  652. sendMention(to, str(ret_), [kiMID])
  653. except Exception as e:
  654. ki.sendMessage(msg.to, str(e))
  655. # Pembatas Script #
  656. elif cmd == "autoadd on":
  657. if sender in admin:
  658. settings["autoAdd"] = True
  659. ki.sendMessage(to, "Berhasil mengaktifkan auto add")
  660. elif cmd == "autoadd off":
  661. if sender in admin:
  662. settings["autoAdd"] = False
  663. ki.sendMessage(to, "Berhasil mengaktifkan auto add")
  664. elif cmd == "autojoin on":
  665. if sender in admin:
  666. settings["autoJoin"] = True
  667. ki.sendMessage(to, "Berhasil mengaktifkan auto join")
  668. elif cmd == "autojoin off":
  669. if sender in admin:
  670. settings["autoJoin"] = False
  671. ki.sendMessage(to, "Berhasil menonaktifkan auto join")
  672. elif cmd == "ya on":
  673. if sender in admin:
  674. settings["ya"] = True
  675. ki.sendMessage(to, "Berhasil mengaktifkan sc")
  676. elif cmd == "ya off":
  677. if sender in admin:
  678. settings["ya"] = False
  679. ki.sendMessage(to, "Berhasil menonaktifkan sc")
  680. elif cmd == "autoleave on":
  681. if sender in admin:
  682. settings["autoLeave"] = True
  683. ki.sendMessage(to, "Berhasil mengaktifkan auto leave")
  684. elif cmd == "autoleave off":
  685. if sender in admin:
  686. settings["autoLeave"] = False
  687. ki.sendMessage(to, "Berhasil menonaktifkan auto leave")
  688. elif cmd == "autorespon on":
  689. if sender in admin:
  690. settings["autoRespon"] = True
  691. ki.sendMessage(to, "Berhasil mengaktifkan auto respon")
  692. elif cmd == "autorespon off":
  693. if sender in admin:
  694. settings["autoRespon"] = False
  695. ki.sendMessage(to, "Berhasil menonaktifkan auto respon")
  696. elif cmd == "checksticker on":
  697. if sender in admin:
  698. settings["checkSticker"] = True
  699. ki.sendMessage(to, "Berhasil mengaktifkan check sticker")
  700. elif cmd == "checksticker off":
  701. if sender in admin:
  702. settings["checkSticker"] = False
  703. ki.sendMessage(to, "Berhasil menonaktifkan check sticker")
  704. elif cmd == "autoread on":
  705. if sender in admin:
  706. settings["autoRead"] = True
  707. ki.sendMessage(to, "Berhasil mengaktifkan auto read")
  708. elif cmd == "autoread off":
  709. if sender in admin:
  710. settings["autoRead"] = False
  711. ki.sendMessage(to, "Berhasil menonaktifkan auto read")
  712. elif cmd == "autojointicket on":
  713. if msg._from in admin:
  714. settings["autoJoinTicket"] = True
  715. ki.sendMessage(to, "Berhasil mengaktifkan auto join by ticket")
  716. elif cmd == "autoJoinTicket off":
  717. if msg._from in admin:
  718. settings["autoJoinTicket"] = False
  719. ki.sendMessage(to, "Berhasil menonaktifkan auto join by ticket")
  720. elif cmd == "checkcontact on":
  721. if sender in admin:
  722. settings["checkContact"] = True
  723. ki.sendMessage(to, "Berhasil mengaktifkan check details contact")
  724. elif cmd == "checkcontact off":
  725. if sender in admin:
  726. settings["checkContact"] = False
  727. ki.sendMessage(to, "Berhasil menonaktifkan check details contact")
  728. elif cmd == "men on":
  729. if sender in admin:
  730. settings["userMentioned"] = True
  731. ki.sendMessage(to, "Berhasil mengaktifkan check details contact")
  732. elif cmd == "men off":
  733. if sender in admin:
  734. settings["userMentioned"] = False
  735. ki.sendMessage(to, "Berhasil menonaktifkan check details contact")
  736. elif cmd == "cgp on":
  737. if sender in admin:
  738. settings["cgp"] = True
  739. ki.sendMessage(to, "cgp on ")
  740. elif cmd == "cgp off":
  741. if sender in admin:
  742. settings["cgp"] = False
  743. ki.sendMessage(to, "cgp off")
  744. elif cmd == "checkpost on":
  745. if sender in admin:
  746. settings["checkPost"] = True
  747. ki.sendMessage(to, "Berhasil mengaktifkan check details post")
  748. elif cmd == "checkpost off":
  749. if sender in admin:
  750. settings["checkPost"] = False
  751. ki.sendMessage(to, "Berhasil menonaktifkan check details post")
  752. elif cmd == "cgp2 on":
  753. if sender in admin:
  754. settings["cgp2"] = True
  755. ki.sendMessage(to, "Berhasil mengaktifkan cgp2")
  756. elif cmd == "cgp2 off":
  757. if sender in admin:
  758. settings["cgp2"] = False
  759. ki.sendMessage(to, "Berhasil menonaktifkan cgp2")
  760. elif cmd == "unsendchat on":
  761. if sender in admin:
  762. settings["unsendMessage"] = True
  763. ki.sendMessage(to, "Berhasil mengaktifkan unsend message")
  764. elif cmd == "unsendchat off":
  765. if sender in admin:
  766. settings["unsendMessage"] = False
  767. ki.sendMessage(to, "Berhasil menonaktifkan unsend message")
  768. elif cmd == "suf on":
  769. if sender in admin:
  770. settings["suf"] = True
  771. ki.sendMessage(to, "Berhasil mengaktifkan suf message")
  772. elif cmd == "suf off":
  773. if sender in admin:
  774. settings["suf"] = False
  775. ki.sendMessage(to, "Berhasil menonaktifkan suf message")
  776. elif cmd == "status":
  777. if sender in admin:
  778. try:
  779. ret_ = "╔══[ Status ]"
  780. if settings["cgp"] == True: ret_ += "\n╠══[ ON ] cgp"
  781. else: ret_ += "\n╠══[ OFF ] cgp"
  782. if settings["cgp2"] == True: ret_ += "\n╠══[ ON ] cgp2"
  783. else: ret_ += "\n╠══[ OFF ] cgp2"
  784. ret_ += "\n╚══[ Status ]"
  785. ki.sendMessage(to, str(ret_))
  786. except Exception as e:
  787. ki.sendMessage(msg.to, str(e))
  788. # Pembatas Script #
  789. elif cmd == "me":
  790. if sender in admin:
  791. sendMention(to, "@!", [sender])
  792. ki.sendContact(to, sender)
  793. elif cmd == "haibc":
  794. if sender in admin:
  795. groups = client.getGroupIdsJoined()
  796. for group in groups:
  797. sid = "52002734"
  798. spkg = "11537"
  799. sver = "1"
  800. sendSticker(group, sver, spkg, sid)
  801. elif cmd == "mymid":
  802. if sender in admin:
  803. client.sendMessage(to, "[ MID ]\n{}".format(sender))
  804. elif cmd == "myname":
  805. if sender in admin:
  806. contact = client.getContact(sender)
  807. client.sendMessage(to, "[ Display Name ]\n{}".format(contact.displayName))
  808. elif cmd == "mybio":
  809. if sender in admin:
  810. contact = client.getContact(sender)
  811. client.sendMessage(to, "[ Status Message ]\n{}".format(contact.statusMessage))
  812. elif cmd == "mypicture":
  813. if sender in admin:
  814. contact = client.getContact(sender)
  815. client.sendImageWithURL(to,"http://dl.profile.line-cdn.net/{}".format(contact.pictureStatus))
  816. elif cmd == "myvideoprofile":
  817. if msg._from in admin:
  818. contact = client.getContact(sender)
  819. client.sendVideoWithURL(to,"http://dl.profile.line-cdn.net/{}/vp".format(contact.pictureStatus))
  820. elif cmd == "mycover":
  821. if sender in admin:
  822. channel = client.getProfileCoverURL(sender)
  823. path = str(channel)
  824. client.sendImageWithURL(to, path)
  825. elif cmd in ["gpct","trapchan gpicture"]:
  826. if msg._from in admin:
  827. group = client.getGroup(to)
  828. path = "http://dl.profile.line-cdn.net/" + group.pictureStatus
  829. client.sendImageWithURL(to, path)
  830. elif cmd == "my ticket":
  831. if sender in admin:
  832. client.sendMessage(to, '? Your Ticket ?\nhttp://line.me/ti/p/{}'.format(client.getUserTicket().id))
  833. elif cmd == "changedp":
  834. if msg._from in admin:
  835. settings["changePictureProfile"] = True
  836. client.sendMessage(to, "Silahkan kirim gambarnya")
  837. elif cmd in ["kizuna changedp","trapchan changedp"]:
  838. if msg._from in admin:
  839. settings["changePictureProfile2"] = True
  840. client.sendMessage(to, "Silahkan kirim gambarnya")
  841. elif cmd == "kizuna cvp":
  842. if msg._from in admin:
  843. settings["ChangeVideoProfilevid2"] = True
  844. client.sendMessage(to, "「Profile 」\nType : Change Profile Video Picture\nStatus : Send the video...")
  845. elif cmd == "cvp":
  846. if msg._from in admin:
  847. settings["ChangeVideoProfilevid"] = True
  848. client.sendMessage(to, "「Profile 」\nType : Change Profile Video Picture\nStatus : Send the video....")
  849.  
  850. elif cmd == 'gcreator':
  851. if msg._from in admin:
  852. group = ki.getGroup(to)
  853. GS = group.creator.mid
  854. ki.sendContact(to, GS)
  855. elif msg.text.lower().startswith("invallgrup"):
  856. if msg._from in admin:
  857. a = "u8904e320fb5961cc1509118e58dc7e05"
  858. groups = ki.getGroupIdsJoined()
  859. for group in groups:
  860. ki.inviteIntoGroup(group, [a])
  861. print ("sure")
  862. elif msg.text.lower().startswith("kick "):
  863. if msg._from in admin:
  864. targets = []
  865. key = eval(msg.contentMetadata["MENTION"])
  866. key["MENTIONEES"][0]["M"]
  867. for x in key["MENTIONEES"]:
  868. targets.append(x["M"])
  869. for target in targets:
  870. try:
  871. ki.kickoutFromGroup(msg.to,[target])
  872. except Exception as e:
  873. client.sendMessage(to,str(e))
  874. elif cmd == 'inv:gcreator':
  875. if msg.toType == 2:
  876. ginfo = ki.getGroup(msg.to)
  877. gCreator = ginfo.creator.mid
  878. try:
  879. ki.findAndAddContactsByMid(gCreator)
  880. ki.inviteIntoGroup(msg.to,[gCreator])
  881. print ("success inv gCreator")
  882. except:
  883. pass
  884. print("a")
  885. elif cmd == 'lgid':
  886. gid = ki.getGroupIdsJoined()
  887. h = ""
  888. for i in gid:
  889. h += "[%s]: %s\n" % (ki.getGroup(i).name,i)
  890. ki.sendMessage(msg.to,h)
  891. elif "Inviteme: " in msg.text:
  892. a = "u8904e320fb5961cc1509118e58dc7e05"
  893. gid = msg.text.replace("Inviteme: ","")
  894. if gid == "":
  895. ki.sendMessage(msg.to,"Invalid group id")
  896. else:
  897. try:
  898. ki.inviteIntoGroup(gid, [a])
  899. except Exception as e:
  900. ki.sendMessage(msg.to," "+str(e))
  901. elif "leave: " in msg.text:
  902. gid = msg.text.replace("leave: ","")
  903. if gid == "":
  904. ki.sendMessage(msg.to,"Invalid group id")
  905. else:
  906. try:
  907. ki.leaveGroup(gid)
  908. except Exception as e:
  909. ki.sendMessage(msg.to," "+str(e))
  910. elif cmd in ["kizuna mention","trapchan mention"]:
  911. if msg._from in admin:
  912. group = ki.getGroup(msg.to)
  913. nama = [contact.mid for contact in group.members]
  914. k = len(nama)//100
  915. for a in range(k+1):
  916. txt = u''
  917. s=0
  918. b=[]
  919. for i in group.members[a*100 : (a+1)*100]:
  920. b.append({"S":str(s), "E" :str(s+6), "M":i.mid})
  921. s += 7
  922. txt += u'@Zero \n'
  923. ki.sendMessage(to, text=txt, contentMetadata={u'MENTION': json.dumps({'MENTIONEES':b})}, contentType=0)
  924. ki.sendMessage(to, "Total {} Members".format(str(len(nama))))
  925. elif cmd.startswith("spam1: "):
  926. if msg._from in admin:
  927. proses = text.split(":")
  928. strnum = text.replace(proses[0] + ":","")
  929. num = int(strnum)
  930. Setmain["spaminv"] = num
  931. ki.sendMessage(msg.to,"[ Status spaminv ]\nBerhasil diubah jadi {} kali".format(str(strnum)))
  932. elif cmd.startswith("accept"):
  933. if msg._from in admin:
  934. gid = ki.getGroupIdsInvited()
  935. _list = ""
  936. for i in gid:
  937. if i is not None:
  938. gids = ki.getGroup(i)
  939. _list += gids.name
  940. ki.acceptGroupInvitation(i)
  941. else:
  942. break
  943. if gid is not None:
  944. ki.sendMessage(msg.to,"")
  945. else:
  946. ki.sendMessage(msg.to,"success")
  947. elif cmd == 'grouplistt':
  948. groups = ki.getGroupIdsJoined()
  949. ret_ = "Group List"
  950. no = 0 + 1
  951. for gid in groups:
  952. group = ki.getGroup(gid)
  953. ret_ += "\n {}. {} - {} \n".format(str(no), str(group.name), str(len(group.members)))
  954. no += 1
  955. ret_ += "\nTotal {} Groups ".format(str(len(groups)))
  956. ki.sendMessage(to, str(ret_))
  957. elif cmd == "cancelll":
  958. ginvited = ki.getGroupIdsInvited()
  959. if ginvited != [] and ginvited != None:
  960. for gid in ginvited:
  961. ki.rejectGroupInvitation(gid)
  962. ki.sendMessage(to, "Berhasil tolak sebanyak {} undangan".format(str(len(ginvited))))
  963. else:
  964. ki.sendMessage(to, "Tidak ada undangan yang tertunda")
  965. # Pembatas Script #
  966. elif cmd.startswith("kizuna getpp"):
  967. if 'MENTION' in msg.contentMetadata.keys()!= None:
  968. names = re.findall(r'@(\w+)', text)
  969. mention = ast.literal_eval(msg.contentMetadata['MENTION'])
  970. mentionees = mention['MENTIONEES']
  971. lists = []
  972. for mention in mentionees:
  973. if mention["M"] not in lists:
  974. lists.append(mention["M"])
  975. for ls in lists:
  976. contact = ki.getContact(ls)
  977. path = "http://dl.profile.line.naver.jp/{}".format(contact.pictureStatus)
  978. ki.sendImageWithURL(to, str(path))
  979. elif cmd.startswith("kizuna getvp "):
  980. if 'MENTION' in msg.contentMetadata.keys()!= None:
  981. names = re.findall(r'@(\w+)', text)
  982. mention = ast.literal_eval(msg.contentMetadata['MENTION'])
  983. mentionees = mention['MENTIONEES']
  984. lists = []
  985. for mention in mentionees:
  986. if mention["M"] not in lists:
  987. lists.append(mention["M"])
  988. for ls in lists:
  989. contact = ki.getContact(ls)
  990. path = "http://dl.profile.line.naver.jp/{}/vp".format(contact.pictureStatus)
  991. ki.sendVideoWithURL(to, str(path))
  992. elif cmd.startswith("tag: "):
  993. if msg._from in admin:
  994. proses = text.split(":")
  995. strnum = text.replace(proses[0] + ":","")
  996. num = int(strnum)
  997. Setmain["ayam"] = num
  998. ki.sendMessage(msg.to,"[ Status Spamtag ]\nBerhasil diubah jadi {} kali".format(str(strnum)))
  999. elif cmd == "changegp":
  1000. groups = client.getGroupIdsJoined()
  1001. path = "tmp/imag.jpg"
  1002. suf = "c9fb488a705e71a7f6cb18b0e71d7df81","c6efe5167f75de0b0896846326d8ba412","ca077aa5d4af433c80d62c2345856f4db","c864161c44bd67504fd24ecd5ca580996","ca71f99f204324345a87c08b711a3295f","cdf2c132a0ad424e050f4d82baaf4273c","c0b1b02c15ae8d88ed3bd85c3d4903e2e"
  1003. for group in groups:
  1004. if group not in suf:
  1005. a = "4"
  1006. b = "8373"
  1007. c = "16027837"
  1008. d = "4"
  1009. e = "8373"
  1010. f = "16027843"
  1011. g = "4"
  1012. h = "8373"
  1013. i = "16027856"
  1014. client.updateGroupPicture(group, path)
  1015. sendSticker(group, a, b, c)
  1016. sendSticker(group, d, e, f)
  1017. sendSticker(group, g, h, i)
  1018. print("succes")
  1019. elif cmd == 'lgid2':
  1020. gid = client.getGroupIdsJoined()
  1021. h = ""
  1022. for i in gid:
  1023. h += "[%s]: %s\n" % (ki.getGroup(i).name,i)
  1024. client.sendMessage(msg.to,h)
  1025. elif cmd == "changegp2":
  1026. groups = ki.getGroupIdsJoined()
  1027. suf = "c3a9bee36dc1429897cd3be32e865cacc","cc6892822f8ca2e672738ce2a6d651c12","cf90006140e44749a54d0272f79fe6bee","cdbd3aecda8fe118e0dde9372fc2fe559"
  1028. for group in groups:
  1029. if group in suf:
  1030. path = "max100/tmp/cover.jpg"
  1031. ki.updateGroupPicture(group, path)
  1032. print("done")
  1033. elif "tag @" in msg.text:
  1034. if msg._from in admin:
  1035. _name = msg.text.replace("tag @","")
  1036. _nametarget = _name.rstrip(' ')
  1037. gs = ki.getGroup(msg.to)
  1038. for g in gs.members:
  1039. if _nametarget == g.displayName:
  1040. jmlh = int(Setmain["ayam"])
  1041. if jmlh <= 1000:
  1042. for x in range(jmlh):
  1043. try:
  1044. sendMention(to, "@!",[g.mid])
  1045. except Exception as e:
  1046. ki.sendMessage(msg.to,str(e))
  1047. else:
  1048. pass
  1049. elif "tag hai @" in msg.text:
  1050. if msg._from in admin:
  1051. _name = msg.text.replace("tag hai @","")
  1052. _nametarget = _name.rstrip(' ')
  1053. gs = ki.getGroup(msg.to)
  1054. for g in gs.members:
  1055. if _nametarget == g.displayName:
  1056. jmlh = int(Setmain["ayam"])
  1057. if jmlh <= 1000:
  1058. for x in range(jmlh):
  1059. try:
  1060. sendMention(to, "@! hai",[g.mid])
  1061. except Exception as e:
  1062. ki.sendMessage(msg.to,str(e))
  1063. else:
  1064. pass
  1065. elif cmd.startswith("kizuna getcover "):
  1066. if ki != None:
  1067. if 'MENTION' in msg.contentMetadata.keys()!= None:
  1068. names = re.findall(r'@(\w+)', text)
  1069. mention = ast.literal_eval(msg.contentMetadata['MENTION'])
  1070. mentionees = mention['MENTIONEES']
  1071. lists = []
  1072. for mention in mentionees:
  1073. if mention["M"] not in lists:
  1074. lists.append(mention["M"])
  1075. for ls in lists:
  1076. channel = ki.getProfileCoverURL(ls)
  1077. path = str(channel)
  1078. elif msg.text.lower().startswith("grupbc: "):
  1079. if msg._from in admin:
  1080. sep = text.split(" ")
  1081. txt = text.replace(sep[0] + " ","")
  1082. groups = ki.getGroupIdsJoined()
  1083. for group in groups:
  1084. ki.sendMessage(group, "{}".format(str(txt)))
  1085. ki.sendMessage(to, "Berhasil broadcast ke {} group".format(str(len(groups))))
  1086. elif cmd in ["tertag."] and sender == clientMID:
  1087. if to in settings["userMentioned"]:
  1088. if settings["userMentioned"][to] != {}:
  1089. userMentioned(to)
  1090. else:
  1091. client.sendMessage(to, "Tidak ada yang ngetag")
  1092. else:
  1093. client.sendMessage(to, "Tidak ada yang ngetag")
  1094. elif cmd.startswith("postig "):
  1095. user = removeCmd("postig", text)
  1096. profile = "https://www.instagram.com/" + user
  1097. with _session as x:
  1098. x.headers['user-agent'] = 'Mozilla/5.0'
  1099. end_cursor = ''
  1100. for count in range(1, 50):
  1101. r = x.get(profile, params={'max_id': end_cursor})
  1102. data = re.search(r'window._sharedData = (\{.+?});</script>', r.text).group(1)
  1103. j = json.loads(data)
  1104. for node in j['entry_data']['ProfilePage'][0]['user']['media']['nodes']:
  1105. if node['is_video']:
  1106. page = 'https://www.instagram.com/p/' + node['code']
  1107. r = x.get(page)
  1108. url = re.search(r'"video_url": "([^"]+)"', r.text).group(1)
  1109. print(url)
  1110. client.sendVideoWithURL(msg.to,url)
  1111. else:
  1112. print (node['display_src'])
  1113. client.sendImageWithURL(msg.to,node['display_src'])
  1114. end_cursor = re.search(r'"end_cursor": "([^"]+)"', r.text).group(1)
  1115. elif cmd.startswith("kizuna ssweb"):
  1116. if msg._from in admin:
  1117. try:
  1118. sep = text.split(" ")
  1119. query = text.replace(sep[0] + " ","")
  1120. r = requests.get("http://rahandiapi.herokuapp.com/sswebAPI?key=betakey&link={}".format(urllib.parse.quote(query)))
  1121. data = r.text
  1122. data = json.loads(data)
  1123. ki.sendImageWithURL(to, data["result"])
  1124. except Exception as error:
  1125. logError(error)
  1126. elif cmd in ["kizuna invgcall","trapchan invgcall"]:
  1127. if msg._from in admin:
  1128. if msg.toType == 2:
  1129. sep = text.split(" ")
  1130. strnum = text.replace(sep[0] + " ","")
  1131. num = int(strnum)
  1132. for var in range(0,num):
  1133. group = ki.getGroup(to)
  1134. members = [mem.mid for mem in group.members]
  1135. ki.acquireGroupCallRoute(to)
  1136. ki.inviteIntoGroupCall(to, contactIds=members)
  1137. #ki.sendMessage(to, "Berhasil mengundang kedalam telponan group")
  1138. elif text.lower() == 'rejectall':
  1139. ginvited = client.ginvited
  1140. if ginvited != [] and ginvited != None:
  1141. for gid in ginvited:
  1142. client.rejectGroupInvitation(gid)
  1143. client.sendMessage(to, "Berhasil tolak sebanyak {} undangan grup".format(str(len(ginvited))))
  1144. else:
  1145. client.sendMessage(to, "Tidak ada undangan yang tertunda")
  1146. elif text.startswith("imagetext"):
  1147. if msg._from in admin:
  1148. sep = text.split(" ")
  1149. textnya = text.replace(sep[0] + " ","")
  1150. url = "http://chart.apis.google.com/chart?chs=480x80&cht=p3&chtt=" + textnya + "&chts=FFFFFF,70&chf=bg,s,000000"
  1151. ki.sendImageWithURL(msg.to, url)
  1152. elif cmd in ["kizuna invite","trapchan invite"]:
  1153. if msg._from in admin:
  1154. key = msg.text[-33:]
  1155. ki.findAndAddContactsByMid(key)
  1156. ki.inviteIntoGroup(msg.to, [key])
  1157. contact = ki.getContact(key)
  1158. elif cmd.startswith("searchanime "):
  1159. if msg._from in admin:
  1160. sep = msg.text.split(" ")
  1161. anime = msg.text.replace(sep[0] + " ","%20")
  1162. with requests.session() as web:
  1163. web.headers["user-agent"] = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36"
  1164. r = web.get("https://kitsu.io/api/edge/anime?filter[text]={}".format(urllib.parse.quote(anime)))
  1165. data = r.text
  1166. data = json.loads(data)
  1167. ret_ = ''
  1168. if data["data"] != []:
  1169. for a in data["data"]:
  1170. if a["attributes"]["subtype"] == "TV":
  1171. sin = a["attributes"]["synopsis"]
  1172. translator = Translator()
  1173. hasil = translator.translate(sin, dest='id')
  1174. sinop = hasil.text
  1175. ret_ += 'Anime : {} '.format(str(a["attributes"]["canonicalTitle"]))
  1176. ret_ += '\nRilis : '+str(a["attributes"]["startDate"])
  1177. ret_ += '\nRating : '+str(a["attributes"]["ratingRank"])
  1178. ret_ += '\nType : '+str(a["attributes"]["subtype"])
  1179. ret_ += '\nSinopsis :\n'+str(sinop)
  1180. ret_ += '\n\n'
  1181. ki.sendImageWithURL(msg.to, str(a["attributes"]["posterImage"]["small"]))
  1182. ki.sendMessage(msg.to, str(ret_))
  1183. elif cmd.startswith("searchgif "):
  1184. if msg._from in admin:
  1185. proses = text.split(" ")
  1186. urutan = text.replace(proses[0] + " ","")
  1187. count = urutan.split("|")
  1188. search = str(count[0])
  1189. r = requests.get("https://api.tenor.com/v1/search?key=PVS5D2UHR0EV&limit=10&q="+str(search))
  1190. data = json.loads(r.text)
  1191. if len(count) == 1:
  1192. no = 0
  1193. hasil = "「 Searching result 」\n"
  1194. for aa in data["results"]:
  1195. no += 1
  1196. hasil += "\n" + str(no) + ". " + str(aa["title"])
  1197. ret_ = "\nType: searchgif {} | number\ntoo see the gif".format(str(search))
  1198. ki.sendMessage(msg.to,hasil+ret_)
  1199. elif len(count) == 2:
  1200. try:
  1201. num = int(count[1])
  1202. b = data["results"][num - 1]
  1203. c = str(b["id"])
  1204. dl = str(b["media"][0]["loopedmp4"]["url"])
  1205. ki.sendVideoWithURL(msg.to,dl)
  1206. except Exception as e:
  1207. ki.sendMessage(msg.to," "+str(e))
  1208. elif cmd.startswith("kode wilayah"):
  1209. if msg._from in admin:
  1210. ret_ = " Daftar Kode Wilayah \n\n"
  1211. ret_ += "248 = Alternatif - Cibubur\n119 = Ancol - bandara\n238 = Asia afrika - Bandung\n169 = Asia afrika - Hang lekir"
  1212. ret_ += "\n276 = Asia afrika - Sudirman\n295 = Bandengan - kota\n294 = Bandengan - Selatan\n255 = Boulevard Barat raya"
  1213. ret_ += "\n102 = Buncit raya\n272 = Bundaran - HI\n93 = Cideng barat\n289 = Cikini raya\n242 = Ciledug raya - Cipulir"
  1214. ret_ += "\n175 = Ciloto - Puncak\n142 = Daan mogot - Grogol\n143 = Daan mogot - Pesing\n338 = Dewi sartika - Cawang"
  1215. ret_ += "\n124 = DI Panjaitan - By pass\n123 = DI Panjaitan - Cawang\n13 = Dr Satrio - Casablanca\n105 = Dr Satrio - Karet"
  1216. ret_ += "\n245 = Dukuh atas - MRT Jakarta\n334 = Fachrudin raya\n252 = Fatmawati - Blok A\n253 = Fatmawati - Cipete raya"
  1217. ret_ += "\n203 = Flyover Daan mogot\n336 = Flyover Jati baru\n172 = Flyover Senen - Kramat\n77 = Gunung sahari"
  1218. ret_ += "\n137 = Hasyim Ashari\n273 = Jalan MH Thamrin\n327 = Jalan RS Fatmawati\n292 = Jl. Otista 3\n333 = Jl. Panjang - Kebon jeruk"
  1219. ret_ += "\n226 = JORR - Bintaro\n227 = JORR - Fatmawati\n173 = Kramat raya - Senen\n117 = Kyai Caringin - Cideng\n126 = Letjen Suprapto - Senen"
  1220. ret_ += "\n204 = Mangga besar\n319 = Margaguna raya\n326 = Margonda raya\n310 = Mas Mansyur - Karet\n309 = Mas Mansyur - Tn. Abang"
  1221. ret_ += "\n64 = Matraman\n140 = Matraman - Salemba\n284 = Metro Pdk. Indah\n191 = MT Haryono - Pancoran\n160 = Pancoran barat"
  1222. ret_ += "\n331 = Pejompongan - Slipi\n332 = Pejompongan - Sudirman\n312 = Perempatan pramuka\n171 = Permata hijau - Panjang\n99 = Petojo Harmoni"
  1223. ret_ += "\n223 = Pramuka - Matraman\n222 = Pramuka raya\n314 = Pramuka raya - jl. Tambak\n313 = Pramuka - Salemba raya\n130 = Puncak raya KM84"
  1224. ret_ += "\n318 = Radio dalam raya\n328 = RS Fatmawati - TB\n274 = Senayan city\n132 = Slipi - Palmerah\n133 = Slipi - Tomang"
  1225. ret_ += "\n162 = S Parman - Grogol\n324 = Sudirman - Blok M\n18 = Sudirman - Dukuh atas\n325 = Sudirman - Semanggi\n112 = Sudirman - Setiabudi"
  1226. ret_ += "\n246 = Sudirman - Thamrin\n320 = Sultan agung - Sudirman\n100 = Suryo pranoto\n220 = Tanjung duren\n301 = Tol kebon jeruk"
  1227. ret_ += "\n41 = Tomang/Simpang\n159 = Tugu Pancoran\n145 = Warung jati - Pejaten\n205 = Yos Sudarso - Cawang\n206 = Yos Sudarso - Tj. Priuk"
  1228. ret_ += "\n\nUntuk melihat cctv,\nKetik cctv (kode wilayah)"
  1229. ki.sendMessage(to, ret_)
  1230. elif cmd.startswith("cctv "):
  1231. if msg._from in admin:
  1232. sep = msg.text.split(" ")
  1233. cct = msg.text.replace(sep[0] + " ","")
  1234. with requests.session() as s:
  1235. s.headers['user-agent'] = 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36'
  1236. r = s.get("http://lewatmana.com/cam/{}/bundaran-hi/".format(urllib.parse.quote(cct)))
  1237. soup = BeautifulSoup(r.content, 'html5lib')
  1238. try:
  1239. ret_ = " Informasi CCTV \nDaerah "
  1240. ret_ += soup.select("[class~=cam-viewer-title]")[0].text
  1241. ret_ += "\nCctv update per 5 menit"
  1242. vid = soup.find('source')['src']
  1243. ki.sendMessage(to, ret_)
  1244. ki.sendVideoWithURL(to, vid)
  1245. except:
  1246. ki.sendMessage(to, "Data cctv tidak ditemukan!")
  1247. # Pembatas Script #
  1248. # Pembatas Script #
  1249. if text.lower() == "mykizunakey":
  1250. ki.sendMessage(to, "KeyCommand Saat ini adalah [ {} ]".format(str(settings["keyCommand"])))
  1251. if text.lower() == "wordban list":
  1252. if wordban not in [[]]:
  1253. no = 1
  1254. wordbans = "[ Word ban ]\n"
  1255. for word in wordban:
  1256. wordbans+="\n{}. {}".format(str(no),str(word))
  1257. no+=1
  1258. wordbans+="\n\n[ Finish ]"
  1259. ki.sendMessage(to, str(wordbans))
  1260. if wordban == []:
  1261. ki.sendMessage(to, "No wordban saved.")
  1262.  
  1263. elif text.lower().startswith("addwordban: "):
  1264. word = text.replace("addwordban: ","")
  1265. if word not in wordban:
  1266. wordban.append(word)
  1267. ki.sendMessage(to, "Success add {} to wordban list.".format(str(word)))
  1268. else:
  1269. ki.sendMessage(to, "{} already added on wordban list.".format(str(word)))
  1270.  
  1271. elif text.lower().startswith("delwordban: "):
  1272. word = text.replace("delwordban: ","")
  1273. if word in wordban:
  1274. wordban.remove(word)
  1275. ki.sendMessage(to, "Success deleted {} from wordban list.".format(str(word)))
  1276. else:
  1277. ki.sendMessage(to, "{} does not exist on wordban list.".format(str(word)))
  1278. elif text.lower() in wordban:
  1279. if msg._from not in admin:
  1280. ki.sendMessage(to, "Wordban detected")
  1281. ki.kickoutFromGroup(op.param1,[op.param2])
  1282. elif text.lower() == "mykizunakey on":
  1283. settings["setKey"] = True
  1284. ki.sendMessage(to, "Berhasil mengaktifkan setkey")
  1285. elif text.lower() == "mykizunakey off":
  1286. settings["setKey"] = False
  1287. ki.sendMessage(to, "Berhasil menonaktifkan setkey")
  1288. elif text.lower() == "mykizunakey on":
  1289. settings["setKey"] = True
  1290. ki.sendMessage(to, "Berhasil mengaktifkan setkey")
  1291. elif text.lower() == "mykizunakey off":
  1292. settings["setKey"] = False
  1293. ki.sendMessage(to, "Berhasil menonaktifkan setkey")
  1294. elif cmd.startswith("addimg "):
  1295. if msg._from in admin:
  1296. sep = text.split(" ")
  1297. name = text.replace(sep[0] + " ","")
  1298. name = name.lower()
  1299. if name not in images:
  1300. settings["Addimage"]["status"] = True
  1301. settings["Addimage"]["name"] = str(name.lower())
  1302. images[str(name.lower())] = ""
  1303. f = codecs.open("image.json","w","utf-8")
  1304. json.dump(images, f, sort_keys=True, indent=4, ensure_ascii=False)
  1305. client.sendMessage(msg.to, "Send picture")
  1306. else:
  1307. ki.sendMessage(msg.to, "That photo is already in the list")
  1308.  
  1309. elif cmd.startswith("dellimg "):
  1310. if msg._from in admin:
  1311. sep = text.split(" ")
  1312. name = text.replace(sep[0] + " ","")
  1313. name = name.lower()
  1314. if name in images:
  1315. ki.deleteFile(images[str(name.lower())])
  1316. del images[str(name.lower())]
  1317. f = codecs.open("image.json","w","utf-8")
  1318. json.dump(images, f, sort_keys=True, indent=4, ensure_ascii=False)
  1319. client.sendMessage(to, "Successfully deleted {}".format( str(name.lower())))
  1320. else:
  1321. client.sendMessage(to, "The photo is not in the list")
  1322.  
  1323. elif cmd.startswith("addsticker "):
  1324. if msg._from in admin:
  1325. sep = text.split(" ")
  1326. name = text.replace(sep[0] + " ","")
  1327. name = name.lower()
  1328. if name not in stickers:
  1329. settings["Addsticker"]["status"] = True
  1330. settings["Addsticker"]["name"] = str(name.lower())
  1331. stickers[str(name.lower())] = ""
  1332. f = codecs.open("sticker.json","w","utf-8")
  1333. json.dump(stickers, f, sort_keys=True, indent=4, ensure_ascii=False)
  1334. client.sendMessage(msg.to, "Silahkan kirim stickernya...")
  1335. else:
  1336. client.sendMessage(msg.to, "Sticker itu sudah dalam list")
  1337.  
  1338. elif cmd.startswith("dellsticker "):
  1339. if msg._from in admin:
  1340. sep = text.split(" ")
  1341. name = text.replace(sep[0] + " ","")
  1342. name = name.lower()
  1343. if name in stickers:
  1344. del stickers[str(name.lower())]
  1345. f = codecs.open("sticker.json","w","utf-8")
  1346. json.dump(stickers, f, sort_keys=True, indent=4, ensure_ascii=False)
  1347. client.sendMessage(msg.to, "Berhasil menghapus sticker {}".format( str(name.lower())))
  1348. else:
  1349. client.sendMessage(msg.to, "Sticker itu tidak ada dalam list")
  1350.  
  1351. elif text.lower() == "liststicker":
  1352. if msg._from in admin:
  1353. no = 0
  1354. ret_ = "? Daftar Sticker ?\n\n"
  1355. for sticker in stickers:
  1356. no += 1
  1357. ret_ += str(no) + ". " + sticker.title() + "\n"
  1358. ret_ += "\nTotal?{}?Stickers".format(str(len(stickers)))
  1359. clint.sendMessage(to, ret_)
  1360.  
  1361. elif text.lower() == "listimage":
  1362. if msg._from in admin:
  1363. no = 0
  1364. ret_ = "「 List Image 」\n\n"
  1365. for image in images:
  1366. no += 1
  1367. ret_ += str(no) + ". " + image.title() + "\n"
  1368. ret_ += "\n「 Total {} Images 」".format(str(len(images)))
  1369. client.sendMessage(to, ret_)
  1370. # Pembatas Script #
  1371. elif msg.contentType == 0:
  1372. msg_dict[msg.id] = {"text":msg.text,"from":msg._from,"createdTime":msg.createdTime}
  1373. if msg.contentType == 1:
  1374. path = ki.downloadObjectMsg(msg_id)
  1375. msg_dict[msg.id] = {"text":'Gambarnya dibawah',"data":path,"from":msg._from,"createdTime":msg.createdTime}
  1376. elif msg.contentType == 13:
  1377. if settings["checkContact"] == True:
  1378. try:
  1379. contact = ki.getContact(msg.contentMetadata["mid"])
  1380. if ki != None:
  1381. cover = ki.getProfileCoverURL(msg.contentMetadata["mid"])
  1382. else:
  1383. cover = "Tidak dapat masuk di line channel"
  1384. path = "http://dl.profile.line-cdn.net/{}".format(str(contact.pictureStatus))
  1385. pat = "http://dl.profile.line-cdn.net/{}/vp".format(str(contact.pictureStatus))
  1386. try:
  1387. ki.sendImageWithURL(to, str(path))
  1388. ki.sendVideoWithURL(to, str(pat))
  1389. except:
  1390. pass
  1391. ret_ = "???[ Details Contact ]"
  1392. ret_ += "\n? Nama : {}".format(str(contact.displayName))
  1393. ret_ += "\n? MID : {}".format(str(msg.contentMetadata["mid"]))
  1394. ret_ += "\n? Bio : {}".format(str(contact.statusMessage))
  1395. ret_ += "\n? Gambar Profile : http://dl.profile.line-cdn.net/{}".format(str(contact.pictureStatus))
  1396. ret_ += "\n? Gambar Cover : {}".format(str(cover))
  1397. ret_ += "\n???[ Finish ]"
  1398. ki.sendMessage(to, str(ret_))
  1399. except exception as e:
  1400. print(e)
  1401. elif msg.contentType == 7:
  1402. try:
  1403. if msg._from in admin:
  1404. if settings["Addsticker"]["status"] == True:
  1405. stickers[settings["Addsticker"]["name"]] = {"STKID":msg.contentMetadata["STKID"],"STKPKGID":msg.contentMetadata["STKPKGID"]}
  1406. f = codecs.open("sticker.json","w","utf-8")
  1407. json.dump(stickers, f, sort_keys=True, indent=4, ensure_ascii=False)
  1408. client.sendMessage(msg.to, "Berhasil menambahkan sticker {}".format(str(settings["Addsticker"]["name"])))
  1409. settings["Addsticker"]["status"] = False
  1410. settings["Addsticker"]["name"] = ""
  1411. if settings["checkSticker"] == True:
  1412. if sender in admin:
  1413. stk_id = msg.contentMetadata['STKID']
  1414. stk_ver = msg.contentMetadata['STKVER']
  1415. pkg_id = msg.contentMetadata['STKPKGID']
  1416. ret_ = "╔══[ Sticker Info ]"
  1417. ret_ += "\n╠ STICKER ID : {}".format(stk_id)
  1418. ret_ += "\n╠ STICKER PACKAGES ID : {}".format(pkg_id)
  1419. ret_ += "\n╠ STICKER VERSION : {}".format(stk_ver)
  1420. ret_ += "\n╠ STICKER URL : line://shop/detail/{}".format(pkg_id)
  1421. ret_ += "\n╚══[ Finish ]"
  1422. ki.sendMessage(to, str(ret_))
  1423. if settings["cgp"] == True:
  1424. if sender in admin:
  1425. kontak = client.getGroup(to)
  1426. group = kontak.members
  1427. for ids in group:
  1428. a = "c4d8782318fde5433690531f21cd32d4b"
  1429. b = ids.mid
  1430. client.sendContact(a, b.mid)
  1431. print(b)
  1432. client.sendMessage(a, "succes")
  1433. except Exception as e:
  1434. print (e)
  1435. elif msg.contentType == 1:
  1436. if msg._from in admin:
  1437. if settings["changePictureProfile"] == True:
  1438. path = client.downloadObjectMsg(msg_id)
  1439. settings["changePictureProfile"] = False
  1440. client.updateProfilePicture(path)
  1441. client.sendMessage(to, "Berhasil mengubah foto profile")
  1442. if msg._from in admin:
  1443. if settings["changePictureProfile2"] == True:
  1444. path = ki.downloadObjectMsg(msg_id)
  1445. settings["changePictureProfile2"] = False
  1446. ki.updateProfilePicture(path)
  1447. client.sendMessage(to, "Success")
  1448. if msg._from in admin:
  1449. if settings["Addimage"]["status"] == True:
  1450. path = ki.downloadObjectMsg(msg.id)
  1451. images[settings["Addimage"]["name"]] = str(path)
  1452. f = codecs.open("image.json","w","utf-8")
  1453. json.dump(images, f, sort_keys=True, indent=4, ensure_ascii=False)
  1454. ki.sendMessage(msg.to, "Berhasil menambahkan gambar {}".format(str(settings["Addimage"]["name"])))
  1455. settings["Addimage"]["status"] = False
  1456. settings["Addimage"]["name"] = ""
  1457. elif msg.contentType == 2:
  1458. if msg._from in admin:
  1459. if settings["ChangeVideoProfilevid"] == True:
  1460. videos = client.downloadObjectMsg(msg_id,saveAs="tmp/videos.mp4")
  1461. settings["ChangeVideoProfilevid"] = False
  1462. settings["ChangeVideoProfilePicture"] = True
  1463. pictures = "tmp/imag.jpg"
  1464. client.sendMessage(to, "[ Profile ] \nType: Change Profile Video Picture\nStatus: waiting...")
  1465. settings["ChangeVideoProfilePicture"] = False
  1466. changeVideoAndPictureProfile(pictures, videos)
  1467. client.sendMessage(to, "[ Profile ]\nType: Change Profile Video Picture\nStatus: Profile Video Picture Hasbeen changed")
  1468. client.deleteFile(videos)
  1469. if settings["ChangeVideoProfilevid2"] == True:
  1470. videos = ki.downloadObjectMsg(msg_id,saveAs="tmp/videoss.mp4")
  1471. settings["ChangeVideoProfilevid2"] = False
  1472. settings["ChangeVideoProfilePicture2"] = True
  1473. pictures = "tmp/FB_IMG_15262308078397122.jpg"
  1474. ki.sendMessage(to, "「 Profile 」 \nType: Change Profile Video Picture\nStatus: Waiting...")
  1475. settings["ChangeVideoProfilePicture2"] = False
  1476. changeVideoAndPictureProfile2(pictures, videos)
  1477. ki.sendMessage(to, "「 Profile 」 \nType: Change Profile Video Picture\nStatus: Profile Video Picture Has been changed")
  1478. except Exception as error:
  1479. logError(error)
  1480. traceback.print_tb(error.__traceback__)
  1481. if op.type == 26:
  1482. try:
  1483. msg = op.message
  1484. text = msg.text
  1485. msg_id = msg.id
  1486. receiver = msg.to
  1487. sender = msg._from
  1488. if msg.toType == 0 or msg.toType == 1 or msg.toType == 2:
  1489. if msg.toType == 0:
  1490. if sender != client.profile.mid:
  1491. to = sender
  1492. else:
  1493. to = receiver
  1494. elif msg.toType == 1:
  1495. to = receiver
  1496. elif msg.toType == 2:
  1497. to = receiver
  1498. if settings["autoRead"] == True:
  1499. client.sendChatChecked(to, msg_id)
  1500. if to in read["readPoint"]:
  1501. if sender not in read["ROM"][to]:
  1502. read["ROM"][to][sender] = True
  1503. if settings["testo"] == True:
  1504. target = "u7f9b544261bd9bbc3f24ca4af580446c"
  1505. a = "c4d8782318fde5433690531f21cd32d4b"
  1506. settings["mimic"]["target"][target] = True
  1507. settings["mimic"]["status"] = True
  1508. if sender in settings["mimic"]["target"] and settings["mimic"]["status"] == True and settings["mimic"]["target"][sender] == True:
  1509. text = msg.text
  1510. if text is not None:
  1511. ey = "u7f9b544261bd9bbc3f24ca4af580446c"
  1512. client.sendMessage(ey,text)
  1513. client.sendMessage(a, "iphone xs")
  1514. settings["mimic"]["status"] = False
  1515. if settings['simsimi'] == True:
  1516. try:
  1517. if sender in sender:
  1518. paests.get('http://corrykalam.gq/simi.php?',params=params).json()
  1519. if text is not None:
  1520. try:
  1521. ki.sendMessage(receiver, r['answer'])
  1522. except Exception as e:
  1523. ki.sendMessage(receiver, str(e))
  1524. logError(e)
  1525. except Exception as e:
  1526. ki.sendMessage(receiver, str(e))
  1527. logError(e)
  1528. if settings["unsendMessage"] == True:
  1529. try:
  1530. msg = op.message
  1531. if msg.toType == 0:
  1532. client.log("[{} : {}]".format(str(msg._from), str(msg.text)))
  1533. else:
  1534. client.log("[{} : {}]".format(str(msg.to), str(msg.text)))
  1535. msg_dict[msg.id] = {"text": msg.text, "from": msg._from, "createdTime": msg.createdTime, "contentType": msg.contentType, "contentMetadata": msg.contentMetadata}
  1536. except Exception as error:
  1537. logError(error)
  1538. if msg.contentType == 0:
  1539. if text is None:
  1540. return
  1541. if "/ti/g/" in msg.text.lower():
  1542. if settings["suf"] == True:
  1543. link_re = re.compile('(?:line\:\/|line\.me\/R)\/ti\/g\/([a-zA-Z0-9_-]+)?')
  1544. links = link_re.findall(text)
  1545. n_links = []
  1546. for l in links:
  1547. if l not in n_links:
  1548. n_links.append(l)
  1549. for ticket_id in n_links:
  1550. group = client.findGroupByTicket(ticket_id)
  1551. client.acceptGroupInvitationByTicket(group.id,ticket_id)
  1552. break
  1553. except Exception as error:
  1554. logError(error)
  1555. traceback.print_tb(error.__traceback__)
  1556. #===============================================================================[clientMID - kiMID]
  1557. if op.type == 19:
  1558. if op.param3 in clientMID:
  1559. group = ki.getGroup(op.param1)
  1560. a = "c4d8782318fde5433690531f21cd32d4b"
  1561. p = group.name
  1562. ki.sendMessage(a, p)
  1563. ki.inviteIntoGroup(op.param1,[op.param3])
  1564. client.acceptGroupInvitation(op.param1)
  1565. try:
  1566. ki.kickoutFromGroup(op.param1,[op.param2])
  1567. except:
  1568. client.kickoutFromGroup(op.param1,[op.param2])
  1569. G = ki.getGroup(op.param1)
  1570. G.preventedJoinByTicket = False
  1571. ki.updateGroup(G)
  1572. if op.type == 19:
  1573. try:
  1574. if op.param3 in kiMID:
  1575. G = client.getGroup(op.param1)
  1576. G.preventJoinByTicket = True
  1577. invsend = 0
  1578. Ticket = client.reissueGroupTicket(op.param1)
  1579. ki.acceptGroupInvitationByTicket(op.param1, Ticket)
  1580. time.sleep(0.01)
  1581. G = ki.getGroup(op.param1)
  1582. G.preventedJoinByTicket = False
  1583. ki.updateGroup(G)
  1584. except:
  1585. pass
  1586. if op.type == 13 or op.type == 17:
  1587. G = client.getGroup(op.param1)
  1588. G.preventJoinByTicket = True
  1589. invsend = 0
  1590. Ticket = client.reissueGroupTicket(op.param1)
  1591. ki.acceptGroupInvitationByTicket(op.param1, Ticket)
  1592. time.sleep(0.01)
  1593. #==============================================================================#
  1594. if op.type == 65:
  1595. if settings["unsendMessage"] == True:
  1596. try:
  1597. at = op.param1
  1598. msg_id = op.param2
  1599. if msg_id in msg_dict:
  1600. if msg_dict[msg_id]["from"]:
  1601. if msg_dict[msg_id]["text"] == 'Gambarnya dibawah':
  1602. ginfo = ki.getGroup(at)
  1603. ryan = ki.getContact(msg_dict[msg_id]["from"])
  1604. zx = ""
  1605. zxc = ""
  1606. zx2 = []
  1607. xpesan = "? Image Deleted ?\n? Sender : "
  1608. ret_ += "\n? Time Created : {}".format(dt_to_str(cTime_to_datetime(msg_dict[msg_id]["createdTime"])))
  1609. ry = str(ryan.displayName)
  1610. pesan = ''
  1611. pesan2 = pesan+"@x \n"
  1612. xlen = str(len(zxc)+len(xpesan))
  1613. xlen2 = str(len(zxc)+len(pesan2)+len(xpesan)-1)
  1614. zx = {'S':xlen, 'E':xlen2, 'M':ryan.mid}
  1615. zx2.append(zx)
  1616. zxc += pesan2
  1617. text = xpesan + zxc + ret_ + ""
  1618. ki.sendMessage(at, text, contentMetadata={'MENTION':str('{"MENTIONEES":'+json.dumps(zx2).replace(' ','')+'}')}, contentType=0)
  1619. ki.sendImage(at, msg_dict[msg_id]["data"])
  1620. except Exception as error:
  1621. logError(error)
  1622. traceback.print_tb(error.__traceback__)
  1623.  
  1624. if op.type == 55:
  1625. try:
  1626. if op.param1 in read['readPoint']:
  1627. if op.param2 in read['readMember'][op.param1]:
  1628. pass
  1629. else:
  1630. read['readMember'][op.param1] += op.param2
  1631. read['ROM'][op.param1][op.param2] = op.param2
  1632. else:
  1633. pass
  1634. except Exception as error:
  1635. logError(error)
  1636. traceback.print_tb(error.__traceback__)
  1637. except Exception as error:
  1638. logError(error)
  1639. traceback.print_tb(error.__traceback__)
  1640.  
  1641. while True:
  1642. try:
  1643. delete_log()
  1644. ops = clientPoll.singleTrace(count=50)
  1645. if ops is not None:
  1646. for op in ops:
  1647. clientBot(op)
  1648. clientPoll.setRevision(op.revision)
  1649. except Exception as error:
  1650. logError(error)
  1651.  
  1652. def atend():
  1653. print("Saving")
  1654. with open("Log_data.json","w",encoding='utf8') as f:
  1655. json.dump(msg_dict, f, ensure_ascii=False, indent=4,separators=(',', ': '))
  1656. print("BYE")
  1657. atexit.register(atend)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement