Advertisement
Guest User

Untitled

a guest
Jan 20th, 2017
751
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 129.36 KB | None | 0 0
  1. ##############################################################################################################################################
  2.  
  3.  
  4.  
  5. #################################################################################################################
  6. import ch
  7. import random
  8. import sys
  9. import re
  10. import json
  11. import simi
  12. import time
  13. import datetime
  14. import os
  15. import urllib
  16. if sys.version_info[0] > 2:
  17. import urllib.request as urlreq
  18. else:
  19. import urllib2 as urlreq
  20. from time import localtime, strftime
  21.  
  22. from xml.etree import cElementTree as ET
  23. if sys.version_info[0] > 2:
  24. import urllib.request as urlreq
  25. else:
  26. import urllib2 as urlreq
  27.  
  28. botname = 'toumabot' ##isi idnya
  29. password = 'evrytime123' ##isi paswordnya
  30.  
  31. startTime = time.time()
  32. lockdown = False
  33.  
  34.  
  35. ##nick names
  36. def sntonick(username):
  37. user = username.lower()
  38. if user in nicks:
  39. nick = json.loads(nicks[user])
  40. return nick
  41. else:
  42. return user
  43.  
  44. #### Returns the number of seconds since the program started.
  45. ################################################################
  46. def getUptime():
  47. """
  48. Returns the number of seconds since the program started.
  49. """
  50. # do return startTime if you just want the process start time
  51. return time.time() - startTime
  52.  
  53. def reboot():
  54. output = ("rebooting server . . .")
  55. os.popen("sudo -S reboot")
  56. return output
  57.  
  58. #### SYSTEM UPTIME
  59. def uptime():
  60.  
  61. total_seconds = float(getUptime())
  62.  
  63. # Helper vars:
  64. MINUTE = 60
  65. HOUR = MINUTE * 60
  66. DAY = HOUR * 24
  67.  
  68. # Get the days, hours, etc:
  69. days = int( total_seconds / DAY )
  70. hours = int( ( total_seconds % DAY ) / HOUR )
  71. minutes = int( ( total_seconds % HOUR ) / MINUTE )
  72. seconds = int( total_seconds % MINUTE )
  73.  
  74. # Build up the pretty string (like this: "N days, N hours, N minutes, N seconds")
  75. string = ""
  76. if days > 0:
  77. string += str(days) + " " + (days == 1 and "day" or "days" ) + ", "
  78. if len(string) > 0 or hours > 0:
  79. string += str(hours) + " " + (hours == 1 and "hour" or "hours" ) + ", "
  80. if len(string) > 0 or minutes > 0:
  81. string += str(minutes) + " " + (minutes == 1 and "minute" or "minutes" ) + ", "
  82. string += str(seconds) + " " + (seconds == 1 and "second" or "seconds" )
  83.  
  84. return string;
  85.  
  86. ## DEFINITIONS
  87. dictionary = dict()
  88. f = open("definitions.txt", "r")
  89. for line in f.readlines():
  90. try:
  91. if len(line.strip())>0:
  92. word, definition, name = json.loads(line.strip())
  93. dictionary[word] = json.dumps([definition, name])
  94. except:
  95. print("[ERROR]Cant load definition: %s" % line)
  96. f.close()
  97. ##nicks
  98. nicks=dict()#empty list
  99. f=open ("nicks.txt","r")#r=read w=right
  100. for line in f.readlines():#loop through eachlinimporte and read each line
  101. try:#try code
  102. if len(line.strip())>0:#strip the whitespace checkgreater than 0
  103. user , nick = json.loads(line.strip())
  104. nicks[user] = json.dumps(nick)
  105. except:
  106. print("[Error]Can't load nick %s" % line)
  107. f.close()
  108. ##Rooms
  109. rooms = []
  110. f = open("rooms.txt", "r") # read-only
  111. for name in f.readlines():
  112. if len(name.strip())>0: rooms.append(name.strip())
  113. f.close()
  114. ##RB
  115. def rainbow(word):
  116. length = len(word)
  117. #set rgb values
  118. r = 255 #rgb value set to red by default
  119. g = 0
  120. b = 0
  121. sub = int(765/length)
  122. counter = 0
  123. string = ""
  124. for x in range(0, length):
  125. letter = word[counter]
  126. s = "<f x12%02X%02X%02X='0'>%s" % (r, g, b, letter)
  127. string = string+s
  128. counter+=1
  129. if (r == 255) and (g >= 0) and (b == 0): #if all red
  130. g = g+sub
  131. if g > 255: g = 255
  132. if (r > 0) and (g == 255) and (b == 0): #if some red and all green
  133. r = r-sub #reduce red to fade from yellow to green
  134. if r<0: r = 0 #if red gets lower than 0, set it back to 0
  135. if (r == 0) and (g == 255) and (b >= 0):
  136. b = b+sub
  137. if b>255:
  138. b = 255
  139. trans = True
  140. if (r == 0) and (g > 0) and (b == 255):
  141. g = g-sub
  142. if g<0: g = 0
  143. if (r >= 0) and (g == 0) and (b == 255):
  144. r = r+sub
  145. if r>255: r = 255
  146. return string
  147. ##owners
  148. owners = []
  149. try:
  150. file = open("owners.txt", "r")
  151. for name in file.readlines():
  152. if len(name.strip()) > 0:
  153. owners.append(name.strip())
  154. print("[INFO]Owners loaded...")
  155. file.close()
  156. except:
  157. print("[ERROR]no file named owners")
  158. print("2 second to read the error")
  159. time.sleep(2)
  160. exit()
  161. time.sleep(1)
  162.  
  163. ###admin
  164. admin = []
  165. try:
  166. file = open("admin.txt", "r")
  167. for name in file.readlines():
  168. if len(name.strip()) > 0:
  169. admin.append(name.strip())
  170. print("[INFO]Admin loaded...")
  171. file.close()
  172. except:
  173. print("[ERROR]no file named admin")
  174. print("2 second to read the error")
  175. time.sleep(2)
  176. exit()
  177. time.sleep(1)
  178. ##archknight
  179. archknight = []
  180. try:
  181. file = open("archknight.txt", "r")
  182. for name in file.readlines():
  183. if len(name.strip()) > 0:
  184. archknight.append(name.strip())
  185. print("[INFO]archknight loaded...")
  186. file.close()
  187. except:
  188. print("[ERROR]no file named archknight")
  189. print("2 second to read the error")
  190. time.sleep(2)
  191. exit()
  192. time.sleep(1)
  193. ##archwizard
  194. archwizard = []
  195. try:
  196. file = open("archwizard.txt", "r")
  197. for name in file.readlines():
  198. if len(name.strip()) > 0:
  199. archwizard.append(name.strip())
  200. print("[INFO]archkwizard loaded...")
  201. file.close()
  202. except:
  203. print("[ERROR]no file named archkwizard")
  204. print("2 second to read the error")
  205. time.sleep(2)
  206. exit()
  207. time.sleep(1)
  208. ##player
  209. player = []
  210. try:
  211. file = open("player.txt", "r")
  212. for name in file.readlines():
  213. if len(name.strip()) > 0:
  214. archwizard.append(name.strip())
  215. print("[INFO]player loaded...")
  216. file.close()
  217. except:
  218. print("[ERROR]no file named player")
  219. print("2 second to read the error")
  220. time.sleep(2)
  221. exit()
  222. time.sleep(1)
  223. ##whitelist
  224. whitelist = []
  225. try:
  226. file = open("whitelist.txt", "r")
  227. for name in file.readlines():
  228. if len(name.strip()) > 0:
  229. whitelist.append(name.strip())
  230. print("[INFO]whitelist loaded...")
  231. file.close()
  232. except:
  233. print("[ERROR]no file named whitelist")
  234. print("2 second to read the error")
  235. time.sleep(2)
  236. exit()
  237. time.sleep(1)
  238.  
  239. #END#
  240. ##IP Whois
  241. ip_whois = dict()
  242. try:
  243. f = open("ip_whois.txt", "r")
  244. ip_whois = eval(f.read())
  245. f.close()
  246. except:pass
  247.  
  248. ##SessionId Whois
  249. sid_whois = dict()
  250. try:
  251. f = open("sid_whois.txt", "r")
  252. sid_whois = eval(f.read())
  253. f.close()
  254. except:pass
  255.  
  256. ## Stuff ##
  257. ## WHOIS
  258. whois = dict()
  259. try:
  260. f = open('whois.txt','r')
  261. whois = eval(f.read())
  262. f.close()
  263. except:pass
  264. ##MONEY
  265. bank=dict()
  266. f = open("bank.txt", "r") # read-only
  267. for line in f.readlines():
  268. try:
  269. if len(line.strip())>0:
  270. user,coin,gold= json.loads(line.strip())
  271. bank[user] = json.dumps([coin,gold])
  272. except:
  273. print("[ERROR]Cant load MONEY: %s" % line)
  274. f.close()
  275.  
  276.  
  277. stats=dict()
  278. f = open("stats.txt", "r") # read-only
  279. for line in f.readlines():
  280. try:
  281. if len(line.strip())>0:
  282. user,lvl,exp,up= json.loads(line.strip())
  283. stats[user] = json.dumps([lvl,exp,up])
  284. except:
  285. print("[ERROR]Cant load STATS: %s" % line)
  286. f.close()
  287.  
  288. mcash=dict()
  289. f = open("mcash.txt", "r") # read-only
  290. for line in f.readlines():
  291. try:
  292. if len(line.strip())>0:
  293. user,cash,cp = json.loads(line.strip())
  294. mcash[user] = json.dumps([cash,cp])
  295. except:
  296. print("[ERROR]Cant load CASH: %s" % line)
  297. f.close()
  298. ##AFK List##
  299. afks = []
  300. f = open("afks.txt", 'r')
  301. for name in f.readlines():
  302. if len(name.strip())>0: afks.append(name.strip())
  303. f.close()
  304. ##Lockroom
  305. locks = []
  306. f = open("locks.txt", 'r')
  307. for name in f.readlines():
  308. if len(name.strip())>0: locks.append(name.strip())
  309. f.close()
  310. #Dlist
  311. dlist = []
  312. f = open("dlist.txt", "r") # read-onlyimport
  313. for name in f.readlines():
  314. if len(name.strip())>0: dlist.append(name.strip())
  315. f.close()
  316. #END#
  317. #SN TRY
  318. sn = dict()
  319. try:
  320. f = open('note.txt','r')
  321. sn = eval(f.read())
  322. f.close()
  323. except:pass
  324.  
  325. ## Send Notes
  326. sasaran = dict()
  327. f = open ("notes.txt", "r") #read-only
  328. for line in f.readlines():
  329. try:
  330. if len(line.strip())>0:
  331. to, body, sender = json.loads(line.strip())
  332. sasaran[to] = json.dumps([body, sender])
  333. except:
  334. print("[Error] Notes load fails : %s" % line)
  335. f.close()
  336. # SN Notifs
  337. notif = []
  338. f = open("notif.txt", "r")
  339. for name in f.readlines():
  340. if len(name.strip())>0: notif.append(name.strip())
  341. f.close
  342.  
  343. blacklist = []
  344. f = open("blacklist.txt", "r")
  345. for name in f.readlines():
  346. if len(name.strip())>0: blacklist.append(name.strip())
  347. f.close()
  348.  
  349. def tube(args):
  350. """
  351. #In case you don't know how to use this function
  352. #type this in the python console:
  353. >>> tube("pokemon dash")
  354. #and this function would return this thing:
  355. {'title': 'TAS (DS) Pokテゥmon Dash - Regular Grand Prix', 'descriptions': '1st round Grand Prix but few mistake a first time. Next Hard Grand Prix will know way and few change different Pokテゥmon are more faster and same course Cup.', 'uploader': 'EddieERL', 'link': 'http://www.youtube.com/watch?v=QdvnBmBQiGQ', 'videoid': 'QdvnBmBQiGQ', 'viewcount': '2014-11-04T15:43:15.000Z'}
  356. """
  357. search = args.split()
  358. url = urlreq.urlopen("https://www.googleapis.com/youtube/v3/search?q=%s&part=snippet&key=AIzaSyBSnh-sIjd97_FmQVzlyGbcaYXuSt_oh84" % "+".join(search))
  359. udict = url.read().decode('utf-8')
  360. data = json.loads(udict)
  361. rest = []
  362. for f in data["items"]:
  363. rest.append(f)
  364.  
  365. d = random.choice(rest)
  366. link = "http://www.youtube.com/watch?v=" + d["id"]["videoId"]
  367. videoid = d["id"]["videoId"]
  368. title = d["snippet"]["title"]
  369. uploader = d["snippet"]["channelTitle"]
  370. descript = d["snippet"]['description']
  371. count = d["snippet"]["publishedAt"]
  372. return "Result: %s <br/><br/><br/><br/><br/><br/><br/><br/><font color='#ffcc00'><b>%s</b></font><br/><font color='#ff0000'><b>Uploader</b></font>:<b> %s</b><br/><font color='#ff0000'><b>Uploaded on</b></font>: %s<br/><font color='#ff0000'><b>Descriptions</b></font>:<i> %s ...</i><br/> " % (link, title, uploader, count, descript[:200])
  373.  
  374. def gs(args):
  375. args = args.split()
  376. headers = {}
  377. headers['User-Agent'] = "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.27 Safari/537.17"
  378. req = urllib.request.Request("https://www.google.co.id/search?q=" + "+".join(args), headers = headers)
  379. resp = urllib.request.urlopen(req).read().decode("utf-8").replace('\n','').replace('\r','').replace('\t','').replace('http://','gs:').replace('https://','gs:')
  380. anjay = re.findall('<h3 class="r">(.*?)</h3>', resp)
  381. setter = list()
  382. la = "".join(anjay)
  383. a = re.findall('<a href="gs:(.*?)" onmousedown="(.*?)">(.*?)</a>', la)
  384. q = 1
  385. for link, fak, title in a:
  386. setter.append('<br/>[%s] %s : http://%s' % (q, title.capitalize(), link))
  387. q += 1
  388. return "<br/><br/>".join(setter[0:4])
  389.  
  390. def newCi():
  391. headers = {}
  392. headers['User-Agent'] = "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.27 Safari/537.17"
  393. req = urllib.request.Request("http://cinemaindo.com/#", headers = headers)
  394. resp = urllib.request.urlopen(req).read().decode("utf-8").replace('\n','').replace('\r','').replace('\t','')
  395. wa = re.findall('<div class="title"><a href="(.*?)"><h2>(.*?)</h2>',resp)
  396. a = list()
  397. q = 1
  398. for link, cls, title in wa:
  399. a.append("(<b>%s</b>). <b>%s</b>: %s" % (q, title, link))
  400. q += 1
  401. return "<br/>".join(a)
  402.  
  403. def getBGTime(x):
  404. total_seconds = float(x - time.time())
  405. MIN = 60
  406. HOUR = MIN * 60
  407. DAY = HOUR * 24
  408. YEAR = DAY * 365.25
  409. years = int( total_seconds / YEAR )
  410. days = int( (total_seconds % YEAR ) / DAY )
  411. hrs = int( ( total_seconds % DAY ) / HOUR )
  412. min = int( ( total_seconds % HOUR ) / MIN )
  413. secs = int( total_seconds % MIN )
  414. string = ""
  415. if years > 0: string += "<font color='#00ffff'>" + str(years) + "</font> " + (years == 1 and "year" or "years" ) + ", "
  416. if len(string) > 0 or days > 0: string += "<font color='#00ffff'>" + str(days) + "</font> " + (days == 1 and "day" or "days" ) + ", "
  417. if len(string) > 0 or hrs > 0: string += "<font color='#00ffff'>" + str(hrs) + "</font> " + (hrs == 1 and "hour" or "hours" ) + ", "
  418. if len(string) > 0 or min > 0: string += "<font color='#00ffff'>" + str(min) + "</font> " + (min == 1 and "minute" or "minutes" ) + " and "
  419. string += "<font color='#00ffff'>" + str(secs) + "</font> " + (secs == 1 and "second" or "seconds" )
  420. return string;
  421.  
  422. def getSTime(x):
  423. total_seconds = float(time.time() - x)
  424. MIN = 60
  425. HOUR = MIN * 60
  426. DAY = HOUR * 24
  427. days = int( total_seconds / DAY )
  428. hrs = int( ( total_seconds % DAY ) / HOUR )
  429. min = int( ( total_seconds % HOUR ) / MIN )
  430. secs = int( total_seconds % MIN )
  431. string = ""
  432. if days > 0: string += "<font color='#00ffff'>" + str(days) + "</font> " + (days == 1 and "day" or "days" ) + ", "
  433. if len(string) > 0 or hrs > 0: string += "<font color='#00ffff'>" + str(hrs) + "</font> " + (hrs == 1 and "hour" or "hours" ) + ", "
  434. if len(string) > 0 or min > 0: string += "<font color='#00ffff'>" + str(min) + "</font> " + (min == 1 and "minute" or "minutes" ) + " and "
  435. string += "<font color='#00ffff'>" + str(secs) + "</font> " + (secs == 1 and "second" or "seconds", True)
  436. return string;
  437.  
  438. def bgtime(x):
  439. try:
  440. x = user if len(x) == 0 else x
  441. html = urlreq.urlopen("http://st.chatango.com/profileimg/%s/%s/%s/mod1.xml" % (x.lower()[0], x.lower()[1], x.lower())).read().decode()
  442. inter = re.compile(r'<d>(.*?)</d>', re.IGNORECASE).search(html).group(1)
  443. if int(inter) < time.time():
  444. lbgtime = getSTime(int(inter))
  445. return "that users bg ran out %s ago" % lbgtime
  446. else: return "bgtime for <b>%s</b>: %s" % (x.lower(), getBGTime(int(inter)))
  447. except: return 'that user never had a background, or the data was deleted'
  448.  
  449. def serCi(anjoy):
  450. headers = {}
  451. headers['User-Agent'] = "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.27 Safari/537.17"
  452. req = urllib.request.Request("http://cinemaindo.com/?s="+anjoy+"&post_type=post", headers = headers)
  453. resp = urllib.request.urlopen(req).read().decode("utf-8").replace('\n','')
  454. anjay = re.findall('<div class="title"><a href="(.*?)"><h2>(.*?)</h2>', resp)
  455. newlist = list()
  456. q = 1
  457. for i, a in anjay:
  458. newlist.append("%s. <b>%s</b>: %s" % (q, a, i))
  459. q = q + 1
  460. return "<br/>".join(serCi[0:10])
  461.  
  462. def newOp():
  463. headers = {}
  464. headers['User-Agent'] = "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.27 Safari/537.17"
  465. req = urllib.request.Request("http://www.oploverz.net/", headers = headers)
  466. resp = urllib.request.urlopen(req).read().decode("utf-8")
  467. Data = re.findall('<h2><a href="(.*?)" title="(.*?)">(.*?)</a>', resp)
  468. lolly = list()
  469. anjeng = 1
  470. for link, useful, title in Data:
  471. lolly.append(('%s. <b>%s</b>: %s' % (anjeng, title, link)))
  472. anjeng = anjeng+1
  473. return "<br/>".join(lolly[0:10])
  474.  
  475. def newAi():
  476. headers = {}
  477. headers['User-Agent'] = "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.27 Safari/537.17"
  478. req = urllib.request.Request("http://animeindo.id", headers = headers)
  479. resp = urllib.request.urlopen(req).read().decode("utf-8").replace('\n','').replace('\r','').replace('\t','')
  480. res = re.findall('<div class="newepisodecon">(.+?)<div class="clearfix"></div>', resp)
  481. newset = list()
  482. num = 1
  483. for i in res:
  484. data = re.findall('<a href="(.*?)"><div class="newepisode"><span class="viewer">(.*?)</span><div class="hoverboard"><div class="title">(.*?) </div></div>', i)
  485. for b, a, c in data:
  486. newset.append("%s. <b>%s</b>: %s" % (num, c, b))
  487. num = num + 1
  488. return "<br/>".join(newset[0:10])
  489.  
  490.  
  491. def newK():
  492. resp = urllib.request.urlopen("http://khususme.blogspot.co.id/").read().decode("utf-8").replace('\n','')
  493. res = re.findall("<h2 class='post-title entry-title' itemprop='name'><a href=""'(.*?)'"">(.*?)</a></h2>", resp)
  494. newset = list()
  495. n = 1
  496. for a, b in res:
  497. newset.append("%s. %s: %s" % (n, b, a))
  498. n = n + 1
  499. return "<br/>".join(newset[0:10])
  500.  
  501. def newNonton123():
  502. headers = {}
  503. headers['User-Agent'] = "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.27 Safari/537.17"
  504. req = urllib.request.Request("http://www.nonton123.com/", headers = headers)
  505. resp = urllib.request.urlopen(req).read().decode("utf-8").replace('\n','').replace('\r','').replace('\t','')
  506. wa = re.findall('<h2><a href="(.*?)" rel="bookmark" title="(.*?)">(.*?)</a></h2>',resp)
  507. a = list()
  508. q = 1
  509. for link, w, title in wa:
  510. a.append("(<b>%s</b>). <b>%s</b>" % (q, title))
  511. q += 1
  512. return "<br/>".join(a[0:10])
  513.  
  514. def newAd():
  515. headers = {}
  516. headers['User-Agent'] = "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.27 Safari/537.17"
  517. req = urllib.request.Request("http://animemaiden.net/", headers = headers)
  518. resp = urllib.request.urlopen(req).read().decode("utf-8").replace('\n','').replace('\r','').replace('\t','')
  519. wa = re.findall('<h3 class="entry-tittle"><a href="(.*?)" rel="bookmark">(.*?)</a>',resp)
  520. a = list()
  521. q = 1
  522. for link, clp, w, title in wa:
  523. a.append("(<b>%s</b>). <b>%s</b>" % (q, title, link))
  524. q += 1
  525. return "<br/>".join(a[0:10])
  526.  
  527. def serNonton123(args):
  528. headers = {}
  529. headers['User-Agent'] = "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.27 Safari/537.17"
  530. req = urllib.request.Request("http://www.nonton123.com/search/"+"+".join(args.split()), headers = headers)
  531. resp = urllib.request.urlopen(req).read().decode("utf-8").replace('\n','').replace('\r','').replace('\t','').replace('<u>','').replace('</u>','')
  532. wa = re.findall('<h2><a href="(.*?)" rel="bookmark" title="(.*?)">(.*?)</a></h2>',resp)
  533. a = list()
  534. q = 1
  535. for link, w, title in wa:
  536. a.append("(<b>%s</b>). <b>%s</b>" % (q, title))
  537. q += 1
  538. return "<br/>".join(a)
  539.  
  540. def newOn():
  541. headers = {}
  542. headers['User-Agent'] = "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.27 Safari/537.17"
  543. req = urllib.request.Request("http://www.otanimesama.com", headers = headers)
  544. resp = urllib.request.urlopen(req).read().decode("utf-8").replace('\n','').replace('\r','').replace('\t','')
  545. anjay = re.findall("<h2 class='post-title entry-title' itemprop='name headline' style='font-size: 100%;font-weight: 600;padding-top: 5px;padding-bottom: 4px;text-transform: uppercase;' title='(.*?)'><a href='(.*?)' title='(.*?)'>(.*?)</a></h2>", resp)
  546. setter = list()
  547. q = 1
  548. for cls, link, title, clp in anjay:
  549. setter.append('(<b>%s</b>). <b>%s</b>: %s' % (q, title, link))
  550. q += 1
  551. return "<br/>".join(setter[0:5])
  552.  
  553.  
  554. def newHp():
  555. headers = {}
  556. headers['User-Agent'] = "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.27 Safari/537.17"
  557. req = urllib.request.Request("http://henpoi.com/", headers = headers)
  558. resp = urllib.request.urlopen(req).read().decode("utf-8").replace('\n','').replace('Subtitle Indonesia','Sub Ina')
  559. res = re.findall("<h2 class='entry-title' itemprop='name'><a href='(.*?)'>(.*?)</a>", resp)
  560. newset = list()
  561. n = 1
  562. for a, b in res:
  563. newset.append("%s. <b>%s</b>: %s" % (n, b, a))
  564. n = n + 1
  565. return "<br/>".join(newset[0:5])
  566. def serHp(args):
  567. headers = {}
  568. headers['User-Agent'] = "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.27 Safari/537.17"
  569. req = urllib.request.Request("http://henpoi.com/search?q="+args, headers = headers)
  570. resp = urllib.request.urlopen(req).read().decode("utf-8").replace('\n','').replace('Subtitle Indonesia','Sub Ina')
  571. res = re.findall("<h2 class='entry-title' itemprop='name'><a href='(.*?)'>(.*?)</a>", resp)
  572. newset = list()
  573. n = 1
  574. for a, b in res:
  575. newset.append("%s. <b>%s</b>: %s" % (n, b, a))
  576. n = n + 1
  577. return "<br/>".join(newset[0:5])
  578.  
  579. def newWa():
  580. headers = {}
  581. headers['User-Agent'] = "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.27 Safari/537.17"
  582. req = urllib.request.Request("http://wardhanime.net/", headers = headers)
  583. resp = urllib.request.urlopen(req).read().decode("utf-8").replace('\n','').replace('\r','').replace('\t','')
  584. anjay = re.findall('<h1><a href="(.*?)" title="(.*?)">(.*?)</a>', resp)
  585. setter = list()
  586. q = 1
  587. for link, title, clp in anjay:
  588. setter.append('(<b>%s</b>). <b>%s</b>: %s' % (q, title, link))
  589. q += 1
  590. return "<br/>".join(setter[0:10])
  591.  
  592. def newGa():
  593. headers = {}
  594. headers['User-Agent'] = "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.27 Safari/537.17"
  595. req = urllib.request.Request("http://gantzid.com/", headers = headers)
  596. resp = urllib.request.urlopen(req).read().decode("utf-8").replace('\n','').replace('\r','').replace('\t','')
  597. anjay = re.findall('<h2><a href="(.*?)" title="(.*?)">(.*?)</a>', resp)
  598. setter = list()
  599. q = 1
  600. for link, title, clp in anjay:
  601. setter.append('(<b>%s</b>). <b>%s</b>: %s' % (q, title, link))
  602. q += 1
  603. return "<br/>".join(setter[0:10])
  604.  
  605. def newAs():
  606. headers = {}
  607. headers['User-Agent'] = "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.27 Safari/537.17"
  608. req = urllib.request.Request("http://animesave.com/", headers = headers)
  609. resp = urllib.request.urlopen(req).read().decode("utf-8").replace('\n','').replace('\r','').replace('\t','')
  610. anjay = re.findall('<h2><a href="(.*?)" title="(.*?)">(.*?)</a>', resp)
  611. setter = list()
  612. q = 1
  613. for link, title, clp in anjay:
  614. setter.append('(<b>%s</b>). <b>%s</b>: %s' % (q, title, link))
  615. q += 1
  616. return "<br/>".join(setter[0:10])
  617.  
  618. def newSk():
  619. headers = {}
  620. headers['User-Agent'] = "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.27 Safari/537.17"
  621. req = urllib.request.Request("http://www.samehadaku.net/", headers = headers)
  622. resp = urllib.request.urlopen(req).read().decode("utf-8").replace('\n','').replace('\r','').replace('\t','')
  623. anjay = re.findall('<h3 class="entry-title td-module-title"><a href="(.*?)" title="(.*?)">(.*?)</a>', resp)
  624. setter = list()
  625. q = 1
  626. for link, title, clp in anjay:
  627. setter.append('(<b>%s</b>). <b>%s</b>: %s' % (q, title, link))
  628. q += 1
  629. return "<br/>".join(setter[0:5])
  630.  
  631. def newAo():
  632. headers = {}
  633. headers['User-Agent'] = "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.27 Safari/537.17"
  634. req = urllib.request.Request("http://anisubindo.net/", headers = headers)
  635. resp = urllib.request.urlopen(req).read().decode("utf-8").replace('\n','').replace('\r','').replace('\t','')
  636. anjay = re.findall('<h3 class="post-box-title"><a href="(.*?)" title="(.*?)">(.*?)</a>', resp)
  637. setter = list()
  638. q = 1
  639. for link, title, clp in anjay:
  640. setter.append('(<b>%s</b>). <b>%s</b>: %s' % (q, title, link))
  641. q += 1
  642. return "<br/>".join(setter[0:5])
  643.  
  644. def newFs():
  645. headers = {}
  646. headers['User-Agent'] = "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.27 Safari/537.17"
  647. req = urllib.request.Request("http://fansatsu.com/", headers = headers)
  648. resp = urllib.request.urlopen(req).read().decode("utf-8").replace('\n','').replace('\r','').replace('\t','')
  649. anjay = re.findall('<h2 class="title front-view-title" itemprop="headline"><a href="(.*?)" title="(.*?)">(.*?)</a></h2>', resp)
  650. setter = list()
  651. q = 1
  652. for link, title, clp in anjay:
  653. setter.append('(<b>%s</b>). <b>%s</b>: %s' % (q, title, link))
  654. q += 1
  655. return "<br/>".join(setter[0:10])
  656.  
  657. def newNk():
  658. headers = {}
  659. headers['User-Agent'] = "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.27 Safari/537.17"
  660. req = urllib.request.Request("https://nekonime.com/", headers = headers)
  661. resp = urllib.request.urlopen(req).read().decode("utf-8").replace('\n','').replace('\r','').replace('\t','')
  662. anjay = re.findall('<h3><a href="(.*?)" title="(.*?)">(.*?)</a>', resp)
  663. setter = list()
  664. q = 1
  665. for link, title, clp in anjay:
  666. setter.append('(<b>%s</b>). <b>%s</b>: %s' % (q, title, link))
  667. q += 1
  668. return "<br/>".join(setter[0:10])
  669.  
  670. def newKr():
  671. headers = {}
  672. headers['User-Agent'] = "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.27 Safari/537.17"
  673. req = urllib.request.Request("http://www.kurogaze.net/", headers = headers)
  674. resp = urllib.request.urlopen(req).read().decode("utf-8").replace('\n','').replace('\r','').replace('\t','')
  675. anjay = re.findall('<h2><a href="(.*?)" title="(.*?)">(.*?)</a>', resp)
  676. setter = list()
  677. q = 1
  678. for link, title, clp in anjay:
  679. setter.append('(<b>%s</b>). <b>%s</b>: %s' % (q, title, link))
  680. q += 1
  681. return "<br/>".join(setter[0:10])
  682.  
  683. def newNb():
  684. headers = {}
  685. headers['User-Agent'] = "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.27 Safari/537.17"
  686. req = urllib.request.Request("http://www.narutobleachlover.net/", headers = headers)
  687. resp = urllib.request.urlopen(req).read().decode("utf-8").replace('\n','').replace('\r','').replace('\t','')
  688. anjay = re.findall('<h3><a href="(.*?)" title="(.*?)">(.*?)</a>', resp)
  689. setter = list()
  690. q = 1
  691. for link, title, clp in anjay:
  692. setter.append('(<b>%s</b>). <b>%s</b>: %s' % (q, title, link))
  693. q += 1
  694. return "<br/>".join(setter[0:10])
  695.  
  696. def newIs():
  697. headers = {}
  698. headers['User-Agent'] = "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.27 Safari/537.17"
  699. req = urllib.request.Request("http://www.imoutosubs.net/", headers = headers)
  700. resp = urllib.request.urlopen(req).read().decode("utf-8").replace('\n','').replace('\r','').replace('\t','')
  701. anjay = re.findall('<h2><a href="(.*?)" title="(.*?)">(.*?)</a>', resp)
  702. setter = list()
  703. q = 1
  704. for link, title, clp in anjay:
  705. setter.append('(<b>%s</b>). <b>%s</b>: %s' % (q, title, link))
  706. q += 1
  707. return "<br/>".join(setter[0:10])
  708.  
  709. def newEn():
  710. headers = {}
  711. headers['User-Agent'] = "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.27 Safari/537.17"
  712. req = urllib.request.Request("http://ettonime.com/", headers = headers)
  713. resp = urllib.request.urlopen(req).read().decode("utf-8").replace('\n','').replace('\r','').replace('\t','')
  714. anjay = re.findall('<h2><a href="(.*?)" title="(.*?)">(.*?)</a>', resp)
  715. setter = list()
  716. q = 1
  717. for link, title, clp in anjay:
  718. setter.append('(<b>%s</b>). <b>%s</b>: %s' % (q, title, link))
  719. q += 1
  720. return "<br/>".join(setter[0:10])
  721.  
  722. def newJoi():
  723. headers = {}
  724. headers['User-Agent'] = "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.27 Safari/537.17"
  725. req = urllib.request.Request("http://jurnalotaku.com/", headers = headers)
  726. resp = urllib.request.urlopen(req).read().decode("utf-8")
  727. Data = re.findall('<a href="(.*?)" class="title"><h3><span>(.*?)</span>', resp)
  728. lolly = list()
  729. anjeng = 1
  730. for lk, tit in Data:
  731. lolly.append(('%s. <b>%s</b>: %s' % (anjeng, tit, lk)))
  732. anjeng = anjeng+1
  733. return "<br/>".join(lolly[0:5])
  734.  
  735. def serOn(args):
  736. headers = {}
  737. headers['User-Agent'] = "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.27 Safari/537.17"
  738. req = urllib.request.Request("http://www.otanimesama.com/search?q="+args, headers = headers)
  739. resp = urllib.request.urlopen(req).read().decode("utf-8").replace('\n','').replace('\r','').replace('\t','')
  740. anjay = re.findall("<h2 class='post-title entry-title' itemprop='name headline' style='font-size: 100%;font-weight: 600;padding-top: 5px;padding-bottom: 4px;text-transform: uppercase;' title='(.*?)'><a href='(.*?)' title='(.*?)'>(.*?)</a></h2>", resp)
  741. setter = list()
  742. q = 1
  743. for cls, link, title, clp in anjay:
  744. setter.append('(<b>%s</b>). <b>%s</b>: %s' % (q, title, link))
  745. q += 1
  746. return "<br/>".join(setter[0:5])
  747.  
  748. def serAs(args):
  749. headers = {}
  750. headers['User-Agent'] = "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.27 Safari/537.17"
  751. req = urllib.request.Request("http://animesave.com/?s="+args, headers = headers)
  752. resp = urllib.request.urlopen(req).read().decode("utf-8").replace('\n','').replace('\r','').replace('\t','')
  753. anjay = re.findall('<h2><a href="(.*?)" title="(.*?)">(.*?)</a>', resp)
  754. setter = list()
  755. q = 1
  756. for link, title, clp in anjay:
  757. setter.append('(<b>%s</b>). <b>%s</b>: %s' % (q, title, link))
  758. q += 1
  759. return "<br/>".join(setter[0:5])
  760.  
  761. def serWa(args):
  762. headers = {}
  763. headers['User-Agent'] = "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.27 Safari/537.17"
  764. req = urllib.request.Request("http://wardhanime.net/search/"+args, headers = headers)
  765. resp = urllib.request.urlopen(req).read().decode("utf-8").replace('\n','').replace('\r','').replace('\t','')
  766. anjay = re.findall('<h2><a href="(.*?)" title="(.*?)">(.*?)</a>', resp)
  767. setter = list()
  768. q = 1
  769. for link, title, clp in anjay:
  770. setter.append('(<b>%s</b>). <b>%s</b>: %s' % (q, title, link))
  771. q += 1
  772. return "<br/>".join(setter[0:10])
  773.  
  774. def serFs(args):
  775. headers = {}
  776. headers['User-Agent'] = "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.27 Safari/537.17"
  777. req = urllib.request.Request("http://fansatsu.com/?s="+args, headers = headers)
  778. resp = urllib.request.urlopen(req).read().decode("utf-8").replace('\n','').replace('\r','').replace('\t','')
  779. anjay = re.findall('<h2 class="title front-view-title" itemprop="headline"><a href="(.*?)" title="(.*?)">(.*?)</a></h2>', resp)
  780. setter = list()
  781. q = 1
  782. for link, title, clp in anjay:
  783. setter.append('(<b>%s</b>). <b>%s</b>: %s' % (q, title, link))
  784. q += 1
  785. return "<br/>".join(setter[0:5])
  786.  
  787. def serOp(args):
  788. headers = {}
  789. headers['User-Agent'] = "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.27 Safari/537.17"
  790. req = urllib.request.Request('http://www.oploverz.net/?s='+args+'&post_type=post', headers = headers)
  791. resp = urllib.request.urlopen(req).read().decode("utf-8").replace('\n','').replace('\r','').replace('\t','')
  792. anjay = re.findall('<h2><a href="(.*?)" title="(.*?)">(.*?)</a>', resp)
  793. setter = list()
  794. q = 1
  795. for link, title, clp in anjay:
  796. setter.append('(<b>%s</b>). <b>%s</b>: %s' % (q, title, link))
  797. q += 1
  798. return "<br/>".join(setter[0:10])
  799.  
  800. def serKg(args):
  801. headers = {}
  802. headers['User-Agent'] = "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.27 Safari/537.17"
  803. req = urllib.request.Request('http://www.kurogaze.net/?s='+args+'&post_type=post', headers = headers)
  804. resp = urllib.request.urlopen(req).read().decode("utf-8").replace('\n','').replace('\r','').replace('\t','')
  805. anjay = re.findall('<h2><a href="(.*?)" title="(.*?)">(.*?)</a>', resp)
  806. setter = list()
  807. q = 1
  808. for link, title, clp in anjay:
  809. setter.append('(<b>%s</b>). <b>%s</b>: %s' % (q, title, link))
  810. q += 1
  811. return "<br/>".join(setter[0:10])
  812.  
  813. def gis(cari):
  814. argss = cari
  815. args = argss.split()
  816. headers = {}
  817. headers['User-Agent'] = "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.27 Safari/537.17"
  818. req = urllib.request.Request("https://www.google.co.id/search?hl=en&authuser=0&site=imghp&tbm=isch&source=hp&biw=1366&bih=623&q=" + "+".join(args), headers = headers)
  819. resp = urllib.request.urlopen(req).read().decode("utf-8").replace('\n','').replace('\r','').replace('\t','').replace('http://','gis:').replace('https://','gis:').replace('.jpg','.jpg:end').replace('.gif','.gif:end').replace('.png','.png:end')
  820. anjay = re.findall('<div class="rg_meta">(.*?)</div>', resp)
  821. setter = list()
  822. la = "".join(anjay)
  823. a = re.findall('"ou":"gis:(.*?):end","ow"', la)
  824. q = 1
  825. for result in a:
  826. if ".jpg" in result or ".gif" in result or ".png" in result:
  827. if "vignette" not in result and "mhcdn.net" not in result and "alicdn.com" not in result and "gambardanfoto.com" not in result and "squarespace.com" not in result and "polyvore.com" not in result and "wikia.nocookie" not in result and "blogspot.com" not in result and "wordpress.com" not in result and "minionnation.co.uk" not in result and "twimg.com" not in result and "ohmymag.com" not in result and "waterfrontcinema.co.uk" not in result and "funmobility.netdna-ssl.com" not in result and "images-amazon.com" not in result and "upload.wikimedia.org" not in result:
  828. setter.append('<f x11CC33CC="0">[%s] http://%s' % (q, result))
  829. q += 1
  830. return "<f x1133FF33=\"0\"></f>Hasil untuk <f x11FFFF33=\"0\"></f>"+cari+" :<br/><br/>"+"<br/>".join(setter[0:1])
  831.  
  832. def saveRank():
  833. f = open("owners.txt","w")
  834. f.write("\n".join(owners))
  835. f.close()
  836. f = open("admin.txt","w")
  837. f.write("\n".join(admin))
  838. f.close()
  839. f = open("archknight.txt","w")
  840. f.write("\n".join(archknight))
  841. f.close()
  842. f = open("whitelist.txt","w")
  843. f.write("\n".join(whitelist))
  844. f.close()
  845.  
  846. def googleSearch(search):
  847. try:
  848. encoded = urllib.parse.quote(search)
  849. rawData = urllib.request.urlopen("http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q="+encoded).read().decode("utf-8")
  850. jsonData = json.loads(rawData)
  851. searchResults = jsonData["responseData"]["results"]
  852. full = []
  853. val = 1
  854. for data in searchResults:
  855. if "youtube" in data["url"]:
  856. data["url"] = "http://www.youtube.com/watch?v="+data["url"][35:]
  857. full.append("<br/>"+"(<b>%s</b> %s -> %s" % (val, data["title"], data['url']))
  858. val = val + 1
  859. return '<br/>'.join(full).replace('https://','http://')
  860. except Exception as e:
  861. return str(e)
  862.  
  863.  
  864.  
  865.  
  866. ##Setting Pretty Colors
  867.  
  868. class TestBot(ch.RoomManager):
  869.  
  870. def onInit(self):
  871. self.setNameColor("FF99FF")
  872. self.setFontColor("33CC00")
  873. self.setFontFace("Monotype Corsiva")
  874. self.setFontSize(14)
  875. self.enableBg()
  876. self.enableRecording()
  877.  
  878. ##Connecting Crap
  879.  
  880. def onConnect(self, room):
  881. print("Connected")
  882.  
  883. def onReconnect(self, room):
  884. print("Reconnected")
  885.  
  886. def onDisconnect(self, room):
  887. print("Disconnected")
  888.  
  889. #################################################################
  890. ### Get user access from the file, and retun lvl of access number
  891. #################################################################
  892. def getAccess(self, user):
  893. if user.name in owners: return 6 # Owners
  894. elif user.name in admin: return 5 # Admins
  895. elif user.name in archwizard:return 4 # Arch Wizard
  896. elif user.name in archknight: return 3 # Arch Knight
  897. elif user.name in player: return 2 # Player
  898. elif user.name in whitelist: return 1
  899. elif user.name in dlist: return 0
  900. else: return 0
  901.  
  902. ##Ignore this, you dont need to worry about this
  903. #Well, you can actually take a little time to look at it and learn something
  904.  
  905. def onMessage(self, room, user, message):
  906. try:
  907. if room.getLevel(self.user) > 0:
  908. user_ip.update({user.name:message.ip})
  909. f = open('userip.txt', "w")
  910. f.write(str(user_ip))
  911. f.close
  912. if user.name not in ip_whois:
  913. ip_var = message.ip
  914. ip_whois.update({user.name:[ip_var]})
  915. if user.name in ip_whois:
  916. ip_var = message.ip
  917. if ip_var in ip_whois[user.name]:
  918. pass
  919. else:
  920. ip_whois[user.name].append(ip_var)
  921. f = open('ip_whois.txt', "w")
  922. f.write(str(ip_whois))
  923. f.close
  924. if user:
  925. unid = str(message.unid)
  926. if user.name not in sid_whois:
  927. sid_whois.update({user.name:[unid]})
  928. if user.name in sid_whois:
  929. if unid == "":
  930. return
  931. if unid in sid_whois[user.name]:
  932. pass
  933. else:
  934. sid_whois[user.name].append(unid)
  935. f = open('sid_whois.txt', "w")
  936. f.write(str(sid_whois))
  937. f.close
  938. except:pass
  939. try:
  940. msgdata = message.body.split(" ",1)
  941. if len(msgdata) > 1:
  942. cmd, args = msgdata[0], msgdata[1]
  943. else:
  944. cmd, args = msgdata[0],""
  945. cmd=cmd.lower()
  946. global lockdown
  947. global newnum
  948. print(user.name+" - "+message.body)
  949. if user.name in notif:
  950. room.message(user.name+", you got ("+str(len(sn[user.name]))+") messages unread. Do irn to read them")
  951. notif.remove(user.name)
  952. if user == self.user: return
  953. if "touma" in message.body.lower() or "Touma" in message.body.lower() and "^" not in message.body[:1]:
  954. if len(args) > 1:
  955. room.message(__import__("simi").simi(args),True)
  956. else:
  957. room.message("Iya? "+sntonick(user.name), True)
  958. if message.body.startswith("sepi"):
  959. if self.getAccess(user) >= 6:
  960. jawab = ["Kan ada aku","aku ada disini "]
  961. room.message (random.choice(jawab) +sntonick(user.name)+" :D",True)
  962. else:
  963. room.message("Ada aku kok")
  964. if message.body.startswith("kacang"):
  965. if self.getAccess(user) >= 6:
  966. jawab = ["Yang sabar yah kak","Mampus Dikacangin","Kacang mahal :v"]
  967. room.message(random.choice(jawab)+" @"+user.name)
  968. else:
  969. room.message("Cie yang di kacangin")
  970. if message.body.startswith("Test") or message.body.startswith("test"):
  971. if user.name == "":
  972. jawab = ["Iye","Bacod","Berisik amat lu","Masuk"]
  973. room.message(random.choice(jawab)+" @"+user.name)
  974. if self.getAccess(user) <= 5 and not user.name in blacklist:
  975. room.message("Test Accept "+sntonick(user.name)+" :D")
  976. if message.body.startswith("Haru") or message.body.startswith("haru"):
  977. if self.getAccess(user) >= 5 or room.getLevel(user) > 0 and not user.name in blacklist:
  978. jawab = ["Ya, Kak","Ada apa kakak?"]
  979. room.message(random.choice(jawab)+" @"+user.name+" :D")
  980. else:
  981. room.message("Siapa yah?")
  982. if message.body.startswith("Natsuru mana?"):
  983. if self.getAccess(user) >= 1 or room.getLevel(user) > 0 and not user.name in blacklist:
  984. room.message("Natsurunya lagi pulang kampung XD")
  985. if message.body.startswith("oyasumi")or message.body.startswith("Oyasumi"):
  986. if self.getAccess(user) >= 1 or room.getLevel(user) > 0 and not user.name in blacklist:
  987. room.message (random.choice(["Oyasumi, "+sntonick(user.name)+" :D ",]),True)
  988. if message.body.startswith("ohayou")or message.body.startswith("Ohayou"):
  989. if self.getAccess(user) >= 1 or room.getLevel(user) > 0 and not user.name in blacklist:
  990. room.message (random.choice(["Ohayou, "+sntonick(user.name)+" :D ",]),True)
  991. if message.body.startswith("konnichiwa")or message.body.startswith("Konnichiwa"):
  992. if self.getAccess(user) >= 1 or room.getLevel(user) > 0 and not user.name in blacklist:
  993. room.message (random.choice(["Konnichiwa, "+sntonick(user.name)+" :D ",]),True)
  994. if message.body.startswith("konbanwa") or message.body.startswith("Konbanwa"):
  995. if self.getAccess(user) >= 1 or room.getLevel(user) > 0 and not user.name in blacklist:
  996. room.message (random.choice(["Konbanwa, "+sntonick(user.name)+" :D ",]),True)
  997. if message.body.startswith("afk") or message.body.startswith("AFK"):
  998. if self.getAccess(user) >= 1 or room.getLevel(user) > 0 and not user.name in blacklist:
  999. room.message (random.choice(["See ya, aku tunggu loh "+sntonick(user.name)+" :D ",]),True)
  1000. if message.body.startswith("back") or message.body.startswith("BACK"):
  1001. if self.getAccess(user) >= 1 or room.getLevel(user) > 0 and not user.name in blacklist:
  1002. room.message (random.choice(["Welcome Back, "+sntonick(user.name)+" :D ",]),True)
  1003. if message.body.startswith("brb")or message.body.startswith("BRB"):
  1004. if self.getAccess(user) >= 1 or room.getLevel(user) > 0 and not user.name in blacklist:
  1005. room.message (random.choice(["Bye "+sntonick(user.name)+" :) ",]),True)
  1006. if message.body.startswith("off")or message.body.startswith("OFF"):
  1007. if self.getAccess(user) >= 1 or room.getLevel(user) > 0 and not user.name in blacklist:
  1008. room.message (random.choice(["Bye "+sntonick(user.name)+" :D ",]),True)
  1009. if message.body == "": return
  1010. if message.body[0] in ["!"] or message.body[0] in [">"]:
  1011. data = message.body[1:].split("!", 1)
  1012. if len(data) > 1:
  1013. cmd, args = data[0], data[1]
  1014. else:
  1015. cmd, args = data[0], ""
  1016.  
  1017.  
  1018. ##BotStop
  1019. if cmd == "stop" and user.name == "toumabot":##ISI ID LU
  1020. if user.name == "Evrytimescarlet":##ISI ID LU
  1021. room.message("[Disconnected]")
  1022. self.setTimeout(4, self.stop, )
  1023. else:
  1024. rom.message("Who are you")
  1025. ## Reg
  1026. if cmd == "whitelist":
  1027. name = user.name
  1028. if name not in whitelist and name not in player and name not in archwizard and name not in owners and name not in admin and name not in archknight and name not in blacklist:
  1029. room.message(user.name+" sekarang kamu dapat menggunakanku , ketik ^cmds untuk perintah :)")
  1030. whitelist.append(name)
  1031. f = open("whitelist.txt","w")
  1032. f.write("\n".join(whitelist))
  1033. f.close
  1034. else:
  1035. room.message("Perasaan dah terdaftar")
  1036.  
  1037. ##check access and ignore
  1038. if self.getAccess(user) == 0: return
  1039. def pars(args):
  1040. args=args.lower()
  1041. for name in room.usernames:
  1042. if args in name:return name
  1043. def roompars(args):
  1044. args = args.lower()
  1045. for name in self.roomnames:
  1046. if args in name:return name
  1047. def roomUsers():
  1048. usrs = []
  1049. gay = []
  1050. prop = 0
  1051. prop = prop + len(room._userlist) - 1
  1052. for i in room._userlist:
  1053. i = str(i)
  1054. usrs.append(i)
  1055. while prop >= 0:
  1056. j = usrs[prop].replace("<User: ", "")
  1057. i = j.replace(">", "")
  1058. gay.append(i)
  1059. prop = prop - 1
  1060. return gay
  1061.  
  1062. def getParticipant(arg):
  1063. rname = self.getRoom(arg)
  1064. usrs = []
  1065. gay = []
  1066. finale = []
  1067. prop = 0
  1068. prop = prop + len(rname._userlist) - 1
  1069. for i in rname._userlist:
  1070. i = str(i)
  1071. usrs.append(i)
  1072. while prop >= 0:
  1073. j = usrs[prop].replace("<User: ", "")
  1074. i = j.replace(">", "")
  1075. gay.append(i)
  1076. prop = prop - 1
  1077. for j in gay:
  1078. if j not in finale:
  1079. finale.append(j)
  1080. return finale
  1081. if cmd == "lockstatus":
  1082. if room.name in locks:
  1083. roomlock = "<f x11FF0000='0'>Locked</f>"
  1084. else:
  1085. roomlock = "<f x1133FF33='0'>Unlocked</f>"
  1086. room.message("<br/> [Lockstatus] <br/>"+roomlock+"",True)
  1087.  
  1088. if lockdown: return
  1089. if user.name in whitelist and user.name in player and room.name in locks: return
  1090. ##AFKlist
  1091. if cmd == "afklist":
  1092. room.message("<br/><f x120000FF='0'><b>Daftar orang Yang sedang AFK:</b></f> %s" % (", ".join(afks)),True)
  1093.  
  1094. #Find
  1095. if cmd == "find" and len(args) > 0:
  1096. name = args.split()[0].lower()
  1097. if not ch.User(name).roomnames:
  1098. room.message("aku tidak tau")
  1099. else:
  1100. room.message("kamu dapat menemukan %s Di %s" % (args, ", ".join(ch.User(name).roomnames)),True)
  1101.  
  1102. ##RB
  1103. elif cmd == "rb":
  1104. if args == "":
  1105. rain = rainbow('Rainbow!')
  1106. room.message(rain,True)
  1107. else:
  1108. rain = rainbow(args)
  1109. room.message(rain,True)
  1110.  
  1111. elif cmd == "rb2":
  1112. if args == "":
  1113. rain = rainbow('Rainbow!')
  1114. room.message(rain)
  1115. else:
  1116. rain = rainbow(args)
  1117. room.message(rain)
  1118. ##cmds
  1119. elif cmd == "cmds":
  1120. if user.name in owners and not user.name in admin and not user.name in archknight and not user.name in whitelist:
  1121. room.message("<br/>"+user.name+" Rank 6 [Owner] "+"<br/>"+" Perintah[ ^ ] :<br/>rb , rb2 , wl , whois , webanime , cso , pfpic , mini , prof of profile , gs(Google search) , yt(Youtube) , df(define) , udf(undefine) , fax , bc , sn(sendnote) , rn(readnote) , join , leave , mydict , nick , staff , setnick , mynick , seenick , profile , rank , myrank , ranker , clear , del , sf , sfc, snc , sfz , myip , mc , mc2 , lock , unlock , lockstatus",True)
  1122. if user.name in admin and not user.name in owners and not user.name in archknight and not user.name in whitelist:
  1123. room.message("<br/>"+user.name+" Rank 5 [Admin] "+"<br/>"+" Perintah[ ^ ] :<br/>rb , rb2 , wl , whois , webanime , cso , pfpic , mini , prof of profile , gs(Google search) , yt(Youtube) , df(define) , udf(undefine) , fax , bc , sn(sendnote) , rn(readnote) , join , leave , mydict, nick , staff , setnick , mynick , seenick , profile , rank , myrank , ranker , clear , del , sf , sfc, snc , sfz , myip , mc , mc2 , lock , unlock , lockstatus",True)
  1124. if user.name in archwizard and not user.name in owners and not user.name in admin and not user.name in whitelist:
  1125. room.message("<br/>"+user.name+" Rank 4 [ArchWizard] "+"<br/>"+" Perintah[ ^ ] :<br/>rb , rb2 , wl , whois , webanime , cso , pfpic , mini , prof of profile , gs(Google search) , gis(Google Image search) , yt(Youtube) , df(define) , udf(undefine) , fax , bc , sn(sendnote) , rn(readnote), mydict, nick , staff , setnick , mynick , seenick , profile , rank , myrank , ranker , myip , mc(MultiChat) , mc2(MultiChat) , lock , unlock , lockstatus",True)
  1126. if user.name in archknight and not user.name in owners and not user.name in admin and not user.name in whitelist:
  1127. room.message("<br/>"+user.name+" Rank 3 [Archknight] "+"<br/>"+" Perintah[ ^ ] :<br/>rb , rb2 , wl , whois , webanime , cso , pfpic , mini , prof of profile , gs(Google search) , gis(Google Image search) , yt(Youtube) , df(define) , udf(undefine) , fax , sn(sendnote) , rn(readnote), mydict, nick , staff , setnick , mynick , seenick , profile , rank , myrank , ranker , myip , mc(MultiChat) , mc2(MultiChat) , lock , unlock , lockstatus",True)
  1128. if user.name in player and not user.name in owners and not user.name in admin and not user.name in whitelist:
  1129. room.message("<br/>"+user.name+" Rank 2 [Player] "+"<br/>"+" Perintah[ ^ ] :<br/>rb , rb2 , wl , webanime , cso , pfpic , mini , prof of profile , gs(Google search) , gis(Google Image search) , yt(Youtube) , df(define) , udf(undefine) , fax , sn(sendnote) , rn(readnote), mydict, nick , staff , setnick , mynick , seenick , profile , rank , myrank , ranker , myip , mc(MultiChat) , mc2(MultiChat) , lock , unlock , lockstatus",True)
  1130. if user.name in whitelist and not user.name in owners and not user.name in admin and not user.name in archknight:
  1131. room.message("<br/>"+user.name+" Rank 1 [Whitelist] "+"<br/>"+" Perintah[ ^ ] :<br/>rb , rb2 , wl , whois , webanime , cso , pfpic , mini , prof of profile , gs(Google search) , gis(Google Image search) , yt(Youtube) , df(define) , udf(undefine) , sn(sendnote) , rn(readnote), mydict , nick , staff , setnick , mynick , seenick , profile , rank , myrank , ranker , myip , mc(MultiChat) , mc2(MultiChat) , lockstatus",True)
  1132.  
  1133. ### MultiChat
  1134. elif cmd == "multichat" or cmd == "mc" or cmd == "MultiChat" or cmd == "Mc":
  1135. if args == "":
  1136. room.message("My Default room : www.mio-chat.chatango.com")
  1137. else:
  1138. room.message("Done ! , This is your Room : http://ch.besaba.com/chat/flash/?"+args+"!")
  1139. elif cmd == "multichat2" or cmd == "mc2":
  1140. if args == "":
  1141. room.message("My Default room : http://ch.besaba.com/chat/html5/?anibatch!,mio-chat!,dhikas-blog!,eksperimen!,ladiessplay!,momotarosatsu!,natsurubasecamp!,nosobafansubs!,poru-chat!")
  1142. else:
  1143. room.message("Done : http://ch.besaba.com/chat/html5/?"+(args)+"!")
  1144. #### MyIp
  1145. elif cmd =="myip" or cmd == "MyIp" or cmd == "MyIP" or cmd == "My IP Adress":
  1146. try:
  1147. room.message("IP address kamu adalah : "+message.ip)
  1148. except:
  1149. room.message("Gagal melihat IP address, Aku bukan mods disini.")
  1150. ##testcmd
  1151. if cmd == "webanime":
  1152. room.message("<f x12F00='1'>Web Anime Untuk Sekarang:<f x12334433='1'><br/>1. Animeindo.id : ainew(new update on animeindo.id).<br/>2. Imoutosubs.com : isnew(new update on imoutosubs).<br/>3. Narutobleachlover.net : nbnew(new update on narutobleachlover).<br/>4. Kurogoze.net : krnew(new update on kurogaze) , krsr(kurogaze search).<br/>5. Nekonime.com : nknew(new update on nekonime).<br/>6. Animesave.com : asnew(new update on animesave.com) , assr(animesave.com search).<br/>7. Wardhanime.net : wanew(new update on wardhanime) , wasr(wardhanime search).<br/>8. Otanimesama : otnew(new update on otanimesama) , otsr(otanime search).<br/>9. Oploverz.net : opnew(new update on oploverz) , opsr(oploverz search).<br/>10. Fasatsu.com : fsnew(new update on fansatsu) , fssr(search fansatsu movie or anime).<br/>11. Samehadaku.net : sknew(new update on samehadaku).<br/>12.Anisubindo.net : aonew (new update on anisubindo.", True)
  1153. if cmd == "opnew": room.message(newOp(), True)
  1154. if cmd == "hpnew": room.message(newHp(), True)
  1155. if cmd == "otnew": room.message(newOn(), True)
  1156. if cmd == "otsr": room.message(serOn(args), True)
  1157. if cmd == "wanew": room.message(newWa(), True)
  1158. if cmd == "gannew": room.message(newGa(), True)
  1159. if cmd == "sknew": room.message(newSk(), True)
  1160. if cmd == "asnew": room.message(newAs(), True)
  1161. if cmd == "annew": room.message(newAn(), True)
  1162. if cmd == "aonew": room.message(newAo(), True)
  1163. if cmd == "nknew": room.message(newNk(), True)
  1164. if cmd == "krnew": room.message(newKr(), True)
  1165. if cmd == "nbnew": room.message(newNb(), True)
  1166. if cmd == "wasr": room.message(serWa(args), True)
  1167. if cmd == "joinew": room.message(newJoi(), True)
  1168. if cmd == "ennew": room.message(newEn(), True)
  1169. if cmd == "ainew": room.message(newAi(), True)
  1170. if cmd == "fsnew": room.message(newFs(), True)
  1171. if cmd == "fssr": room.message(serFs(args), True)
  1172. if cmd == "bgtime": room.message(bgtime(args), True)
  1173. if cmd == "n123": room.message(newNonton123(), True)
  1174. if cmd == "n123sr": room.message(serNonton123(args), True)
  1175. if cmd == "hpsr": room.message(serHp(), True)
  1176. if cmd == "opsr": room.message(serOp(args), True)
  1177. if cmd == "krsr": room.message(serKg(args), True)
  1178. if cmd == "assr": room.message(serAs(args), True)
  1179. ##List Mods
  1180. #List of Mods and Owner name in the current room you're in
  1181. elif cmd == "mods" or cmd == "Mods":
  1182. args = args.lower()
  1183. if not args:
  1184. room.message("<br/><font color='#9999FF'><b>Owner</b></font>: <u><b>"+(room.ownername)+"</b></u> <br/><font color='#9999FF'><b>Mods</b></font>: "+", ".join(room.modnames), True)
  1185. return
  1186. if args in self.roomnames:
  1187. moda = self.getRoom(args).modname
  1188. own = self.getRoom(args).ownername
  1189. room.message("<br/><font color='#9999FF'><b>Owner</b></font>: <b><u>"+(own)+"</u></b> <br/><font color='#9999FF'><b>Mods</b></font>: "+", ".join(moda), True)
  1190. else:
  1191. self.joinRoom(args)
  1192. cek_mods[user.name] = json.dumps([room.name,args])
  1193. ##Join Player
  1194. elif (cmd == "register" or cmd == "reg" or cmd == "regist"):
  1195. if self.getAccess(user) == 1 and not user.name in owners and not user.name in admin and not user.name in archwizard and not user.name in archknight:
  1196. player.append(user.name)
  1197. room.message(user.name+" has registered as a Player. ^^")
  1198. #### Ban / Unban
  1199. if cmd == "ban":
  1200. if room.getLevel(user) > 0:
  1201. if room.getLevel(self.user) > 0 :
  1202. room.banUser(ch.User(args))
  1203. room.message(args.title()+" is Banned")
  1204. self.pm.message(ch.User(args.lower()), "You have been banned from %s by %s." % (room.name, user.name))
  1205.  
  1206. if cmd == "unban":
  1207. if room.getLevel(user) > 0:
  1208. if room.getLevel(self.user) > 0:
  1209. room.unban(ch.User(args))
  1210. room.message(args.title()+" is UnBanned")
  1211. self.pm.message(ch.User(args.lower()), "You have been unbanned from %s by %s." % (room.name, user.name))
  1212. #### Restart
  1213. elif cmd =="restart" or cmd == "Restart" or cmd == "Reconnect" or cmd == "reconnect" and self.getAccess(user) >= 3:
  1214. if user.name in owners:
  1215. room.reconnect()
  1216. else:
  1217. room.message("Ce ??? *lol*")
  1218. ## Ban List
  1219. if cmd == "banlist" and self.getAccess(user) >= 1:
  1220. room.message("The banlist is: "+str(room.banlist))
  1221.  
  1222.  
  1223. ##Setnick
  1224. if cmd == "setnick":
  1225. if self.getAccess(user) < 5:return
  1226. try:
  1227. if args:
  1228. user, nick = args.split(" ",1)
  1229. nicks[user]=json.dumps(nick)
  1230. room.message("Sukses")
  1231. f = open("nicks.txt","w")
  1232. for user in nicks:
  1233. nick = json.loads(nicks[user])
  1234. f.write(json.dumps([user,nick])+"\n")
  1235. f.close()
  1236. else:
  1237. room.message("Who?")
  1238. except:
  1239. room.message("The nick please")
  1240.  
  1241.  
  1242. ##Setrank
  1243. if cmd == "setrank":
  1244. if self.getAccess(user) < 6:return
  1245. try:
  1246. if len(args) >= 3:
  1247. name = args
  1248. if pars(name) == None:
  1249. name = name
  1250. elif pars(name) != None:
  1251. name = pars(name)
  1252. name, rank = args.lower().split(" ", 1)
  1253. if rank == "6":
  1254. owners.append(name)
  1255. f = open("owners.txt", "w")
  1256. f.write("\n".join(owners))
  1257. f.close()
  1258. room.message("Sukses")
  1259. if name in admin:
  1260. admin.remove(name)
  1261. f = open("admin.txt", "w")
  1262. f.write("\n".join(admin))
  1263. f.close()
  1264. if name in archwizard:
  1265. archwizard.remove(name)
  1266. f = open("archwizard.txt", "w")
  1267. f.write("\n".join(archwizard))
  1268. f.close()
  1269. if name in archknight:
  1270. archknight.remove(name)
  1271. f = open("archknight.txt", "w")
  1272. f.write("\n".join(archknight))
  1273. f.close()
  1274. if name in player:
  1275. player.remove(name)
  1276. f = open("player.txt", "w")
  1277. f.write("\n".join(player))
  1278. f.close()
  1279. if name in whitelist:
  1280. whitelist.remove(name)
  1281. f = open("whitelist.txt", "w")
  1282. f.write("\n".join(whitelist))
  1283. f.close()
  1284. if rank == "5":
  1285. admin.append(name)
  1286. f = open("admin.txt", "w")
  1287. f.write("\n".join(admin))
  1288. f.close()
  1289. room.message("Sukses")
  1290. if name in archwizard:
  1291. archwizard.remove(name)
  1292. f = open("archwizard.txt", "w")
  1293. f.write("\n".join(archwizard))
  1294. f.close()
  1295. if name in archknight:
  1296. archknight.remove(name)
  1297. f = open("archknight.txt", "w")
  1298. f.write("\n".join(archknight))
  1299. f.close()
  1300. if name in player:
  1301. player.remove(name)
  1302. f = open("player.txt", "w")
  1303. f.write("\n".join(player))
  1304. f.close()
  1305. if name in whitelist:
  1306. whitelist.remove(name)
  1307. f = open("whitelist.txt", "w")
  1308. f.write("\n".join(whitelist))
  1309. f.close()
  1310. if rank == "4":
  1311. archwizard.append(name)
  1312. f = open("archwizard.txt", "w")
  1313. f.write("\n".join(archwizard))
  1314. f.close()
  1315. room.message("Sukses")
  1316. if name in admin:
  1317. admin.remove(name)
  1318. f = open("admin.txt", "w")
  1319. f.write("\n".join(admin))
  1320. f.close()
  1321. if name in archknight:
  1322. archknight.remove(name)
  1323. f = open("archknight.txt", "w")
  1324. f.write("\n".join(archknight))
  1325. f.close()
  1326. if name in player:
  1327. player.remove(name)
  1328. f = open("player.txt", "w")
  1329. f.write("\n".join(player))
  1330. f.close()
  1331. if name in whitelist:
  1332. whitelist.remove(name)
  1333. f = open("whitelist.txt", "w")
  1334. f.write("\n".join(whitelist))
  1335. f.close()
  1336. if rank == "3":
  1337. archknight.append(name)
  1338. f = open("archknight.txt", "w")
  1339. f.write("\n".join(archknight))
  1340. f.close()
  1341. room.message("Sukses")
  1342. if name in admin:
  1343. admin.remove(name)
  1344. f = open("admin.txt", "w")
  1345. f.write("\n".join(admin))
  1346. f.close()
  1347. if name in archwizard:
  1348. archwizard.remove(name)
  1349. f = open("archkwizard.txt", "w")
  1350. f.write("\n".join(archwizard))
  1351. f.close()
  1352. if name in player:
  1353. player.remove(name)
  1354. f = open("player.txt", "w")
  1355. f.write("\n".join(player))
  1356. f.close()
  1357. if name in whitelist:
  1358. whitelist.remove(name)
  1359. f = open("whitelist.txt", "w")
  1360. f.write("\n".join(whitelist))
  1361. f.close()
  1362. if rank == "2":
  1363. player.append(name)
  1364. f = open("player.txt", "w")
  1365. f.write("\n".join(player))
  1366. f.close()
  1367. room.message("Sukses")
  1368. if name in admin:
  1369. admin.remove(name)
  1370. f = open("admin.txt", "w")
  1371. f.write("\n".join(admin))
  1372. f.close()
  1373. if name in archwizard:
  1374. archwizard.remove(name)
  1375. f = open("archwizard.txt", "w")
  1376. f.write("\n".join(archwizard))
  1377. f.close()
  1378. if name in archknight:
  1379. archknight.remove(name)
  1380. f = open("archknight.txt", "w")
  1381. f.write("\n".join(archknight))
  1382. f.close()
  1383. if name in whitelist:
  1384. whitelist.remove(name)
  1385. f = open("whitelist.txt", "w")
  1386. f.write("\n".join(whitelist))
  1387. f.close()
  1388. if rank == "1":
  1389. whitelist.append(name)
  1390. f = open("whitelist.txt", "w")
  1391. f.write("\n".join(whitelist))
  1392. f.close()
  1393. room.message("Sukses")
  1394. if name in admin:
  1395. admin.remove(name)
  1396. f = open("admin.txt", "w")
  1397. f.write("\n".join(admin))
  1398. f.close()
  1399. if name in archwizard:
  1400. archwizard.remove(name)
  1401. f = open("archwizard.txt", "w")
  1402. f.write("\n".join(archwizard))
  1403. f.close()
  1404. if name in archknight:
  1405. archknight.remove(name)
  1406. f = open("archknight.txt", "w")
  1407. f.write("\n".join(archknight))
  1408. f.close()
  1409.  
  1410. except:
  1411. room.message("something wrong")
  1412.  
  1413. # clear
  1414. elif cmd == "clear":
  1415. if room.getLevel(self.user) > 0:
  1416. if self.getAccess(user) >= 6 or room.getLevel(user) == 2:
  1417. room.clearall(),
  1418. room.clearUser(ch.User(random.choice(room.usernames))),
  1419. room.clearUser(ch.User(random.choice(room.usernames))),
  1420. room.clearUser(ch.User(random.choice(room.usernames))),
  1421. room.clearUser(ch.User(random.choice(room.usernames))),
  1422. room.clearUser(ch.User(random.choice(room.usernames))),
  1423. room.clearUser(ch.User(random.choice(room.usernames))),
  1424. room.clearUser(ch.User(random.choice(room.usernames))),
  1425. room.clearUser(ch.User(random.choice(room.usernames))),
  1426. room.clearUser(ch.User(random.choice(room.usernames))),
  1427. room.clearUser(ch.User(random.choice(room.usernames))),
  1428. room.clearUser(ch.User(random.choice(room.usernames))),
  1429. room.clearUser(ch.User(random.choice(room.usernames))),
  1430. room.clearUser(ch.User(random.choice(room.usernames))),
  1431. room.clearUser(ch.User(random.choice(room.usernames))),
  1432. room.clearUser(ch.User(random.choice(room.usernames))),
  1433. room.clearUser(ch.User(random.choice(room.usernames))),
  1434. room.clearUser(ch.User(random.choice(room.usernames))),
  1435. room.clearUser(ch.User(random.choice(room.usernames))),
  1436. room.clearUser(ch.User(random.choice(room.usernames))),
  1437. room.clearUser(ch.User(random.choice(room.usernames))),
  1438. room.clearUser(ch.User(random.choice(room.usernames))),
  1439. room.clearUser(ch.User(random.choice(room.usernames))),
  1440. room.clearUser(ch.User(random.choice(room.usernames))),
  1441. room.clearUser(ch.User(random.choice(room.usernames))),
  1442. room.clearUser(ch.User(random.choice(room.usernames))),
  1443. room.clearUser(ch.User(random.choice(room.usernames))),
  1444. room.clearUser(ch.User(random.choice(room.usernames))),
  1445. room.clearUser(ch.User(random.choice(room.usernames))),
  1446. room.clearUser(ch.User(random.choice(room.usernames))),
  1447. room.clearUser(ch.User(random.choice(room.usernames))),
  1448. room.clearUser(ch.User(random.choice(room.usernames))),
  1449. room.clearUser(ch.User(random.choice(room.usernames))),
  1450. room.clearUser(ch.User(random.choice(room.usernames))),
  1451. room.clearUser(ch.User(random.choice(room.usernames))),
  1452. room.clearUser(ch.User(random.choice(room.usernames))),
  1453. else: room.message("Only rank 6+ or the room owner can do this")
  1454. else:
  1455. room.message("aku bukan mods disini :|")
  1456. ##delete chat
  1457. elif (cmd == "delete" or cmd == "dl" or cmd == "del"):
  1458. if room.getLevel(self.user) > 0:
  1459. if self.getAccess(user) >= 1 or room.getLevel(user) > 0:
  1460. name = args.split()[0].lower()
  1461. room.clearUser(ch.User(name))
  1462. else:room.message("kamu tidak bisa melakukannya!!")
  1463. else:
  1464. room.message("aku bukan mods disini :|")
  1465.  
  1466. ##Yuri-test Spook
  1467. if cmd == "syt":
  1468. if self.getAccess(user) > 2:
  1469. self.getRoom("yuri-test").message(args)
  1470. room.message("_shhh ")
  1471. else:
  1472. room.message("Can't XD")
  1473. ##Anibatch Spook
  1474. if cmd == "sab":
  1475. if self.getAccess(user) > 2:
  1476. self.getRoom("anibatch").message(args)
  1477. room.message("_shhh ")
  1478. else:
  1479. room.message("Can't XD")
  1480. ##Spook
  1481. if cmd == "whois" or cmd == "who" or cmd == "w":
  1482. if not args :
  1483. room.message("FAIL!! Do 'w<space>nick");return
  1484. args = args.lower()
  1485. if args[0] == "+":
  1486. args = args[1:]
  1487. elif pars(args) != None and not args[0] == "+":
  1488. args = pars(args)
  1489. try:
  1490. f = open("ip_whois.txt", "r")
  1491. ip_whois = eval(f.read())
  1492. f.close()
  1493. except:pass
  1494. try:
  1495. f = open("sid_whois.txt", "r")
  1496. sid_whois = eval(f.read())
  1497. f.close()
  1498. except:pass
  1499. ip_ver = getWhois.whois(ip_whois, args)
  1500. sid_ver = getWhois.whois(sid_whois, args)
  1501. if ip_ver == None and sid_ver == None:
  1502. room.message("No alias found.")
  1503. return
  1504. room.message("Currently known alias(es) of %s:<br/>%s: %s.<br/>%s: %s."% (args.title(), "UnID Version", sid_ver, "IP Version", ip_ver), True)
  1505.  
  1506. if cmd == "spook" or cmd == "sp":
  1507. try:
  1508. name, body = args.split(" ", 1)
  1509. if name in self.roomnames :
  1510. self.getRoom(name).message(body)
  1511. room.message("_shhh ")
  1512. else:
  1513. room.message("Aku tidak ada di room itu")
  1514. except:room.message("error")
  1515. ##fax
  1516. if cmd == "fax" or cmd == "Fax":
  1517. try:
  1518. name, body = args.split(" ", 1)
  1519. l = "http://ch.besaba.com/mty.htm?"+room.name+"!"
  1520. if name in self.roomnames :
  1521. self.getRoom(name).message('[<font color="#6699CC"><b>Message</b></font> - %s ] in <a href=\"%s" target=\"_blank\"><u>%s</u></a> : <font color="#66FFFF"><i> %s <i></font>' % (sntonick(user.name), l, room.name, body),True)
  1522. room.message("Sent")
  1523. else:
  1524. room.message("I haven't joined that room")
  1525. except:room.message("error")
  1526.  
  1527.  
  1528.  
  1529. ##Ranker
  1530. if cmd == "ranker":
  1531. room.message("<br/><f x120000FF='0'><b>Owner:</b></f> %s<br/><f x12FF0000='0'><b>Admin:</b></f> %s<br/><f x12216BF5='0'><b>ArchWizard:</b></f> %s<br/><f x12FF00FF='0'><b>ArchKnight:</b></f>%s" % (", ".join(owners), ", ".join(admin), ", ".join(archwizard), ", ".join(archknight)),True)
  1532. ##RankBoard
  1533. if cmd == "rankboard":
  1534. room.message("<br/><f x120000FF='0'><b>My Rank Board</b></f><br/><f x120000FF='0'><b>Owner:</b></f> %s<br/><f x12FF0000='0'><b>Admin:</b></f> %s<br/><f x12216BF5='0'><b>ArchWizard:</b></f> %s<br/><f x12FF00FF='0'><b>ArchKnight:</b></f> %s<br/><<f x121BFF00='0'><b>Whitelist:</b></f> %s</br><f x1200FF98><b>Player:</b></f> %s<br/><f x12FF00FF='0'><b>Blacklist:</b></f> %s" % (", ".join(owners), ", ".join(admin), ", ".join(archwizard), ", ".join(archknight), ", ".join(whitelist), ", ".join(player), ", ".join(blacklist)),True)
  1535. ##staff
  1536. if cmd == "staff":
  1537. room.message("<br/><f x120000FF='0'><b>Owner:</b></f> %s<br/><f x12FF0000='0'><b>Admin:</b></f> %s" % (", ".join(owners), ", ".join(admin)),True)
  1538.  
  1539. ##GIS
  1540. if cmd == "gis":
  1541. room.message(gis(args),True)
  1542. ##GS
  1543. if cmd == "gs":
  1544. room.message(gs(args),True)
  1545.  
  1546. if cmd == "pfpic":
  1547. link = "http://fp.chatango.com/profileimg/%s/%s/%s/full.jpg" % (args[0], args[1], args)
  1548. room.message("<br/>"+"User ID : "+args+""+"<br/>Profile Picture :<br/>"+link,True)
  1549. ##Eval
  1550. if cmd == "ev" or cmd == "eval" or cmd == "e" and user.name == "rifky102":
  1551. if self.getAccess(user) == 6:
  1552. ret = eval(args)
  1553. if ret == None:
  1554. room.message("Done.")
  1555. return
  1556. room.message(str(ret))
  1557.  
  1558. ##Say
  1559. if cmd == "say":
  1560. room.message(args)
  1561.  
  1562. ##Random User
  1563. if cmd == "randomuser":
  1564. room.message(random.choice(room.usernames))
  1565.  
  1566.  
  1567.  
  1568.  
  1569. ##Check if Mod
  1570. #not really important
  1571. elif cmd == "ismod":
  1572. user = ch.User(args)
  1573. if room.getLevel(user) > 0:
  1574. room.message("yesh")
  1575. else:
  1576. room.message("nope")
  1577.  
  1578. ## Youtube
  1579. elif cmd == "youtube" or cmd == "yt":
  1580. if args:
  1581. room.message(tube(args),True)
  1582. ## cso
  1583. if cmd=="cso":
  1584. if len(args)>0:
  1585. offline = None
  1586. url = urlreq.urlopen("http://"+args+".chatango.com").read().decode()
  1587. if not "buyer" in url:
  1588. room.message(args+" does not exist on chatango.")
  1589. else:
  1590. url2 = urlreq.urlopen("http://"+args+".chatango.com").readlines()
  1591. for line in url2:
  1592. line = line.decode('utf-8')
  1593. if "leave a message for" in line.lower():
  1594. print(line)
  1595. offline = True
  1596. if offline:
  1597. room.message(args+" sedang <f x11FF0000='8'>Offline</f>",True)
  1598. if not offline:
  1599. room.message(args+" sedang <f x1133FF33='8'>Online</f>",True)
  1600. else:
  1601. room.message("<f x11FF6600='8'>I need the username of target :)</f>", True)
  1602. ## upTime
  1603. elif cmd == "uptime" or cmd == "ut" and self.getAccess(user) >= 2:
  1604. room.message("Server uptime: %s" % uptime())
  1605. ## Broadcast
  1606. elif cmd=="bc" and self.getAccess(user) >= 4:
  1607. r = room.name
  1608. l = "http://ch.besaba.com/mty.htm?"+r+"+"
  1609. for room in self.rooms:
  1610. room.message("[<font color='#6699CC'><b>Broadcast</b></font>] from - "+sntonick(user.name)+ " : <font color='#33FF33'><i>"+args+"<i></font>", True)
  1611. ###### Define
  1612. elif cmd == "define" or cmd == "df" and len(args) > 0:
  1613. try:
  1614. try:
  1615. word, definition = args.split(" as ",1)
  1616. word = word.lower()
  1617. except:
  1618. word = args
  1619. definition = ""
  1620. if len(word.split()) > 4:
  1621. room.message("Fail")
  1622. return
  1623. elif len(definition) > 0:
  1624. if word in dictionary:
  1625. room.message("%s defined already" % user.name.capitalize())
  1626. else:
  1627. dictionary[word] = json.dumps([definition, user.name])
  1628. f =open("definitions.txt", "w")
  1629. for word in dictionary:
  1630. definition, name = json.loads(dictionary[word])
  1631. f.write(json.dumps([word, definition, name])+"\n")
  1632. f.close
  1633. room.message("Definition Saved")
  1634. else:
  1635. if word in dictionary:
  1636. definition, name = json.loads(dictionary[word])
  1637. room.message("<br/>ID : %s<br/>Keyword : %s<br/>Definition:<br/>%s" % (name, word, definition),True)
  1638. else:
  1639. room.message(args+" is not defined")
  1640. except:
  1641. room.message("something wrong")
  1642.  
  1643. elif cmd == "rank":
  1644. if not args:
  1645. if user.name in owners and not user.name in whitelist:
  1646. room.message(user.name+" Kamu Rank 6 [Owner] ",True)
  1647. elif user.name in admin and not user.name in archwizard and not user.name in player and not user.name in whitelist and not user.name in archknight and not user.name in owners:
  1648. room.message(user.name+" Kamu Rank 5 [Admin] ",True)
  1649. elif user.name in archwizard and not user.name in player and not user.name in archknight and not user.name in whitelist and not user.name in owners and not user.name in admin:
  1650. room.message(user.name+" Kamu Rank 4 [ArchWizard]",True)
  1651. elif user.name in archknight and not user.name in whitelist and not user.name in owners and not user.name in admin:
  1652. room.message(user.name+" Kamu Rank 3 [ArchKnight]",True)
  1653. elif user.name in player and not user.name in archwizard and not user.name in archknight and not user.name in whitelist and not user.name in owners and not user.name in admin:
  1654. room.message(user.name+" Kamu Rank 2 [Player]",True)
  1655. elif user.name in whitelist and not user.name in owners:
  1656. room.message(user.name+" Kamu Rank 1 [Whitelist]",True)
  1657. elif user.name not in whitelist and not user.name not in archknight and user.name not in admin and user.name not in owners and user.name not in archwizard and user.name not in player:
  1658. room.message(user.name+" Kamu Belum terdaftar",True)
  1659. if args:
  1660. sss = args
  1661. if sss in owners:
  1662. room.message(sss.title()+" Rank Dia 6 [Owner] ",True)
  1663. if sss in admin:
  1664. room.message(sss.title()+" Rank Dia 5 [Admin] ",True)
  1665. if sss in archwizard:
  1666. room.message(sss.title()+" Rank Dia 4 [ArchWizard] ",True)
  1667. if sss in archknight:
  1668. room.message(sss.title()+" Rank Dia 3 [ArchKnight] ",True)
  1669. if sss in player:
  1670. room.message(sss.title()+" Rank Dia 2 [Player] ",True)
  1671. if sss in whitelist:
  1672. room.message(sss.title()+" rank Dia 1 [Whitelist] ",True)
  1673. if sss not in owners and sss not in admin and sss not in archknight and sss not in whitelist and sss not in archwizard and sss not in player:
  1674. room.message(sss.title()+" Tidak ada rank :) ")
  1675.  
  1676. ### Lock/Unlock
  1677.  
  1678.  
  1679.  
  1680.  
  1681. ###lock
  1682. if cmd == "lock" and self.getAccess(user) > 2:
  1683. try:
  1684. if user.name in whitelist or user.name in player:
  1685. room.message("you can't do that. ;D")
  1686. return
  1687. if args in locks:
  1688. room.message("already locked. :)")
  1689. return
  1690. if args in self.roomnames:
  1691. if user.name in owners or user.name in admin or user.name in archknight or user.name in archwizard:
  1692. locks.append(args)
  1693. f.close()
  1694. f = open("locks.txt", "w")
  1695. f.write("\n".join(locks))
  1696. f.close()
  1697. room.message("Locked: %s" % args, True)
  1698. else: room.message("Only rank 3+ can do that")
  1699. if args == "":
  1700. if room.name in locks:
  1701. room.message("already locked :)")
  1702. return
  1703. locks.append(room.name)
  1704. room.message("Locked: <b>%s</b>" % room.name, True)
  1705. if args not in self.roomnames:
  1706. if args == "": return
  1707. room.message("im not there :|")
  1708. return
  1709. except:
  1710. room.message("Something wrong",True)
  1711.  
  1712. ##unlock
  1713. if cmd == "unlock" and self.getAccess(user) > 2:
  1714. try:
  1715. if not args:
  1716. rnm = room.name
  1717. if rnm in locks:
  1718. locks.remove(rnm)
  1719. f = open("locks.txt","w")
  1720. f.write("\n".join(locks))
  1721. f.close()
  1722. room.message("Unlocked")
  1723. else:
  1724. room.message("bahkan sudah diunlock")
  1725. if args:
  1726. rnm = room.name
  1727. if rnm in locks and rnm in self.roomnames:
  1728. locks.remove(rnm)
  1729. f = open("locks.txt","w")
  1730. f.write("\n".join(locks))
  1731. f.close()
  1732. room.message("Unlocked")
  1733. else:
  1734. room.message("Bahkan itu sudah unlock")
  1735. except:
  1736. room.message("Sesuatu yang salah",True)
  1737.  
  1738.  
  1739.  
  1740.  
  1741. ##### Whitelist
  1742. elif cmd == "wl" and self.getAccess(user) >= 1:
  1743. name = args
  1744. if name not in whitelist and name not in archwizard and name not in player and name not in owners and name not in admin and name not in archknight and name not in blacklist:
  1745. room.message("Sekarang "+args+" dapat menggunakan Mio")
  1746. whitelist.append(name)
  1747. f = open("whitelist.txt","w")
  1748. f.write("\n".join(whitelist))
  1749. f.close
  1750. else:
  1751. room.message("User tersebut sudah terdaftar")
  1752.  
  1753. ###blacklist
  1754. elif cmd == "bl" and self.getAccess(user) >= 5:
  1755. name = args
  1756. if name not in whitelist and name not in owners and name not in admin and name not in archknight:
  1757. room.message("Done")
  1758. blacklist.append(name)
  1759. f = open("blacklist.txt","w")
  1760. f.write("\n".join(blacklist))
  1761. f.close
  1762. else:
  1763. room.message("User tersebut sudah di blacklist")
  1764.  
  1765. ##ubl
  1766. if cmd == "ubl" and self.getAccess(user) >= 5:
  1767. try:
  1768. if args in blacklist:
  1769. blacklist.remove(args)
  1770. f = open("blacklist.txt","w")
  1771. f.write("\n".join(blacklist))
  1772. f.close()
  1773. room.message("Sukses")
  1774. except:
  1775. room.message("Gagal")
  1776.  
  1777. ##uwl
  1778. if cmd == "uwl" and self.getAccess(user) >= 5:
  1779. try:
  1780. if args in owners:
  1781. room.message("Ma'af Mio tidak dapat melakukannya")
  1782. if args in admin:
  1783. admin.remove(args)
  1784. f = open("admin.txt","w")
  1785. f.write("\n".join(admin))
  1786. f.close()
  1787. room.message("Sukses")
  1788. if args in archwizard:
  1789. archwizard.remove(args)
  1790. f = open("archwizard.txt","w")
  1791. f.write("\n".join(archwizard))
  1792. f.close()
  1793. room.message("Sukses")
  1794. if args in archknight:
  1795. archknight.remove(args)
  1796. f = open("archknight.txt","w")
  1797. f.write("\n".join(archknight))
  1798. f.close()
  1799. room.message("Sukses")
  1800. if args in archwizard:
  1801. archwizard.remove(args)
  1802. f = open("archwizard.txt","w")
  1803. f.write("\n".join(archwizard))
  1804. f.close()
  1805. room.message("Sukses")
  1806. if args in player:
  1807. player.remove(args)
  1808. f = open("player.txt","w")
  1809. f.write("\n".join(player))
  1810. f.close()
  1811. room.message("Sukses")
  1812. if args in whitelist:
  1813. whitelist.remove(args)
  1814. f = open("whitelist.txt","w")
  1815. f.write("\n".join(whitelist))
  1816. f.close()
  1817. room.message("Sukses")
  1818. except:
  1819. room.message("Gagal")
  1820.  
  1821. if cmd== "sbg":
  1822. if self.getAccess(user) >= 5:
  1823. if len(args) > 0:
  1824. if args == "on":
  1825. room.setBgMode(1)
  1826. room.message("Background On")
  1827. return
  1828. if args == "off":
  1829. room.setBgMode(0)
  1830. room.message("Background Off")
  1831. if cmd== "sf":
  1832. if self.getAccess(user) >= 5:
  1833. if args:
  1834. self.setFontFace(args)
  1835. room.message("Done")
  1836.  
  1837. if cmd== "sfc":
  1838. if self.getAccess(user) >= 5:
  1839. if args:
  1840. self.setFontColor(args)
  1841. room.message("Done")
  1842.  
  1843. if cmd== "sfz":
  1844. if self.getAccess(user) >= 5:
  1845. if args:
  1846. self.setFontSize(int(args))
  1847. room.message("Done")
  1848.  
  1849. if cmd== "snc":
  1850. if self.getAccess(user) >= 5:
  1851. if args:
  1852. self.setNameColor(args)
  1853. room.message("Done")
  1854. elif cmd == "mydict" or cmd == "mydf":
  1855. arr = []
  1856. for i in dictionary:
  1857. if user.name in dictionary[i]:
  1858. arr.append(i)
  1859. if len(arr) > 0:
  1860. room.message("You have defined <b>"+str(len(arr))+"</b> words in your dictionary :<i> %s"% (', '.join(sorted(arr))), True)
  1861. else:
  1862. room.message("kamu tidak memiliki dictionary.")
  1863.  
  1864.  
  1865.  
  1866. if cmd == "udf" and len(args) > 0:
  1867. try:
  1868. word = args
  1869. if word in dictionary:
  1870. definition, name = json.loads(dictionary[word])
  1871. if name == user.name or self.getAccess(user) >= 3:
  1872. del dictionary[word]
  1873. f =open("definitions.txt", "w")
  1874. for word in dictionary:
  1875. definition, name = json.loads(dictionary[word])
  1876. f.write(json.dumps([word, definition, name])+"\n")
  1877. f.close
  1878. room.message(args+" has been removed from Definition database")
  1879. return
  1880. else:
  1881. room.message("<b>%s</b> you can not remove this define only masters or the person who defined the word may remove definitions" % user.name, True)
  1882. return
  1883. else:
  1884. room.message("<b>%s</b> is not yet defined you can define it by typing <b>define %s: meaning</b>" % args, True)
  1885. except:
  1886. room.message("Gagal")
  1887. return
  1888.  
  1889. elif cmd == "sdf" or cmd == "seedict":
  1890. if not args:
  1891. room.message("Whose dict do you want to see ?")
  1892. return
  1893. args = args.lower()
  1894. if pars(args) == None:
  1895. args = args.lower()
  1896. if pars(args) != None:
  1897. args = pars(args)
  1898. arr = []
  1899. for i in dictionary:
  1900. if args in dictionary[i]:
  1901. arr.append(i)
  1902. if len(arr) > 0:
  1903. room.message("<b>"+args.title()+"</b> have defined <b>"+str(len(arr))+"</b> words in his dictionary :<i> %s"% (', '.join(sorted(arr))), True)
  1904. else:
  1905. room.message(args.title()+" defined nothing.")
  1906.  
  1907. if cmd == "seenick":
  1908. try:
  1909. if args in nicks:
  1910. room.message(args+" Nick Dia : "+sntonick(args)+"", True)
  1911. else:
  1912. room.message(args+" Belum membuat nick di aku :|")
  1913. except:
  1914. return
  1915.  
  1916. elif cmd=="prof" or cmd == "profile":
  1917. try:
  1918. args=args.lower()
  1919. stuff=str(urlreq.urlopen("http://"+args+".chatango.com").read().decode("utf-8"))
  1920. crap, age = stuff.split('<span class="profile_text"><strong>Age:</strong></span></td><td><span class="profile_text">', 1)
  1921. age, crap = age.split('<br /></span>', 1)
  1922. crap, gender = stuff.split('<span class="profile_text"><strong>Gender:</strong></span></td><td><span class="profile_text">', 1)
  1923. gender, crap = gender.split(' <br /></span>', 1)
  1924. if gender == 'M':
  1925. gender = 'Laki-Laki'
  1926. elif gender == 'F':
  1927. gender = 'Perempuan'
  1928. else:
  1929. gender = '?'
  1930. crap, location = stuff.split('<span class="profile_text"><strong>Location:</strong></span></td><td><span class="profile_text">', 1)
  1931. location, crap = location.split(' <br /></span>', 1)
  1932. crap,mini=stuff.split("<span class=\"profile_text\"><!-- google_ad_section_start -->",1)
  1933. mini,crap=mini.split("<!-- google_ad_section_end --></span>",1)
  1934. mini=mini.replace("<img","<!")
  1935. picture = '<a href="http://fp.chatango.com/profileimg/' + args[0] + '/' + args[1] + '/' + args + '/full.jpg" style="z-index:59" target="_blank">http://fp.chatango.com/profileimg/' + args[0] + '/' + args[1] + '/' + args + '/full.jpg</a>'
  1936. prodata = '<br/> <a href="http://chatango.com/fullpix?' + args + '" target="_blank">' + picture + '<br/><br/> Age: '+ age + ' <br/> Gender: ' + gender + ' <br/> Location: ' + location + '' '<br/> <a href="http://' + args + '.chatango.com" target="_blank"><u>Chat With User</u></a> ' "<br/><br/> "+ mini
  1937. room.message(prodata.replace("\n","<br/>"),True)
  1938. except:
  1939. room.message(""+args+" doesn't exist o.o ")
  1940. elif cmd=="mini":
  1941. try:
  1942. args=args.lower()
  1943. stuff=str(urlreq.urlopen("http://"+args+".chatango.com").read().decode("utf-8"))
  1944. crap,mini=stuff.split("<span class=\"profile_text\"><!-- google_ad_section_start -->",1)
  1945. mini,crap=mini.split("<!-- google_ad_section_end --></span>",1)
  1946. mini=mini.replace("<img","<!")
  1947. prodata = '<br/>'+mini
  1948. room.message(prodata,True)
  1949. except:
  1950. room.message(""+args+" doesn't exist o.o ")
  1951.  
  1952. if cmd == "bgimg":
  1953. try:
  1954. args=args.lower()
  1955. picture = '<a href="http://st.chatango.com/profileimg/' + args[0] + '/' + args[1] + '/' + args + '/msgbg.jpg" style="z-index:59" target="_blank">http://fp.chatango.com/profileimg/' + args[0] + '/' + args[1] + '/' + args + '/msgbg.jpg</a>'
  1956. prodata = '<br/>'+picture
  1957. room.message("<br/>"+"User ID : "+args+"<br/>Background :"+prodata,True)
  1958. except:
  1959. room.message(""+args+" doesn't exist:'v")
  1960.  
  1961.  
  1962.  
  1963.  
  1964. ### Private Messages
  1965. elif cmd=="pm":
  1966. data = args.split(" ", 1)
  1967. if len(data) > 1:
  1968. name , args = data[0], data[1]
  1969. self.pm.message(ch.User(name), "[Private.Message] By - "+user.name+" : "+args+" ")
  1970. room.message("Sent to "+name+"")
  1971. ### Sentnote
  1972. elif cmd == "inbox":
  1973. if user.name in sn:
  1974. mesg = len(sn[user.name])
  1975. room.message("["+str(mesg)+"] messages in your inbox. To read it, do irn")
  1976. else:
  1977. sn.update({user.name:[]})
  1978. mesg = len(sn[user.name])
  1979. room.message("["+str(mesg)+"] messages in your inbox. To read it, do irn")
  1980.  
  1981.  
  1982. #send notes
  1983. elif cmd == "sn" or cmd == "sendnote":
  1984. args.lower()
  1985. untuk, pesan = args.split(" ", 1)
  1986. if untuk[0] == "+":
  1987. untuk = untuk[1:]
  1988. else:
  1989. if pars(untuk) == None:
  1990. room.message("Who is "+untuk+" ??")
  1991. return
  1992. untuk = pars(untuk)
  1993. if untuk in sn:
  1994. sn[untuk].append([user.name, pesan, time.time()])
  1995. if untuk not in notif:
  1996. notif.append(untuk)
  1997. else:pass
  1998. else:
  1999. sn.update({untuk:[]})
  2000. sn[untuk].append([user.name, pesan, time.time()])
  2001. if untuk not in notif:
  2002. notif.append(untuk)
  2003. else:pass
  2004. room.message('Sent to %s'% (untuk)+"'s inbox" , True)
  2005.  
  2006.  
  2007.  
  2008. #Read Notes
  2009. elif cmd =="rn" or cmd =="readnote":
  2010. if user.name not in sn:
  2011. sn.update({user.name:[]})
  2012. user=user.name.lower()
  2013. if len(sn[user]) > 0:
  2014. messg = sn[user][0]
  2015. dari, pesen, timey = messg
  2016. timey = time.time() - int(timey)
  2017. minute = 60
  2018. hour = minute * 60
  2019. day = hour * 24
  2020. days = int(timey / day)
  2021. hours = int((timey % day) / hour)
  2022. minutes = int((timey % hour) / minute)
  2023. seconds = int(timey % minute)
  2024. string = ""
  2025. if days > 0:
  2026. string += str(days) + " " + (days == 1 and "day" or "days" ) + ", "
  2027. if len(string) > 0 or hours > 0:
  2028. string += str(hours) + " " + (hours == 1 and "hour" or "hours" ) + ", "
  2029. if len(string) > 0 or minutes > 0:
  2030. string += str(minutes) + " " + (minutes == 1 and "minute" or "minutes" ) + ", "
  2031. string += str(seconds) + " " + (seconds == 1 and "second" or "seconds" )
  2032. room.message("[<font color='#6699CC'><b>Private Message</b></font>] from - "+sntonick(dari)+" : "+pesen+" (<font color='#9999FF'>"+string+" ago </font>)", True)
  2033. try:
  2034. del sn[user][0]
  2035. notif.remove(user)
  2036. except:pass
  2037. else:room.message('%s'%(user)+" you don't have any messages in your inbox" , True)
  2038. ###### leave + room
  2039. elif cmd == "leave" and self.getAccess(user) >=5:
  2040. if not args:args=room.name
  2041. self.leaveRoom(args)
  2042. room.message("Baik aku out "+args+" ...")
  2043. print("[SAVE] SAVING Rooms...")
  2044. f = open("rooms.txt", "w")
  2045. f.write("\n".join(self.roomnames))
  2046. f.close()
  2047.  
  2048. ###### join room + roomname
  2049.  
  2050. if cmd == "join" and len(args) > 1:
  2051. if self.getAccess (user) >= 5:
  2052. if args not in self.roomnames:
  2053. room.message("Baik aku join ke "+args+" ...")
  2054. self.joinRoom(args)
  2055. else:
  2056. room.message("aku sudah ada disana ...")
  2057. print("[SAVE] SAVING Rooms...")
  2058. f = open("rooms.txt", "w")
  2059. f.write("\n".join(self.roomnames))
  2060. f.close()
  2061. elif cmd == "userlist" or cmd == "ul":
  2062. if args == "":
  2063. usrs = []
  2064. gay = []
  2065. finale = []
  2066. prop = 0
  2067. prop = prop + len(room._userlist) - 1
  2068. for i in room._userlist:
  2069. i = str(i)
  2070. usrs.append(i)
  2071. while prop >= 0:
  2072. j = usrs[prop].replace("<User: ", "")
  2073. i = j.replace(">", "")
  2074. gay.append(i)
  2075. prop = prop - 1
  2076. for i in gay:
  2077. if i not in finale:
  2078. finale.append(i)
  2079. if len(finale) > 40:
  2080. room.message("<font color='#9999FF'><b>40</b></font> of <b>%s</b> users in this room: %s"% (len(finale), ", ".join(finale[:41])), True)
  2081. if len(finale) <=40 :
  2082. room.message("Current <b>%s</b> users of this room: %s"% (len(finale),", ".join(finale)), True)
  2083. if args != "":
  2084. if args not in self.roomnames:
  2085. room.message("I'm not there.")
  2086. return
  2087. users = getParticipant(str(args))
  2088. if len(users) > 40:
  2089. room.message("<font color='#9999FF'><b>40</b></font> of <b>%s</b> current users in <b>%s</b>: %s"% (len(users), args.title(), ", ".join(users[:41])), True)
  2090. if len(users) <=40:
  2091. room.message("Current <b>%s</b> users in <b>%s</b>: %s"% (len(users), args.title(), ", ".join(users)), True)
  2092. ##### bot rooms
  2093. elif cmd == "rooms" :
  2094. j = []
  2095. for i in self.roomnames:
  2096. j.append(i+'[%s]' % str(self.getRoom(i).usercount))
  2097. j.sort()
  2098. room.message("aku bermain Di "+'[%s] rooms: '%(len(self.roomnames))+", ".join(j))
  2099. ## Mods
  2100. elif cmd == "mods":
  2101. args = args.lower()
  2102. if args == "":
  2103. room.message("<font color='#ffffff'><b>Room</b>: "+room.name+" <br/><b>Owner</b>: <u>"+ (room.ownername) +"</u> <br/><b>Mods</b>: "+", ".join(room.modnames), True)
  2104. return
  2105. if args in self.roomnames:
  2106. modask = self.getRoom(args).modnames
  2107. owner = self.getRoom(args).ownername
  2108. room.message("<font color='#ffffff'><b>Room</b>: "+args+" <br/><b>Owner</b>: <u>"+ (owner) +"</u> <br/><b>Mods</b>: "+", ".join(modask), True)
  2109.  
  2110. ####nick
  2111. elif cmd == "nick":
  2112. ## if user.name in reg or user.name in friends or user.name in trusted or user.name in owners:
  2113. if args:
  2114. nick = args
  2115. user = user.name
  2116. nicks[user] = json.dumps(nick)
  2117. room.message(user +' Oke, mulai sekarang aku panggil '+str(args)+'', True)
  2118. try:
  2119. print("[SAVING] NICKS...")
  2120. f = open("nicks.txt", "w")
  2121. for user in nicks:
  2122. nick = json.loads(nicks[user])
  2123. f.write(json.dumps([user,nick]) + "\n")
  2124. except:
  2125. room.message("Gagal membuat Nick baru..");return
  2126. else:
  2127. room.message('Ketik >nick <spasi> nama yang di inginkan', True)
  2128.  
  2129.  
  2130. ##mynick
  2131. elif cmd == "mynick" :
  2132. user=user.name.lower()
  2133. if user in nicks :
  2134. nick = json.loads(nicks[user])
  2135. room.message(user+" is nicked : "+nick,True)
  2136. else:
  2137. room.message("buat nick dulu yah?! :D ", True)
  2138.  
  2139.  
  2140. except Exception as e:
  2141. try:
  2142. et, ev, tb = sys.exc_info()
  2143. lineno = tb.tb_lineno
  2144. fn = tb.tb_frame.f_code.co_filename
  2145. room.message("[Expectation Failed] %s Line %i - %s"% (fn, lineno, str(e)))
  2146. return
  2147. except:
  2148. room.message("Undescribeable error detected !!")
  2149. return
  2150.  
  2151. ##RPG Game
  2152.  
  2153. if cmd=="register" or cmd=="reg" and self.getAccess(user)> 0:
  2154. if user.name not in playa:
  2155. playa.append(user.name)
  2156. coin="500000"
  2157. gold="100"
  2158. lvl="1"
  2159. exp="1000"
  2160. up="1"
  2161. cash="10"
  2162. cp="0"
  2163. bank[user.name] = json.dumps([coin,gold])
  2164. stats[user.name] = json.dumps([lvl,exp,up])
  2165. mcash[user.name] = json.dumps([cash,cp])
  2166. room.message("<f x11"+sntocolor(user.name)+"='"+sntofface(user.name)+"'>+"+user.name+"+ now registered as player.",True)
  2167.  
  2168. print("[SAVE] SAVING PLAYER/STATS/MONEY")
  2169. f = open("playa.txt", "w")
  2170. f.write("\n".join(playa))
  2171. f.close()
  2172.  
  2173. f = open("mcash.txt", "w")
  2174. for user in mcash:
  2175. cash,cp = json.loads(mcash[user])
  2176. f.write(json.dumps([user,cash,cp])+"\n")
  2177. f.close()
  2178.  
  2179. f = open("stats.txt", "w")
  2180. for user in stats:
  2181. lvl,exp,up = json.loads(stats[user])
  2182. f.write(json.dumps([user,lvl,exp,up])+"\n")
  2183. f.close()
  2184.  
  2185. f = open("bank.txt", "w")
  2186. for user in bank:
  2187. coin,gold = json.loads(bank[user])
  2188. f.write(json.dumps([user,coin,gold])+"\n")
  2189. return
  2190.  
  2191. if cmd=="gcmds":
  2192. room.message("Game cmd list: <f x11FFCC00='"+sntofface(user.name)+"'> dice, lvlstats, exchange, money, harv, cgive , ggive, atk, buy, bag, shop, upgrade, pets, unclaim, claim, stats, mgold, register, resetstats/reset, sas/save game stats.<f x11FF0000='"+sntofface(user.name)+"'><b> 1st. do ;register/;reg..</b></font>",True)
  2193.  
  2194. elif cmd =="upgrade":
  2195. if self.getAccess(user) >= 2:
  2196. if user.name in waktu2:
  2197. w = json.loads(waktu2[user.name])
  2198. if time.time() < w:
  2199. w = int(w) - int(time.time())
  2200. minute = 60
  2201. hour = minute * 60
  2202. day = hour * 24
  2203. days = int(w / day)
  2204. hours = int((w % day) / hour)
  2205. minutes = int((w % hour) / minute)
  2206. seconds = int(w % minute)
  2207. string = ""
  2208. if days > 0:
  2209. string += str(days) + " " + (days == 1 and "day" or "days" ) + ", "
  2210. if len(string) > 0 or hours > 0:
  2211. string += str(hours) + " " + (hours == 1 and "hour" or "hours" ) + ", "
  2212. if len(string) > 0 or minutes > 0:
  2213. string += str(minutes) + " " + (minutes == 1 and "minute" or "minutes" ) + ", "
  2214. string += str(seconds) + " " + (seconds == 1 and "second" or "seconds" )
  2215. room.message("<f x11"+sntocolor(user.name)+"='"+sntofface(user.name)+"'>Please wait for: <b>%s</b>"% string,True)
  2216. return
  2217. if jack and user.name in waktu11:
  2218. w = json.loads(waktu11[user.name])
  2219. if time.time() < w:
  2220. w = int(w) - int(time.time())
  2221. minute = 60
  2222. hour = minute * 60
  2223. day = hour * 24
  2224. days = int(w / day)
  2225. hours = int((w % day) / hour)
  2226. minutes = int((w % hour) / minute)
  2227. seconds = int(w % minute)
  2228. string = ""
  2229. if days > 0:
  2230. string += str(days) + " " + (days == 1 and "day" or "days" ) + ", "
  2231. if len(string) > 0 or hours > 0:
  2232. string += str(hours) + " " + (hours == 1 and "hour" or "hours" ) + ", "
  2233. if len(string) > 0 or minutes > 0:
  2234. string += str(minutes) + " " + (minutes == 1 and "minute" or "minutes" ) + ", "
  2235. string += str(seconds) + " " + (seconds == 1 and "second" or "seconds" )
  2236. room.message("<f x11"+sntocolor(user.name)+"='"+sntofface(user.name)+"'>Please wait for: <b>%s</b>"% string,True)
  2237. return
  2238. if self.getAccess(user) >= 2:
  2239. if jack:
  2240. coin, gold = json.loads(bank[user.name])
  2241. lvl, exp2, up2 = json.loads(stats[user.name])
  2242. randexp=random.randint(7000,10000)
  2243. exp=int(exp2)+randexp
  2244. exp=str(exp)
  2245. up=int(up2)+1
  2246. up=str(up)
  2247. string = "[<b>✖JACK-MODE!!!✖</b>] "+sntonick(user.name)+" <f x11"+sntocolor(user.name)+"='"+sntofface(user.name)+"'>upgrade their stats.. & got <b>Exp</b>[<b>+++"+str(randexp)+"</b>] & <b>TOTAL UPGRADE</b>[<b>"+str(up)+"</b>]"
  2248. stats[user.name] = json.dumps([lvl,exp,up])
  2249. room.message(string,True)
  2250. waktu11[user.name] = json.dumps(time.time()+240)
  2251. f = open("mcash.txt", "w")
  2252. for user in mcash:
  2253. cash,cp = json.loads(mcash[user])
  2254. f.write(json.dumps([user,cash,cp])+"\n")
  2255. f.close()
  2256. f = open("stats.txt", "w")
  2257. for user in stats:
  2258. lvl,exp,up = json.loads(stats[user])
  2259. f.write(json.dumps([user,lvl,exp,up])+"\n")
  2260. f.close()
  2261. f = open("bank.txt", "w")
  2262. for user in bank:
  2263. coin,gold = json.loads(bank[user])
  2264. f.write(json.dumps([user,coin,gold])+"\n")
  2265. if not jack:
  2266. coin, gold = json.loads(bank[user.name])
  2267. lvl, exp2, up2 = json.loads(stats[user.name])
  2268. randexp=random.randint(5000,7000)
  2269. exp=int(exp2)+randexp
  2270. exp=str(exp)
  2271. up=int(up2)+1
  2272. up=str(up)
  2273. string = ""+sntonick(user.name)+" <f x11"+sntocolor(user.name)+"='"+sntofface(user.name)+"'>upgrade their stats.. & got <b>Exp</b>[<b>+"+str(randexp)+"</b>], <b>TOTAL UPGRADE</b>[<b>"+str(up)+"</b>]"
  2274. stats[user.name] = json.dumps([lvl,exp,up])
  2275. room.message(string,True)
  2276. waktu2[user.name] = json.dumps(time.time()+280)
  2277. f = open("mcash.txt", "w")
  2278. for user in mcash:
  2279. cash,cp = json.loads(mcash[user])
  2280. f.write(json.dumps([user,cash,cp])+"\n")
  2281. f.close()
  2282. f = open("stats.txt", "w")
  2283. for user in stats:
  2284. lvl,exp,up = json.loads(stats[user])
  2285. f.write(json.dumps([user,lvl,exp,up])+"\n")
  2286. f.close()
  2287. f = open("bank.txt", "w")
  2288. for user in bank:
  2289. coin,gold = json.loads(bank[user])
  2290. f.write(json.dumps([user,coin,gold])+"\n")
  2291. else:
  2292. room.message("Type ;reg for playing this game..")
  2293.  
  2294. elif cmd =="mine":
  2295. user = user.name.lower()
  2296. if user in playa:
  2297. if user in waktu1:
  2298. w = json.loads(waktu1[user])
  2299. if time.time() < w:
  2300. w = int(w) - int(time.time())
  2301. minute = 60
  2302. hour = minute * 60
  2303. day = hour * 24
  2304. days = int(w / day)
  2305. hours = int((w % day) / hour)
  2306. minutes = int((w % hour) / minute)
  2307. seconds = int(w % minute)
  2308. string = ""
  2309. if days > 0:
  2310. string += str(days) + " " + (days == 1 and "day" or "days" ) + ", "
  2311. if len(string) > 0 or hours > 0:
  2312. string += str(hours) + " " + (hours == 1 and "hour" or "hours" ) + ", "
  2313. if len(string) > 0 or minutes > 0:
  2314. string += str(minutes) + " " + (minutes == 1 and "minute" or "minutes" ) + ", "
  2315. string += str(seconds) + " " + (seconds == 1 and "second" or "seconds" )
  2316. room.message("Please wait for:<b> %s</b>"% string,True)
  2317. return
  2318. if jack and user in waktu10:
  2319. w = json.loads(waktu10[user])
  2320. if time.time() < w:
  2321. w = int(w) - int(time.time())
  2322. minute = 60
  2323. hour = minute * 60
  2324. day = hour * 24
  2325. days = int(w / day)
  2326. hours = int((w % day) / hour)
  2327. minutes = int((w % hour) / minute)
  2328. seconds = int(w % minute)
  2329. string = ""
  2330. if days > 0:
  2331. string += str(days) + " " + (days == 1 and "day" or "days" ) + ", "
  2332. if len(string) > 0 or hours > 0:
  2333. string += str(hours) + " " + (hours == 1 and "hour" or "hours" ) + ", "
  2334. if len(string) > 0 or minutes > 0:
  2335. string += str(minutes) + " " + (minutes == 1 and "minute" or "minutes" ) + ", "
  2336. string += str(seconds) + " " + (seconds == 1 and "second" or "seconds" )
  2337. room.message("Please wait for:<b> %s</b>"% string,True)
  2338. return
  2339. if user in playa:
  2340. if jack:
  2341. reward=random.randint(5000,9000)
  2342. reward1=random.randint(5000,9000)
  2343. reward2=random.randint(30,50)
  2344. coin2, gold = json.loads(bank[user])
  2345. lvl, exp2, up = json.loads(stats[user])
  2346. gold2= int(gold)+reward2
  2347. gold2=str(gold2)
  2348. coin= int(coin2)+reward*int(up)
  2349. coin=str(coin)
  2350. exp=int(exp2)+reward1
  2351. exp= str(exp)
  2352. up=int(up)
  2353. string = "[<b>✖JACK-MODE!!!✖</b>] "+sntonick(user)+" has mined: <b>Gold</b>[<b>+++"+str(reward2)+"</b>], <b>Coins</b>[<b>+++"+str(reward*up)+"</b>], <b>Exp</b>[<b>+++"+str(reward1)+"</b>]</font><br/><b>GAME IS ✖<b>BOOSTED</b>✖!! GET COINS & EXP 3x THAN USUAL!! AND FASTER!!"
  2354. bank[user] = json.dumps([coin,gold2])
  2355. stats[user] = json.dumps([lvl,exp,up])
  2356. room.message(string,True)
  2357. bank[user] = json.dumps([coin,gold2])
  2358. waktu10[user] = json.dumps(time.time()+240)
  2359. f = open("mcash.txt", "w")
  2360. for user in mcash:
  2361. cash,cp = json.loads(mcash[user])
  2362. f.write(json.dumps([user,cash,cp])+"\n")
  2363. f.close()
  2364. f = open("stats.txt", "w")
  2365. for user in stats:
  2366. lvl,exp,up = json.loads(stats[user])
  2367. f.write(json.dumps([user,lvl,exp,up])+"\n")
  2368. f.close()
  2369. f = open("bank.txt", "w")
  2370. for user in bank:
  2371. coin,gold = json.loads(bank[user])
  2372. f.write(json.dumps([user,coin,gold2])+"\n")
  2373. if user in playa and not jack:
  2374. reward=random.randint(1000,3000)
  2375. reward1=random.randint(1000,3000)
  2376. reward2=random.randint(1,20)
  2377. coin2, gold = json.loads(bank[user])
  2378. lvl, exp2, up = json.loads(stats[user])
  2379. gold2= int(gold)+reward2
  2380. gold2=str(gold2)
  2381. coin= int(coin2)+reward*int(up)
  2382. coin=str(coin)
  2383. exp=int(exp2)+reward1
  2384. exp= str(exp)
  2385. up=int(up)
  2386. string = ""+sntonick(user)+" has mined: <b>Gold</b>[+<b>"+str(reward2)+"</b>], <b>Coins</b>[+<b>"+str(reward*up)+"</b>], <b>Exp</b>[+<b>"+str(reward1)+"</b>]</font>"
  2387. bank[user] = json.dumps([coin,gold2])
  2388. stats[user] = json.dumps([lvl,exp,up])
  2389. room.message(string,True)
  2390. bank[user] = json.dumps([coin,gold2])
  2391. waktu1[user] = json.dumps(time.time()+240)
  2392. f = open("mcash.txt", "w")
  2393. for user in mcash:
  2394. cash,cp = json.loads(mcash[user])
  2395. f.write(json.dumps([user,cash,cp])+"\n")
  2396. f.close()
  2397. f = open("stats.txt", "w")
  2398. for user in stats:
  2399. lvl,exp,up = json.loads(stats[user])
  2400. f.write(json.dumps([user,lvl,exp,up])+"\n")
  2401. f.close()
  2402. f = open("bank.txt", "w")
  2403. for user in bank:
  2404. coin,gold = json.loads(bank[user])
  2405. f.write(json.dumps([user,coin,gold2])+"\n")
  2406. else:
  2407. room.message("Type ;reg for playing this game..",True)
  2408.  
  2409. elif cmd =="mgold":
  2410. if self.getAccess(user) >= 2:
  2411. if user.name in waktu0:
  2412. w = json.loads(waktu0[user.name])
  2413. if time.time() < w:
  2414. w = int(w) - int(time.time())
  2415. minute = 60
  2416. hour = minute * 60
  2417. day = hour * 24
  2418. days = int(w / day)
  2419. hours = int((w % day) / hour)
  2420. minutes = int((w % hour) / minute)
  2421. seconds = int(w % minute)
  2422. string = ""
  2423. if days > 0:
  2424. string += str(days) + " " + (days == 1 and "day" or "days" ) + ", "
  2425. if len(string) > 0 or hours > 0:
  2426. string += str(hours) + " " + (hours == 1 and "hour" or "hours" ) + ", "
  2427. if len(string) > 0 or minutes > 0:
  2428. string += str(minutes) + " " + (minutes == 1 and "minute" or "minutes" ) + ", "
  2429. string += str(seconds) + " " + (seconds == 1 and "second" or "seconds" )
  2430. room.message("Wait after : <font color='#9999FF'>%s</font> before you harvest gold again ^o^ "% string,True)
  2431. return
  2432. if jack and user.name in waktu12:
  2433. w = json.loads(waktu12[user.name])
  2434. if time.time() < w:
  2435. w = int(w) - int(time.time())
  2436. minute = 60
  2437. hour = minute * 60
  2438. day = hour * 24
  2439. days = int(w / day)
  2440. hours = int((w % day) / hour)
  2441. minutes = int((w % hour) / minute)
  2442. seconds = int(w % minute)
  2443. string = ""
  2444. if days > 0:
  2445. string += str(days) + " " + (days == 1 and "day" or "days" ) + ", "
  2446. if len(string) > 0 or hours > 0:
  2447. string += str(hours) + " " + (hours == 1 and "hour" or "hours" ) + ", "
  2448. if len(string) > 0 or minutes > 0:
  2449. string += str(minutes) + " " + (minutes == 1 and "minute" or "minutes" ) + ", "
  2450. string += str(seconds) + " " + (seconds == 1 and "second" or "seconds" )
  2451. room.message("Wait after : <font color='#9999FF'>%s</font> before you harvest gold again ^o^ "% string,True)
  2452. return
  2453. if self.getAccess(user) >= 2 and not jack:
  2454. randgold = random.randint(1,7)
  2455. coin , gold2 = json.loads(bank[user.name])
  2456. gold = int(gold2) + randgold
  2457. room.message(""+user.name+", get .. <font color='#FF9900'><b>Gold</b>[<b>+"+str(randgold)+"</b>]</font>",True)
  2458. gold = str(gold)
  2459. bank[user.name] = json.dumps([coin, gold])
  2460. waktu0[user.name] = json.dumps(time.time()+900)
  2461. if self.getAccess(user) >= 2 and jack:
  2462. randgold = random.randint(10,20)
  2463. coin , gold2 = json.loads(bank[user.name])
  2464. gold = int(gold2) + randgold
  2465. room.message("[<b>✖JACK-MODE!!!✖</b>] "+user.name+", get .. <font color='#FF9900'><b>Gold</b>[+++<b>"+str(randgold)+"</b>]</font>",True)
  2466. gold = str(gold)
  2467. bank[user.name] = json.dumps([coin, gold])
  2468. waktu12[user.name] = json.dumps(time.time()+500)
  2469. f = open("bank.txt", "w")
  2470. for user in bank:
  2471. coin,gold = json.loads(bank[user])
  2472. f.write(json.dumps([user,coin,gold])+"\n")
  2473. f.close()
  2474. else:
  2475. room.message("You can't do ;register first",True)
  2476.  
  2477. elif cmd =="mcoin":
  2478. if user.name in waktu14:
  2479. w = json.loads(waktu14[user.name])
  2480. if time.time() < w:
  2481. w = int(w) - int(time.time())
  2482. minute = 60
  2483. hour = minute * 60
  2484. day = hour * 24
  2485. days = int(w / day)
  2486. hours = int((w % day) / hour)
  2487. minutes = int((w % hour) / minute)
  2488. seconds = int(w % minute)
  2489. string = ""
  2490. if days > 0:
  2491. string += str(days) + " " + (days == 1 and "day" or "days" ) + ", "
  2492. if len(string) > 0 or hours > 0:
  2493. string += str(hours) + " " + (hours == 1 and "hour" or "hours" ) + ", "
  2494. if len(string) > 0 or minutes > 0:
  2495. string += str(minutes) + " " + (minutes == 1 and "minute" or "minutes" ) + ", "
  2496. string += str(seconds) + " " + (seconds == 1 and "second" or "seconds" )
  2497. room.message("Wait after : <font color='#9999FF'>%s</font> before you harvest coin again ^o^ "% string,True)
  2498. return
  2499. if jack and user.name in waktu13:
  2500. w = json.loads(waktu13[user.name])
  2501. if time.time() < w:
  2502. w = int(w) - int(time.time())
  2503. minute = 60
  2504. hour = minute * 60
  2505. day = hour * 24
  2506. days = int(w / day)
  2507. hours = int((w % day) / hour)
  2508. minutes = int((w % hour) / minute)
  2509. seconds = int(w % minute)
  2510. string = ""
  2511. if days > 0:
  2512. string += str(days) + " " + (days == 1 and "day" or "days" ) + ", "
  2513. if len(string) > 0 or hours > 0:
  2514. string += str(hours) + " " + (hours == 1 and "hour" or "hours" ) + ", "
  2515. if len(string) > 0 or minutes > 0:
  2516. string += str(minutes) + " " + (minutes == 1 and "minute" or "minutes" ) + ", "
  2517. string += str(seconds) + " " + (seconds == 1 and "second" or "seconds" )
  2518. room.message("Wait after : <font color='#9999FF'>%s</font> before you harvest coin again ^o^ "% string,True)
  2519. return
  2520. if user.name in playa and not jack:
  2521. randcoin = random.randint(500,1500)
  2522. coin2 , gold = json.loads(bank[user.name])
  2523. coin = int(coin2) + randcoin
  2524. room.message("<f x11"+sntocolor(user.name)+"='"+sntofface(user.name)+"'>Bot Give "+str(user.name)+", Coins[<font color='#9999FF'><b>+"+str(randcoin)+"</b></font>]",True)
  2525. coin = str(coin)
  2526. waktu14[user.name] = json.dumps(time.time()+450)
  2527. bank[user.name] = json.dumps([coin, gold])
  2528. if user.name in playa and jack:
  2529. randcoin = random.randint(1500,2000)
  2530. coin2 , gold = json.loads(bank[user.name])
  2531. coin = int(coin2) + randcoin
  2532. room.message("<f x11"+sntocolor(user.name)+"='"+sntofface(user.name)+"'>[<b>✖JACK-MODE!!!✖</b>] Bot gives "+str(user.name)+", Coins FOR[<font color='#9999FF'><b>+++"+str(randcoin)+"</b></font>]",True)
  2533. coin = str(coin)
  2534. waktu13[user.name] = json.dumps(time.time()+300)
  2535. bank[user.name] = json.dumps([coin, gold])
  2536. if user.name not in playa:
  2537. room.message("<f x11"+sntocolor(user.name)+"='"+sntofface(user.name)+"'>You can't do ;reg first",True)
  2538. f = open("bank.txt", "w")
  2539. for user in bank:
  2540. coin,gold = json.loads(bank[user])
  2541. f.write(json.dumps([user,coin,gold])+"\n")
  2542. f.close()
  2543. print("[SAVE] SAVING MONEY...")
  2544.  
  2545. elif cmd == "sas" and self.getAccess(user) >= 2:
  2546. f = open("stats.txt", "w")
  2547. for user in stats:
  2548. lvl,exp,up = json.loads(stats[user])
  2549. f.write(json.dumps([user,lvl,exp,up])+"\n")
  2550. f.close()
  2551. f = open("bank.txt", "w")
  2552. for user in bank:
  2553. coin,gold = json.loads(bank[user])
  2554. f.write(json.dumps([user,coin,gold])+"\n")
  2555. f.close()
  2556. print("[SAVE] SAVING HALF-MASTERS-LVL-2")
  2557. f = open("playa.txt", "w")
  2558. f.write("\n".join(playa))
  2559. f.close()
  2560. print("[SAVE] SAVING WHITELIST-LVL-1")
  2561. f = open("whitelist.txt", "w")
  2562. f.write("\n".join(whitelist))
  2563. f.close()
  2564. room.message("Save Status : Done ...")
  2565.  
  2566. elif cmd =="bag" and user.name in playa:
  2567. user = user.name.lower()
  2568. if user in inven:
  2569. j = list()
  2570. q = 1
  2571. for i in inven[user]:
  2572. v = inven[user][i]
  2573. j.append("(<b>%s</b>). %s:(<b>%s</b>)" % (q,i,v))
  2574. q += 1
  2575. room.message(sntonick(user)+" have:<br/> "+" ".join(j),True)
  2576. else:
  2577. room.message("Nothing..",True)
  2578.  
  2579. elif cmd == "shop":
  2580. lvl , exp , up = json.loads(stats[user.name])
  2581. coin , gold= json.loads(bank[user.name])
  2582. x=random.randint(1000,4000)
  2583. x1=random.randint(7000,15000)
  2584. fo = int(lvl)*100000
  2585. lu = int(lvl)*5000
  2586. co = int(lvl)*25000
  2587. fo2 = int(lvl)*x
  2588. lu2 = int(lvl)*x1
  2589. room.message("<f x11"+sntocolor(user.name)+"='"+sntofface(user.name)+"'><br/>(<b>1</b>). <b>Fortune</b>("+str(fo)+" coins) - Have depressed because of exp? Don't worry just buy me ! [<b><u>Buy get "+str(fo2)+" Exp</u></b>] <br/>(<b>2</b>). <b>Lucky</b>("+str(lu)+" coins) - Dont have coin to lvl up? I had it ;D [<b><u>Buy get "+str(lu2)+" Coins</u></b>] <br/>(<b>3</b>). <b>Cookie</b>("+str(co)+" coins) - Wanna cookie?? I have what you want 8) [<b><u>Buy get 1-7 Golds</u></b>]",True)
  2590.  
  2591. elif cmd == "buy" and len(args) >= 1:
  2592. args = args.lower()
  2593. try:
  2594. args, value = args.split(" ", 1)
  2595. if "-" in value:
  2596. room.message("<f x11"+sntocolor(user.name)+"='"+sntofface(user.name)+"'>Type The Name Of Items",True);return
  2597. except:
  2598. args = args
  2599. value = "1"
  2600. value = int(value)
  2601.  
  2602. coin , gold= json.loads(bank[user.name])
  2603. lvl,exp,up= json.loads(stats[user.name])
  2604. coin , gold = int(coin),int(gold)
  2605. itemlist = ["fortune","lucky","cookie"]
  2606. if args not in itemlist:
  2607. room.message("<f x11"+sntocolor(user.name)+"='"+sntofface(user.name)+"'>Invalid item, ",True);return
  2608. if args== "fortune":
  2609. coin=coin-(int(lvl)*100000*value)
  2610. if coin <= 0:room.message("<f x11"+sntocolor(user.name)+"='"+sntofface(user.name)+"'>not enough coin, you need <b><font color='#CCCC66'>%s</font></b> coin"%(75000*value),True);return
  2611.  
  2612. if args== "lucky":
  2613. coin=coin-(int(lvl)*5000*value)
  2614. if coin <= 0:room.message("<f x11"+sntocolor(user.name)+"='"+sntofface(user.name)+"'>not enough coin, you need <b><font color='#CCCC66'>%s</font></b> coin"%(27836*value),True);return
  2615.  
  2616. if args== "cookie":
  2617. coin=coin-(int(lvl)*25000*value)
  2618. if coin <= 0:room.message("<f x11"+sntocolor(user.name)+"='"+sntofface(user.name)+"'>not enough coin, you need <b><font color='#CCCC66'>%s</font></b> coin"%(27836*value),True);return
  2619.  
  2620.  
  2621. if user.name in inven:
  2622. if args in inven[user.name]:
  2623. val = inven[user.name][args]
  2624. val = val + value
  2625. inven[user.name][args] = val
  2626. else:
  2627. inven[user.name].update({args:value})
  2628. else:
  2629. inven.update({user.name:{args:value}})
  2630.  
  2631. coin , gold = str(coin),str(gold)
  2632. bank[user.name] = json.dumps([coin,gold])
  2633. room.message(user.name+" has bought <b><font color='#CCCC66'>%s</font></b> %s "%(value,args),True)
  2634.  
  2635. elif cmd == "use" and len(args) >= 1:
  2636. args = args.lower()
  2637. try:
  2638. args, value = args.split(" ", 1)
  2639. if "-" in value:
  2640. room.message("Type The Name Of Items");return
  2641. except:
  2642. args = args
  2643. value = "1"
  2644. value = int(value)
  2645. coin , gold = json.loads(bank[user.name])
  2646. lvl, exp, up = json.loads(stats[user.name])
  2647. coin , gold = int(coin),int(gold)
  2648. lvl , exp , up = int(lvl),int(exp),int(up)
  2649. itemlist = ["fortune","lucky","cookie"]
  2650. if args not in itemlist and inven:
  2651. room.message("Invalid item, ");return
  2652. string = ""
  2653. if args== "fortune":
  2654. fo=random.randint(1000,4000)
  2655. a = value*fo
  2656. exp = int(exp) + a
  2657. exp = str(exp)
  2658. stats[user.name] = json.dumps([lvl,exp,up])
  2659. string += " & got <b>Exp</b>[<b>+"+str(a)+"</b>] <b>Total Exp</b>: [<b>"+str(exp)+"</b>]"
  2660. if user.name in inven:
  2661. if args in inven[user.name]:
  2662. val = inven[user.name][args]
  2663. val = val - value
  2664. if val < 0:
  2665. val = 0
  2666. room.message("no item");return
  2667.  
  2668. if args== "lucky":
  2669. lu=random.randint(7000,15000)
  2670. b = value*lu
  2671. coin = int(coin) + b
  2672. coin = str(coin)
  2673. string += " & got: <b>Coins</b>[<b>+"+str(b)+"</b>] <b>Total Coins</b>: [<b>"+str(coin)+"</b>]"
  2674. if user.name in inven:
  2675. if args in inven[user.name]:
  2676. val = inven[user.name][args]
  2677. val = val - value
  2678. if val < 0:
  2679. val = 0
  2680. room.message("no item");return
  2681.  
  2682. if args== "cookie":
  2683. co=random.randint(1,1)
  2684. c = value*co
  2685. gold = int(gold) + c
  2686. gold = str(gold)
  2687. string += " & got: <b>Golds</b>[<b>+"+str(c)+"</b>] <b>Total Golds</b>: [<b>"+str(gold)+"</b>]"
  2688. if user.name in inven:
  2689. if args in inven[user.name]:
  2690. val = inven[user.name][args]
  2691. val = val - value
  2692. if val < 0:
  2693. val = 0
  2694. room.message("no item");return
  2695. inven[user.name][args] = val
  2696.  
  2697. room.message("<f x11"+sntocolor(user.name)+"='"+sntofface(user.name)+"'>"+user.name+" has use <b><font color='#CCCC66'>%s</font></b> %s %s"%(value,args,string),True)
  2698. else:room.message("no item");return
  2699. coin , gold = str(coin),str(gold)
  2700. bank[user.name] = json.dumps([coin,gold])
  2701. stats[user.name] = json.dumps([lvl,exp,up])
  2702.  
  2703. if cmd == "jack" and user.name.lower() == "thelorgorenk":
  2704. jack = True
  2705. room.message("Done..")
  2706.  
  2707. if cmd == "rjack" and user.name.lower() == "thelorgorenk":
  2708. jack = False
  2709. room.message("Done..")
  2710.  
  2711. if cmd =="lvlstats" and self.getAccess(user) >=1:
  2712. for i in stats:
  2713. try:
  2714. lvl , exp , up = json.loads(stats[i])
  2715. except:pass
  2716. lvlstats[i]=int(lvl)
  2717. res = (sorted(lvlstats, key=lvlstats.get, reverse=True))
  2718. j = []
  2719. val = 1
  2720. for k in res:
  2721. lvl,exp,up = json.loads(stats[k])
  2722. j.append('<i> %s </i> (<b>%s</b>:<b>%s</b>: <b>%s</b>)'% (k,lvl,exp,up))
  2723. val = val +1
  2724. room.message("<f x11"+sntocolor(user.name)+"='"+sntofface(user.name)+"'>Awesome Player's <br/>%s"%"<br/>".join(j[:10]),True)
  2725.  
  2726. elif cmd == "cgive" and len(args) >= 1:
  2727. args, value = args.split(" ", 1)
  2728. if args not in playa:
  2729. room.message("<f x11"+sntocolor(user.name)+"='"+sntofface(user.name)+"'>"+args+" doesn't have bank. tell him to make one by typing ;reg",True)
  2730. return
  2731. coin1 , gold1= json.loads(bank[user.name])
  2732. coin2 , gold2= json.loads(bank[args])
  2733. if "-" in value:
  2734. room.message("<f x11"+sntocolor(user.name)+"='"+sntofface(user.name)+"'>Type The Value How Much You Want To Transfer ..",True);return
  2735. coin1, coin2, value = int(coin1), int(coin2), int(value)
  2736. coin1 = coin1 - value
  2737. coin2 = coin2 + value
  2738. if coin1 < 0:room.message("<f x11"+sntocolor(user.name)+"='"+sntofface(user.name)+"'>Not enough coin to transfer",True);return
  2739. room.message("<f x11"+sntocolor(user.name)+"='"+sntofface(user.name)+"'>"+user.name+" has given %s %s coins!"%(args, str(value)),True)
  2740. bank[user.name] = json.dumps([coin1,gold1])
  2741. bank[args] = json.dumps([coin2,gold2])
  2742.  
  2743. elif cmd == "ggive" and len(args) >= 1:
  2744. args, value = args.split(" ", 1)
  2745. if args not in playa:
  2746. room.message("<f x11"+sntocolor(user.name)+"='"+sntofface(user.name)+"'>"+args+" doesn't have bank. tell him to make one by typing ;reg",True)
  2747. return
  2748. coin1 , gold1= json.loads(bank[user.name])
  2749. coin2 , gold2= json.loads(bank[args])
  2750. if "-" in value:
  2751. room.message("<f x11"+sntocolor(user.name)+"='"+sntofface(user.name)+"'>Type The Value How Much You Want To Transfer ..",True);return
  2752. gold1, gold2, value = int(gold1), int(gold2), int(value)
  2753. gold1 = gold1 - value
  2754. gold2 = gold2 + value
  2755. if gold1 < 0:room.message("<f x11"+sntocolor(user.name)+"='"+sntofface(user.name)+"'>Not enough coin to transfer",True);return
  2756. room.message(user.name+" has give %s %s golds!"%(args, str(value)),True)
  2757. bank[user.name] = json.dumps([coin1,gold1])
  2758. bank[args] = json.dumps([coin2,gold2])
  2759.  
  2760. elif cmd == "atk" and len(args) >= 1:
  2761. args, value = args.split(" ", 1)
  2762. if args not in playa:
  2763. room.message("<f x11"+sntocolor(user.name)+"='"+sntofface(user.name)+"'>"+args+" doesn't have bank. tell him to make one by typing ;reg",True)
  2764. return
  2765. coin1 , gold1= json.loads(bank[user.name])
  2766. coin2 , gold2= json.loads(bank[args])
  2767. if "-" in value:
  2768. room.message("<f x11"+sntocolor(user.name)+"='"+sntofface(user.name)+"'>Type The Value How Much You Want To Attack ..",True);return
  2769. coin1, coin2, value = int(coin1), int(coin2), int(value)
  2770. coin1 = coin1 - value
  2771. coin2 = coin2 - value
  2772. if coin1 < 0:room.message("<f x11"+sntocolor(user.name)+"='"+sntofface(user.name)+"'>Not enough coin to Attack , try low value",True);return
  2773. room.message("<f x11"+sntocolor(user.name)+"='"+sntofface(user.name)+"'>"+user.name+" has attack %s for %s coins!"%(sntonick(args), str(value)),True)
  2774. bank[user.name] = json.dumps([coin1,gold1])
  2775. bank[args] = json.dumps([coin2,gold2])
  2776.  
  2777.  
  2778. ##Other Crap here, Dont worry about it
  2779.  
  2780. def onFloodWarning(self, room):
  2781. room.reconnect()
  2782.  
  2783. def onJoin(self, room, user):
  2784. print(user.name + " joined the chat!")
  2785.  
  2786. def onLeave(self, room, user):
  2787. print(user.name + " left the chat!")
  2788.  
  2789. def onUserCountChange(self, room):
  2790. print("users: " + str(room.usercount))
  2791.  
  2792.  
  2793.  
  2794.  
  2795. if __name__ == "__main__":
  2796. TestBot.easy_start(rooms, botname, password)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement