Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ##############################################################################################################################################
- #################################################################################################################
- import ch
- import random
- import sys
- import re
- import json
- import time
- import datetime
- import os
- import urllib
- ##Dance moves!
- #kinda useless
- dancemoves = [
- "(>^.^)>",
- "(v^.^)v",
- "v(^.^v)",
- "<(^.^<)"
- ]
- from xml.etree import cElementTree as ET
- if sys.version_info[0] > 2:
- import urllib.request as urlreq
- else:
- import urllib2 as urlreq
- botname = 'Ficent'
- password = 'allvhan785'
- ##nick names
- def sntonick(username):
- user = username.lower()
- if user in nicks:
- nick = json.loads(nicks[user])
- return nick
- else:
- return user
- #### Returns the number of seconds since the program started.
- ################################################################
- def getUptime():
- # do return startTime if you just want the process start time
- return time.time() - startTime
- def reboot():
- output = ("rebooting server . . .")
- os.popen("sudo -S reboot")
- return output
- #### SYSTEM UPTIME
- def uptime():
- total_seconds = float(getUptime())
- # Helper vars:
- MINUTE = 60
- HOUR = MINUTE * 60
- DAY = HOUR * 24
- # Get the days, hours, etc:
- days = int( total_seconds / DAY )
- hours = int( ( total_seconds % DAY ) / HOUR )
- minutes = int( ( total_seconds % HOUR ) / MINUTE )
- seconds = int( total_seconds % MINUTE )
- # Build up the pretty string (like this: "N days, N hours, N minutes, N seconds")
- string = ""
- if days > 0:
- string += str(days) + " " + (days == 1 and "day" or "days" ) + ", "
- if len(string) > 0 or hours > 0:
- string += str(hours) + " " + (hours == 1 and "hour" or "hours" ) + ", "
- if len(string) > 0 or minutes > 0:
- string += str(minutes) + " " + (minutes == 1 and "minute" or "minutes" ) + ", "
- string += str(seconds) + " " + (seconds == 1 and "second" or "seconds" )
- return string;
- ## DEFINITIONS
- dictionary = dict()
- f = open("definitions.txt", "r")
- for line in f.readlines():
- try:
- if len(line.strip())>0:
- word, definition, name = json.loads(line.strip())
- dictionary[word] = json.dumps([definition, name])
- except:
- print("[ERROR]Cant load definition: %s" % line)
- f.close()
- ##nicks
- nicks=dict()#empty list
- f=open ("nicks.txt","r")#r=read w=right
- for line in f.readlines():#loop through eachlinimporte and read each line
- try:#try code
- if len(line.strip())>0:#strip the whitespace checkgreater than 0
- user , nick = json.loads(line.strip())
- nicks[user] = json.dumps(nick)
- except:
- print("[Error]Can't load nick %s" % line)
- f.close()
- ##Rooms
- rooms = []
- f = open("rooms.txt", "r") # read-only
- for name in f.readlines():
- if len(name.strip())>0: rooms.append(name.strip())
- f.close()
- ##Champion
- Champion = []
- try:
- file = open("Champion.txt", "r")
- for name in file.readlines():
- if len(name.strip()) > 0:
- Champion.append(name.strip())
- print("[INFO]Owners loaded...")
- file.close()
- except:
- print("[ERROR]no file named Champion")
- print("2 second to read the error")
- time.sleep(2)
- exit()
- time.sleep(1)
- ###Hero
- Hero = []
- try:
- file = open("Hero.txt", "r")
- for name in file.readlines():
- if len(name.strip()) > 0:
- Hero.append(name.strip())
- print("[INFO]Hero loaded...")
- file.close()
- except:
- print("[ERROR]no file named Hero")
- print("2 second to read the error")
- time.sleep(2)
- exit()
- time.sleep(1)
- ###Chief
- Chief = []
- try:
- file = open("Chief.txt", "r")
- for name in file.readlines():
- if len(name.strip()) > 0:
- Chief.append(name.strip())
- print("[INFO]Chief loaded...")
- file.close()
- except:
- print("[ERROR]no file named Chief")
- print("2 second to read the error")
- time.sleep(2)
- exit()
- time.sleep(1)
- ##Guardian
- Guardian = []
- try:
- file = open("Guardian.txt", "r")
- for name in file.readlines():
- if len(name.strip()) > 0:
- Guardian.append(name.strip())
- print("[INFO]Guardian loaded...")
- file.close()
- except:
- print("[ERROR]no file named Guardian")
- print("2 second to read the error")
- time.sleep(2)
- exit()
- time.sleep(1)
- ##Initial
- Initial = []
- try:
- file = open("Initial.txt", "r")
- for name in file.readlines():
- if len(name.strip()) > 0:
- Initial.append(name.strip())
- print("[INFO]Initial loaded...")
- file.close()
- except:
- print("[ERROR]no file named Initial")
- print("2 second to read the error")
- time.sleep(2)
- exit()
- time.sleep(1)
- #Dlist
- dlist = []
- f = open("dlist.txt", "r") # read-onlyimport
- for name in f.readlines():
- if len(name.strip())>0: dlist.append(name.strip())
- f.close()
- #END#
- #SN TRY
- sn = dict()
- try:
- f = open('note.txt','r')
- sn = eval(f.read())
- f.close()
- except:pass
- ## Send Notes
- sasaran = dict()
- f = open ("notes.txt", "r") #read-only
- for line in f.readlines():
- try:
- if len(line.strip())>0:
- to, body, sender = json.loads(line.strip())
- sasaran[to] = json.dumps([body, sender])
- except:
- print("[Error] Notes load fails : %s" % line)
- f.close()
- # SN Notifs
- notif = []
- f = open("notif.txt", "r")
- for name in f.readlines():
- if len(name.strip())>0: notif.append(name.strip())
- f.close
- blacklist = []
- f = open("blacklist.txt", "r")
- for name in f.readlines():
- if len(name.strip())>0: blacklist.append(name.strip())
- f.close()
- def tube(args):
- """
- #In case you don't know how to use this function
- #type this in the python console:
- >>> tube("pokemon dash")
- #and this function would return this thing:
- {'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'}
- """
- search = args.split()
- url = urlreq.urlopen("https://www.googleapis.com/youtube/v3/search?q=%s&part=snippet&key=AIzaSyBSnh-sIjd97_FmQVzlyGbcaYXuSt_oh84" % "+".join(search))
- udict = url.read().decode('utf-8')
- data = json.loads(udict)
- rest = []
- for f in data["items"]:
- rest.append(f)
- d = random.choice(rest)
- link = "http://www.youtube.com/watch?v=" + d["id"]["videoId"]
- videoid = d["id"]["videoId"]
- title = d["snippet"]["title"]
- uploader = d["snippet"]["channelTitle"]
- descript = d["snippet"]['description']
- count = d["snippet"]["publishedAt"]
- 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])
- def gs(args):
- args = args.split()
- headers = {}
- headers['User-Agent'] = "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.27 Safari/537.17"
- req = urllib.request.Request("https://www.google.com.br/search?q=" + "+".join(args), headers = headers)
- resp = urllib.request.urlopen(req).read().decode("utf-8").replace('\n','').replace('\r','').replace('\t','').replace('http://','gs:').replace('https://','gs:')
- anjay = re.findall('<h3 class="r">(.*?)</h3>', resp)
- setter = list()
- la = "".join(anjay)
- a = re.findall('<a href="gs:(.*?)" onmousedown="(.*?)">(.*?)</a>', la)
- q = 1
- for link, fak, title in a:
- setter.append("<br/>(%s) %s : http://%s" % (q, title.capitalize(), link))
- q += 1
- return "".join(setter[0:4])
- def saveRank():
- f = open("Champion.txt","w")
- f.write("\n".join(Champion))
- f.close()
- f = open("Hero.txt","w")
- f.write("\n".join(Hero))
- f.close()
- f = open("Chief.txt","w")
- f.write("\n".join(Chief))
- f.close()
- f = open("Guardian.txt","w")
- f.write("\n".join(Guardian))
- f.close()
- def gis(cari):
- argss = cari
- args = argss.split()
- headers = {}
- headers['User-Agent'] = "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.27 Safari/537.17"
- req = urllib.request.Request("https://www.google.com.br/search?hl=en&authuser=0&site=imghp&tbm=isch&source=hp&biw=1366&bih=623&q=" + "+".join(args), headers = headers)
- 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')
- anjay = re.findall('<div class="rg_meta">(.*?)</div>', resp)
- setter = list()
- la = "".join(anjay)
- a = re.findall('"ou":"gis:(.*?):end","ow"', la)
- q = 1
- for result in a:
- if ".jpg" in result or ".gif" in result or ".png" in result:
- 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:
- setter.append('(%s) http://%s' % (q, result))
- q += 1
- return "<br/>"+"<br/>".join(setter[0:4])
- ##Setting Pretty Colors
- class TestBot(ch.RoomManager):
- def onInit(self):
- self.setNameColor("000099")
- self.setFontColor("000099")
- self.setFontFace("1")
- self.setFontSize(11)
- self.enableBg()
- self.enableRecording()
- ##Connecting Crap
- def onConnect(self, room):
- print("Connected")
- def onReconnect(self, room):
- print("Reconnected")
- def onDisconnect(self, room):
- print("Disconnected")
- #################################################################
- ### Get user access from the file, and retun lvl of access number
- #################################################################
- def getAccess(self, user):
- if user.name in Champion: return 5 # Champion
- elif user.name in Hero: return 4 # Hero
- elif user.name in Chief: return 3 # Chief
- elif user.name in Guardian: return 2 # Guardian
- elif user.name in Initial: return 1 # Initial
- elif user.name in dlist: return 0
- else: return 0
- ##Ignore this, you dont need to worry about this
- #Well, you can actually take a little time to look at it and learn something
- def onMessage(self, room, user, message):
- try:
- msgdata = message.body.split(" ",1)
- if len(msgdata) > 1:
- cmd, args = msgdata[0], msgdata[1]
- else:
- cmd, args = msgdata[0],""
- cmd=cmd.lower()
- global lockdown
- global newnum
- print(user.name+" - "+message.body)
- if user.name in notif:
- room.message(user.name+", you got ("+str(len(sn[user.name]))+") messages unread. Do irn to read them")
- notif.remove(user.name)
- if user == self.user: return
- if "cen" == message.body:
- if self.getAccess(user) >= 5 or room.getLevel(user) > 0 and not user.name in blacklist:
- room.message ("Yes, milord.")
- if "bot" == message.body:
- if self.getAccess(user) >= 1 or room.getLevel(user) > 0 and not user.name in blacklist:
- room.message (random.choice(["i'm here "+sntonick(user.name)+ " ^.^ "]),True)
- if "malam" == message.body:
- if self.getAccess(user) >= 1 or room.getLevel(user) > 0 and not user.name in blacklist:
- room.message("Selamat malam"+ " ^^ ")
- if "icyie" == message.body:
- if self.getAccess(user) >= 1 or room.getLevel(user) > 0 and not user.name in blacklist:
- room.message("Hai @"+sntonick(user.name)+ " ^^ ")
- if "afk" == message.body:
- if self.getAccess(user) >= 1 or room.getLevel(user) > 0 and not user.name in blacklist:
- room.message("Sampai jumpa lagi @"+sntonick(user.name)+ " *waves* ")
- if "back" == message.body:
- if self.getAccess(user) >= 1 or room.getLevel(user) > 0 and not user.name in blacklist:
- room.message("Wellcome Back @"+sntonick(user.name)+ " :) ")
- if "pagi" == message.body:
- if self.getAccess(user) >= 1 or room.getLevel(user) > 0 and not user.name in blacklist:
- room.message("Selamat pagi"+ " :) ")
- if "siang" == message.body:
- if self.getAccess(user) >= 1 or room.getLevel(user) > 0 and not user.name in blacklist:
- room.message("Selamat siang "+sntonick(user.name)+ " ^o^ "),True
- if "sore" == message.body:
- if self.getAccess(user) >= 1 or room.getLevel(user) > 0 and not user.name in blacklist:
- room.message("Selamat sore"+ " ^^ ")
- if "Bro" == message.body:
- if self.getAccess(user) >= 1 or room.getLevel(user) > 0 and not user.name in blacklist:
- room.message("Gak perlu manggil manggil"+ " :@ ")
- if "afk" in message.body:
- if self.getAccess(user) >= 1 or room.getLevel(user) > 0 and not user.name in blacklist:
- room.message (random.choice(["mata ashita "+sntonick(user.name)+" :) ",] ),True)
- if "brb" in message.body:
- if self.getAccess(user) >= 1 or room.getLevel(user) > 0 and not user.name in blacklist:
- room.message (random.choice(["Bye "+sntonick(user.name)+" :) ",]),True)
- if message.body == "": return
- if message.body[0] in ["-"]:
- data = message.body[1:].split(" ", 1)
- if len(data) > 1:
- cmd, args = data[0], data[1]
- else:
- cmd, args = data[0], ""
- ##check access and ignore
- if self.getAccess(user) == 0: return
- def pars(args):
- args=args.lower()
- for name in room.usernames:
- if args in name:return name
- def roompars(args):
- args = args.lower()
- for name in self.roomnames:
- if args in name:return name
- def roomUsers():
- usrs = []
- gay = []
- prop = 0
- prop = prop + len(room._userlist) - 1
- for i in room._userlist:
- i = str(i)
- usrs.append(i)
- while prop >= 0:
- j = usrs[prop].replace("<User: ", "")
- i = j.replace(">", "")
- gay.append(i)
- prop = prop - 1
- return gay
- def getParticipant(arg):
- rname = self.getRoom(arg)
- usrs = []
- gay = []
- finale = []
- prop = 0
- prop = prop + len(rname._userlist) - 1
- for i in rname._userlist:
- i = str(i)
- usrs.append(i)
- while prop >= 0:
- j = usrs[prop].replace("<User: ", "")
- i = j.replace(">", "")
- gay.append(i)
- prop = prop - 1
- for j in gay:
- if j not in finale:
- finale.append(j)
- return finale
- #Find
- if cmd == "find" and len(args) > 0:
- name = args.split()[0].lower()
- if not ch.User(name).roomnames:
- room.message("aku tidak tau")
- else:
- room.message("kamu dapat menemukan %s Di %s" % (args, ", ".join(ch.User(name).roomnames)),True)
- ##cmds
- if cmd == "cmds":
- if user.name in Champion and not user.name in Hero and not user.name in Guardian and not user.name in Chief and not user.name in Initial:
- room.message("<br/>"+user.name+" Rank 5 [Champion] "+"<br/>"+" Perintah[ > ] :<br/>wl , gs(Google search) , yt(Youtube) , Google Image Search (GIS) , df(define) , udf(undefine) , fax , bc , say , sn(sendnote) , rn(readnote) , mods , join , leave , delete , mydict, nick , staff , setnick , mynick , seenick , profile , Profile pict/pfpic , rank , myrank , find , ranker , tea , Jones , blacklist (bl) , unblacklist (ubl) , Clear , setrank , ban , unban ",True)
- if user.name in Hero and not user.name in Champion and not user.name in Chief and not user.name in Guardian and not user.name in Initial:
- room.message("<br/>"+user.name+" Rank 4 [Hero] "+"<br/>"+" Perintah[ > ] :<br/>wl , gs(Google search) , yt(Youtube) , Google Image Search (GIS) , df(define) , udf(undefine) , fax , bc , say , sn(sendnote) , rn(readnote) , mods , join , leave , delete , mydict, nick , staff , setnick , mynick , seenick , profile , Profile pict/pfpic , rank , myrank , find , ranker , tea , jones , Clear , myIp , ban , unban ",True)
- if user.name in Chief and not user.name in Champion and not user.name in Guardian and not user.name in Hero and not user.name in Initial:
- room.message("<br/>"+user.name+" Rank 3 [Chief] "+"<br/>"+" Perintah[ > ] :<br/>wl , gs(Google search) , yt(Youtube) , Google Image Search (GIS) , df(define) , udf(undefine) , fax , bc , say , sn(sendnote) , rn(readnote) , mods , join , leave , delete , mydict, nick , staff , setnick , mynick , seenick , profile , Profile pict/pfpic , rank , myrank , find , ranker , tea , MyIp ,",True)
- if user.name in Guardian and not user.name in Champion and not user.name in Chief and not user.name in Hero and not user.name in Initial:
- room.message("<br/>"+user.name+" Rank 2 [Guardian] "+"<br/>"+" Perintah[ > ] :<br/>wl , gs(Google search) , yt(Youtube) , Google Image Search (GIS) , df(define) , udf(undefine) , fax , bc , say , sn(sendnote) , rn(readnote) , mods , join , leave , delete , mydict, nick , staff , setnick , mynick , seenick , profile , Profile pict/pfpic , rank , myrank , find , ranker , MyIp ,",True)
- if user.name in Initial and not user.name in Champion and not user.name in Hero and not user.name in Chief and not user.name in pembantu:
- room.message("<br/>"+user.name+" Rank 1 [initial] "+"<br/>"+" Perintah[ > ] :<br/>wl , gs(Google search) , yt(Youtube) , Google Image Search (GIS) , df(define) , udf(undefine) , fax , bc , say , sn(sendnote) , rn(readnote) , mods , mydict, nick , staff , setnick , mynick , seenick , profile , Profile pict/pfpic , rank , myrank , find , ranker , MyIp ,",True)
- ##Setnick
- if cmd == "setnick":
- if self.getAccess(user) < 5:return
- try:
- if args:
- user, nick = args.split(" ",1)
- nicks[user]=json.dumps(nick)
- room.message("Berhasil diSimpan")
- f = open("nicks.txt","w")
- for user in nicks:
- nick = json.loads(nicks[user])
- f.write(json.dumps([user,nick])+"\n")
- f.close()
- else:
- room.message("Who?")
- except:
- room.message("The nick please")
- ##Setrank
- if cmd == "setrank":
- if self.getAccess(user) < 5:return
- try:
- if len(args) >= 4:
- name = args
- if pars(name) == None:
- name = name
- elif pars(name) != None:
- name = pars(name)
- name, rank = args.lower().split(" ", 1)
- if rank == "5":
- Champion.append(name)
- f = open("champion.txt", "w")
- f.write("\n".join(champion))
- f.close()
- room.message("Sukses")
- if name in Hero:
- Hero.remove(name)
- f = open("Hero.txt", "w")
- f.write("\n".join(Hero))
- f.close()
- if name in Chief:
- Chief.remove(name)
- f = open("Chief.txt", "w")
- f.write("\n".join(Chief))
- f.close()
- if name in Initial:
- Initial.remove(name)
- f = open("Initial.txt", "w")
- f.write("\n".join(Initial))
- f.close()
- if rank == "4":
- Hero.append(name)
- f = open("Hero.txt", "w")
- f.write("\n".join(Hero))
- f.close()
- room.message("Sukses")
- if name in Chief:
- Chief.remove(name)
- f = open("Chief.txt", "w")
- f.write("\n".join(Chief))
- f.close()
- if name in Guardian:
- Guardian.remove(name)
- f = open("Guardian.txt", "w")
- f.write("\n".join(Guardian))
- f.close()
- if name in Initial:
- Initial.remove(name)
- f = open("Initial.txt", "w")
- f.write("\n".join(Initial))
- f.close()
- if rank == "3":
- Chief.append(name)
- f = open("Chief.txt", "w")
- f.write("\n".join(Chief))
- f.close()
- room.message("Sukses")
- if name in Champion:
- Champion.remove(name)
- f = open("Champion.txt", "w")
- f.write("\n".join(Champion))
- f.close()
- if name in Hero:
- Hero.remove(name)
- f = open("Hero.txt", "w")
- f.write("\n".join(Hero))
- f.close()
- if name in Initial:
- Initial.remove(name)
- f = open("Initial.txt", "w")
- f.write("\n".join(Initial))
- f.close()
- if rank == "2":
- Guardian.append(name)
- f = open("Guardian.txt", "w")
- f.write("\n".join(Guardian))
- f.close()
- room.message("Sukses")
- if name in Champion:
- Champion.remove(name)
- f = open("Champion.txt", "w")
- f.write("\n".join(Champion))
- f.close()
- if name in Hero:
- Hero.remove(name)
- f = open("Hero.txt", "w")
- f.write("\n".join(Hero))
- f.close()
- if name in Initial:
- Initial.remove(name)
- f = open("Initial.txt", "w")
- f.write("\n".join(Initial))
- f.close()
- if rank == "1":
- Initial.append(name)
- f = open("Initial.txt", "w")
- f.write("\n".join(Initial))
- f.close()
- room.message("Sukses")
- if name in Champion:
- Champion.remove(name)
- f = open("Champion.txt", "w")
- f.write("\n".join(Champion))
- f.close()
- if name in Hero:
- Hero.remove(name)
- f = open("Hero.txt", "w")
- f.write("\n".join(Hero))
- f.close()
- if name in Guardian:
- Guardian.remove(name)
- f = open("Guardian.txt", "w")
- f.write("\n".join(Guardian))
- f.close()
- except:
- room.message("something wrong")
- # clear
- elif cmd == "clear":
- if room.getLevel(self.user) > 0:
- if self.getAccess(user) >= 5 or room.getLevel(user) == 2:
- room.clearall(),
- room.clearUser(ch.User(random.choice(room.usernames))),
- room.clearUser(ch.User(random.choice(room.usernames))),
- room.clearUser(ch.User(random.choice(room.usernames))),
- room.clearUser(ch.User(random.choice(room.usernames))),
- room.clearUser(ch.User(random.choice(room.usernames))),
- room.clearUser(ch.User(random.choice(room.usernames))),
- room.clearUser(ch.User(random.choice(room.usernames))),
- room.clearUser(ch.User(random.choice(room.usernames))),
- room.clearUser(ch.User(random.choice(room.usernames))),
- room.clearUser(ch.User(random.choice(room.usernames))),
- room.clearUser(ch.User(random.choice(room.usernames))),
- room.clearUser(ch.User(random.choice(room.usernames))),
- room.clearUser(ch.User(random.choice(room.usernames))),
- room.clearUser(ch.User(random.choice(room.usernames))),
- room.clearUser(ch.User(random.choice(room.usernames))),
- room.clearUser(ch.User(random.choice(room.usernames))),
- room.clearUser(ch.User(random.choice(room.usernames))),
- room.clearUser(ch.User(random.choice(room.usernames))),
- room.clearUser(ch.User(random.choice(room.usernames))),
- room.clearUser(ch.User(random.choice(room.usernames))),
- room.clearUser(ch.User(random.choice(room.usernames))),
- room.clearUser(ch.User(random.choice(room.usernames))),
- room.clearUser(ch.User(random.choice(room.usernames))),
- room.clearUser(ch.User(random.choice(room.usernames))),
- room.clearUser(ch.User(random.choice(room.usernames))),
- room.clearUser(ch.User(random.choice(room.usernames))),
- room.clearUser(ch.User(random.choice(room.usernames))),
- room.clearUser(ch.User(random.choice(room.usernames))),
- room.clearUser(ch.User(random.choice(room.usernames))),
- room.clearUser(ch.User(random.choice(room.usernames))),
- room.clearUser(ch.User(random.choice(room.usernames))),
- room.clearUser(ch.User(random.choice(room.usernames))),
- room.clearUser(ch.User(random.choice(room.usernames))),
- room.clearUser(ch.User(random.choice(room.usernames))),
- room.clearUser(ch.User(random.choice(room.usernames))),
- else: room.message("Only rank 4+ or the room owner can do this")
- else:
- room.message("aku bukan mods disini :|")
- ##delete chat
- elif (cmd == "delete" or cmd == "dl" or cmd == "del"):
- if room.getLevel(self.user) > 0:
- if self.getAccess(user) >= 1 or room.getLevel(user) > 0:
- name = args.split()[0].lower()
- room.clearUser(ch.User(name))
- else:room.message("kamu tidak bisa melakukannya!!")
- else:
- room.message("aku bukan mods disini :|")
- ##fax
- if cmd == "fax":
- if self.getAccess(user) >= 1:
- if len(args) > 1:
- try:
- target, body = args.split(" ", 1)
- if user.name in room.modnames or user.name in room.ownername or self.getAccess(user) > 2:
- if target in self.roomnames:
- if room.name == "dai-tenshi":
- self.getRoom(target).message("Fax from <b>%s</b> [via <font color='#ff0000'><b>%s</b></font> Fax] - <font color='#3300FF'>%s</font>" % (sntonick(user.name), "Heaven", body), True)
- room.message("[<b>%s</b>] Fax Sent" % "INF", True)
- else:
- self.getRoom(target).message("Fax from <b>%s</b> [via <font color='#ff0000'><b>%s</b></font> Fax] - <font color='#3300FF'>%s</font>" % (sntonick(user.name), room.name, body), True)
- room.message("[<b>%s</b>] Fax Sent" % "INF", True)
- else:
- room.message("[<b>%s</b>] There's no Fax Service in <font color='#ff0000'><b>%s</b></font> :|" % ("ERROR", target), True)
- else:
- room.message("You mere mortals can never do that !!")
- self.setTimeout(int(3), room.message, "*Aims Colt. Python Revolver at <b>%s</b> and shot him dead*" % user.name, True)
- except:
- room.message("Gagal !!")
- ## Broadcast
- if cmd == "broadcast" or cmd == "Broadcast" or cmd == "Shout" or cmd == "shout" or cmd == "Bc" or cmd == "Bc":
- if user.name in Champion: #Only rank 4+ can Broadcast a Message
- for room in self.rooms:
- if args == "": return
- else:
- room.message("Broadcast de la - "+user.name + ": "+args, True)
- else:
- room.message("[<b>%s</b>] Only Admins Members are allowed" % "ERROR", True)
- ####ban
- if cmd == "ban" or cmd == "Ban" or cmd == "Interzicere" or cmd == "interzicere":
- if user.name in Champion:
- name = args
- if user.name in Champion:
- room.message("Njet >_>")
- return
- if name in room.usernames:
- room.banUser(ch.User(name))
- room.message("<b>%s</b> is banned" % (name), True)
- self.pm.message(ch.User(name.lower()), "You have been banned from %s by %s. " % (room.name, user.name))
- else:
- room.message("i don't see "+name+" here :|")
- ####Unban
- elif cmd == "unban" or cmd == "ub" or cmd == "UnBan" or cmd == "Unban" or cmd == "Scoate Interzicerea" or cmd == "Scoate interzicerea":
- if user.name in Champion:
- name = args
- if user.name in Champion: return
- room.unban(ch.User(name))
- room.message("<b>%s</b> is unbanned" % (name), True)
- self.pm.message(ch.User(name.lower()), "You have been unbanned from %s by %s. Please behave lik a Punk!!" % (room.name, user.name))
- else:
- room.message("You mere mortals can never do that !!")
- ##Ranker
- if cmd == "ranker":
- room.message("<br/><f x120000FF='0'><b>Champion:</b></f> %s<br/><f x12FF0000='0'><b>Hero:</b><br/><f x120000FF='0'><b>Chief:</b></f> %s</f> %s<br/><f x12FF00FF='0'><b>Guardian:</b></f>%s" % (", ".join(Champion), ", ".join(Hero), ", ".join(Chief), ", ".join(Guardian)),True)
- ##staff
- if cmd == "staff":
- room.message("<br/><f x120000FF='0'><b>Owner:</b></f> %s<br/><f x12FF0000='0'><b>Admin:</b></f> %s" % (", ".join(Champion), ", ".join(Hero)),True)
- #### Rooms
- elif cmd == "rooms" or cmd == "Rooms":
- j = []
- for i in self.roomnames:
- j.append(i+'[%s]' % str(self.getRoom(i).usercount))
- j.sort()
- room.message("I'm Playing In "+'[%s] rooms: '%(len(self.roomnames))+", ".join(j))
- #### Credits
- elif cmd == "credits" or cmd == "Credits" or cmd == "Creators":
- room.message('<font color="#FFCC00">%s</font>Credits: ||<font color="#DC1620"><b>%s</b></font>[<font color="#ff0000"><b>%s</b></font>] ||<font color="#f033FF">%s</font>[Coding Tutors] ||<font color="#00CC00">%s</font>[Fellow Bot Maker] ||<font color="#CC00FF">%s</font>[Trusted Test Subjects]' % ("||", "alvanCrystallenz"), True)
- #### LoveMeter
- elif cmd == "lovemeter" or cmd == "lm" or cmd == "LoveMeter" or cmd == "Love Meter" or cmd == "Lovem":
- try:
- user2, user3 = args.split(" and ", 1)
- moter = random.randint(6,100)
- try:
- user1 = args.lower()
- if user1 in lomet:
- meter = json.loads(lomet[user1])
- meter = str(meter)
- room.message("I Gaze upon the stars... *Closes my eyes and concentrates*. And again, <b>%s</b> and <b>%s</b>, their love meter is <b>%s</b>%s ,, that is the answer of fate ;)" % (user2, user3, str(meter), "%"), True)
- else:
- moter = str(moter)
- lomet[user1] = json.dumps(moter)
- room.message("I Gaze upon the stars... *Closes my eyes and concentrates*. Gotcha, <b>%s</b> and <b>%s</b>, their love meter is <b>%s</b>%s ,, that is the answer of fate ;)" % (user2, user3, moter, "%"), True)
- except:
- room.message("Fail !!")
- except:
- room.message("Fail !! You must do as the fate desires !")
- #### Tea
- elif cmd == "tea" or cmd == "Tea":
- if not args == "":
- if args in Champion:
- room.message("*Pour heavenly tea to my master's cup*")
- if args == "bot":
- room.message("*Sips my tea*")
- else:
- room.message("*Pour tea to "+sntonick(args)+"'s cup*", True)
- else:
- if user.name in Champion:
- room.message("*Pour heavenly tea to my master's cup*")
- else:
- room.message("*Pour tea to "+sntonick(user.name)+"'s cup*", True)
- ###Google search and Google image search
- if cmd == "gs":
- room.message("Search Google for : ( <f x11FF0000='1'>"+args+" <f x11FFFFFF='1'> ) <br/><br/>"+gs(args),True)
- if cmd == "gis":
- room.message("Search Google image for : ( <f x11FF0000='1'>"+args+" <f x11FFFFFF='1'> ) <br/><br/>"+gis(args),True)
- #### Jones >.<
- elif cmd == "jones" or cmd == "Jones":
- if len(args)>0:
- obv = ["what do you want ?","what do you want?","what do you want","what do you desire ?","what do you desire","what do you desire?","what do you wish for?","what do you wish for ?","what do you wish for"]
- insult = ["fuck you","fook you","damn you","i hate you","kiss my ass"]
- jelas = ["apa maumu ?","apa maumu?","Apa maumu","apa maumu","mau lo apa ?","mau lo apa?","mau lo apa","lu mau apa?","lu mau apa ?","lu mau apa"]
- if args in obv:
- room.message(random.choice(["I want a girlfriend :)","I want you >:)","I need a whore","I want a lover","Your Anus !!","Your tits !","I want your soul >:3","Gimme a gun","Your money :|","Give me your money !!!"]))
- if args in jelas:
- room.message(random.choice(["Tidakkah jelas ? gue mau jablay !","Gue butuh cewek broh","hadehh dia pake nanya,, gue mau cewek"]))
- if args in insult:
- room.message(random.choice(["Well, Fuck you too","oh shit whatever >_>","Stfu and kiss my arse !!"]))
- else:
- if args in obv or args in insult or args in jelas: return
- room.message(random.choice(["yes","no","maybe","not likely","I'm too depressed right now ,try asking again later","It's a secret ;)","Still, i'm not.","True","Better not tell you now.","It is certain.","Certainly :)","I'm not sure >_>","Yes, I'am"]))
- else:
- room.message("This is The Mighty Jones command. You must ask a question for The Mighty Jones to answer...(EXAMPLE: 'jones Am I doing this right o.O ???)")
- #### Profile picture
- if cmd == "pfpic" or cmd == "PfPic" or cmd == "ProfilePic" or cmd == "profilepic":
- link = "http://fp.chatango.com/profileimg/%s/%s/%s/full.jpg" % (args[0], args[1], args)
- room.message(link)
- ##Eval
- if cmd == "ev" or cmd == "eval" or cmd == "e":
- if self.getAccess(user) == 5:
- ret = eval(args)
- if ret == None:
- room.message("Done.")
- return
- room.message(str(ret))
- ##Say
- if cmd == "say":
- room.message(args)
- ##Random User
- if cmd == "randomuser":
- room.message(random.choice(room.usernames))
- ##Check if Mod
- #not really important
- elif cmd == "ismod":
- user = ch.User(args)
- if room.getLevel(user) > 0:
- room.message("yesh")
- else:
- room.message("nope")
- ## Youtube
- elif cmd == "youtube" or cmd == "yt":
- if args:
- room.message(tube(args),True)
- ## Broadcast
- elif cmd=="bc" and self.getAccess(user) > 1:
- r = room.name
- l = "http://ch.besaba.com/mty.htm?"+r+"+"
- for room in self.rooms:
- room.message("[<font color='#6699CC'><b>Broadcast</b></font>] from - "+sntonick(user.name)+ " : <font color='#33FF33'><i>"+args+"<i></font>", True)
- ###### Define
- elif cmd == "define" or cmd == "df" and len(args) > 0:
- try:
- try:
- word, definition = args.split(" as ",1)
- word = word.lower()
- except:
- word = args
- definition = ""
- if len(word.split()) > 5:
- room.message("Fail")
- return
- elif len(definition) > 0:
- if word in dictionary:
- room.message("%s defined already" % user.name.capitalize())
- else:
- dictionary[word] = json.dumps([definition, user.name])
- f =open("definitions.txt", "w")
- for word in dictionary:
- definition, name = json.loads(dictionary[word])
- f.write(json.dumps([word, definition, name])+"\n")
- f.close
- room.message("Definition Saved")
- else:
- if word in dictionary:
- definition, name = json.loads(dictionary[word])
- room.message("<br/>ID : %s<br/>Keyword : %s<br/>Definition:<br/>%s" % (name, word, definition),True)
- else:
- room.message(args+" is not defined")
- except:
- room.message("something wrong")
- ##Rank
- elif cmd == "rank":
- if not args:
- if user.name in Champion and not user.name in Initial:
- room.message(user.name+" Kamu Rank 5 [Champion] ",True)
- elif user.name in Hero and not user.name in Initial and not user.name in champion and not user.name in Chief and not user.name in Guardian:
- room.message(user.name+" Kamu Rank 4 [Hero] ",True)
- elif user.name in Chief and not user.name in Initial and not user.name in Guardian and not user.name in Hero and not user.name in Champion:
- room.message(user.name+" Kamu Rank 3 [Chief] ",True)
- elif user.name in Guardian and not user.name in Initial and not user.name in Champion and not user.name in Hero and not user.name in Chief:
- room.message(user.name+" Kamu Rank 2 [Guardian]",True)
- elif user.name in Initial and not user.name in Champion:
- room.message(user.name+" Kamu Rank 1 [Initial]",True)
- elif user.name not in Initial and not user.name not in Guardian and not user.name in Chief and user.name not in Hero and user.name not in Champion:
- room.message(user.name+" Kamu Belum terdaftar",True)
- ##### Whitelist
- elif cmd == "wl" and self.getAccess(user) >= 1:
- name = args
- if name not in Initial and name not in Champion and name not in Hero and name not in Chief and name not in Guardian and name not in blacklist:
- room.message("Sukses")
- Initial.append(name)
- f = open("Initial.txt","w")
- f.write("\n".join(Initial))
- f.close
- else:
- room.message("User tersebut sudah terdaftar")
- ###blacklist
- elif cmd == "bl" and self.getAccess(user) >= 3:
- name = args
- if name not in Initial and name not in Champion and name not in Hero and name not in Chief and name not in Guardian and name not in Initial:
- room.message("Done")
- blacklist.append(name)
- f = open("blacklist.txt","w")
- f.write("\n".join(blacklist))
- f.close
- else:
- room.message("User tersebut sudah di blacklist")
- ##ubl
- if cmd == "ubl" and self.getAccess(user) >= 3:
- try:
- if args in blacklist:
- blacklist.remove(args)
- f = open("blacklist.txt","w")
- f.write("\n".join(blacklist))
- f.close()
- room.message("Sukses")
- except:
- room.message("Gagal")
- ##uwl
- if cmd == "uwl" and self.getAccess(user) >= 3:
- try:
- if args in Owners:
- Champion.remove(args)
- f = open("Champion.txt","w")
- f.write("\n".join(Champion))
- f.close()
- room.message("Sukses")
- if args in admin:
- admin.remove(args)
- f = open("admin.txt","w")
- f.write("\n".join(admin))
- f.close()
- room.message("Sukses")
- if args in archknight:
- archknight.remove(args)
- f = open("archknight.txt","w")
- f.write("\n".join(archknight))
- f.close()
- room.message("Sukses")
- if args in Initial:
- Initial.remove(args)
- f = open("Initial.txt","w")
- f.write("\n".join(Initial))
- f.close()
- room.message("Sukses")
- except:
- room.message("Gagal")
- ##Dictionary
- if cmd == "mydict":
- arr = []
- for i in dictionary:
- if user.name in dictionary[i]:
- arr.append(i)
- if len(arr) > 0:
- room.message("You have defined <b>"+str(len(arr))+"</b> words in your dictionary :<i> %s"% (', '.join(sorted(arr))), True)
- else:
- room.message("kamu tidak memiliki dictionary.")
- ###Undefine
- if cmd == "udf" and len(args) > 0:
- try:
- word = args
- if word in dictionary:
- definition, name = json.loads(dictionary[word])
- if name == user.name or self.getAccess(user) >= 3:
- del dictionary[word]
- f =open("definitions.txt", "w")
- for word in dictionary:
- definition, name = json.loads(dictionary[word])
- f.write(json.dumps([word, definition, name])+"\n")
- f.close
- room.message(args+" has been removed from Definition database")
- return
- else:
- 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)
- return
- else:
- room.message("<b>%s</b> is not yet defined you can define it by typing <b>define %s: meaning</b>" % args, True)
- except:
- room.message("Gagal")
- return
- ##See dict
- elif cmd == "sdf" or cmd == "seedict":
- if not args:
- room.message("Whose dict do you want to see ?")
- return
- args = args.lower()
- if pars(args) == None:
- args = args.lower()
- if pars(args) != None:
- args = pars(args)
- arr = []
- for i in dictionary:
- if args in dictionary[i]:
- arr.append(i)
- if len(arr) > 0:
- room.message("<b>"+args.title()+"</b> have defined <b>"+str(len(arr))+"</b> words in his dictionary :<i> %s"% (', '.join(sorted(arr))), True)
- else:
- room.message(args.title()+" defined nothing.")
- ##SeeNick
- if cmd == "seenick":
- try:
- if args in nicks:
- room.message(args+" Nick Dia : "+sntonick(args)+"", True)
- else:
- room.message(args+" Belum membuat nick di aku :|")
- except:
- return
- ###Profile
- elif cmd=="prof" or cmd == "profile":
- try:
- args=args.lower()
- stuff=str(urlreq.urlopen("http://"+args+".chatango.com").read().decode("utf-8"))
- crap, age = stuff.split('<span class="profile_text"><strong>Age:</strong></span></td><td><span class="profile_text">', 1)
- age, crap = age.split('<br /></span>', 1)
- crap, gender = stuff.split('<span class="profile_text"><strong>Gender:</strong></span></td><td><span class="profile_text">', 1)
- gender, crap = gender.split(' <br /></span>', 1)
- if gender == 'M':
- gender = 'Male'
- elif gender == 'F':
- gender = 'Female'
- else:
- gender = '?'
- crap, location = stuff.split('<span class="profile_text"><strong>Location:</strong></span></td><td><span class="profile_text">', 1)
- location, crap = location.split(' <br /></span>', 1)
- crap,mini=stuff.split("<span class=\"profile_text\"><!-- google_ad_section_start -->",1)
- mini,crap=mini.split("<!-- google_ad_section_end --></span>",1)
- mini=mini.replace("<img","<!")
- 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>'
- 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
- room.message(prodata,True)
- except:
- room.message(""+args+" doesn't exist o.o ")
- elif cmd=="mini":
- try:
- args=args.lower()
- stuff=str(urlreq.urlopen("http://"+args+".chatango.com").read().decode("utf-8"))
- crap,mini=stuff.split("<span class=\"profile_text\"><!-- google_ad_section_start -->",1)
- mini,crap=mini.split("<!-- google_ad_section_end --></span>",1)
- mini=mini.replace("<img","<!")
- prodata = '<br/>'+mini
- room.message(prodata,True)
- except:
- room.message(""+args+" doesn't exist o.o ")
- ##bg image
- if cmd == "bgimg":
- try:
- args=args.lower()
- 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>'
- prodata = '<br/>'+picture
- room.message("<br/>"+"User ID : "+args+"<br/>Background :"+prodata,True)
- except:
- room.message(""+args+" doesn't exist:'v")
- ### Private Messages
- elif cmd=="pm":
- data = args.split(" ", 1)
- if len(data) > 1:
- name , args = data[0], data[1]
- self.pm.message(ch.User(name), "[Private.Message] By - "+user.name+" : "+args+" ")
- room.message("Sent to "+name+"")
- ### Sentnote
- elif cmd == "inbox":
- if user.name in sn:
- mesg = len(sn[user.name])
- room.message("["+str(mesg)+"] messages in your inbox. To read it, do irn")
- else:
- sn.update({user.name:[]})
- mesg = len(sn[user.name])
- room.message("["+str(mesg)+"] messages in your inbox. To read it, do irn")
- #send notes
- elif cmd == "sn" or cmd == "sendnote":
- args.lower()
- untuk, pesan = args.split(" ", 1)
- if untuk[0] == "+":
- untuk = untuk[1:]
- else:
- if pars(untuk) == None:
- room.message("Who is "+untuk+" ??")
- return
- untuk = pars(untuk)
- if untuk in sn:
- sn[untuk].append([user.name, pesan, time.time()])
- if untuk not in notif:
- notif.append(untuk)
- else:pass
- else:
- sn.update({untuk:[]})
- sn[untuk].append([user.name, pesan, time.time()])
- if untuk not in notif:
- notif.append(untuk)
- else:pass
- room.message('Sent to %s'% (untuk)+"'s inbox" , True)
- #Read Notes
- elif cmd =="rn" or cmd =="readnote":
- if user.name not in sn:
- sn.update({user.name:[]})
- user=user.name.lower()
- if len(sn[user]) > 0:
- messg = sn[user][0]
- dari, pesen, timey = messg
- timey = time.time() - int(timey)
- minute = 60
- hour = minute * 60
- day = hour * 24
- days = int(timey / day)
- hours = int((timey % day) / hour)
- minutes = int((timey % hour) / minute)
- seconds = int(timey % minute)
- string = ""
- if days > 0:
- string += str(days) + " " + (days == 1 and "day" or "days" ) + ", "
- if len(string) > 0 or hours > 0:
- string += str(hours) + " " + (hours == 1 and "hour" or "hours" ) + ", "
- if len(string) > 0 or minutes > 0:
- string += str(minutes) + " " + (minutes == 1 and "minute" or "minutes" ) + ", "
- string += str(seconds) + " " + (seconds == 1 and "second" or "seconds" )
- room.message("[<font color='#6699CC'><b>Private Message</b></font>] from - "+sntonick(dari)+" : "+pesen+" (<font color='#9999FF'>"+string+" ago </font>)", True)
- try:
- del sn[user][0]
- notif.remove(user)
- except:pass
- else:room.message('%s'%(user)+" you don't have any messages in your inbox" , True)
- ###### leave + room
- elif cmd == "leave" and self.getAccess(user) >=1:
- if not args:args=room.name
- self.leaveRoom(args)
- room.message("Baik aku out "+args+" ...")
- print("[SAVE] SAVING Rooms...")
- f = open("rooms.txt", "w")
- f.write("\n".join(self.roomnames))
- f.close()
- ###### join room + roomname
- if cmd == "join" and len(args) > 1:
- if self.getAccess (user) >= 1:
- if args not in self.roomnames:
- room.message("Baik aku join ke "+args+" ...")
- self.joinRoom(args)
- else:
- room.message("aku sudah ada disana ...")
- print("[SAVE] SAVING Rooms...")
- f = open("rooms.txt", "w")
- f.write("\n".join(self.roomnames))
- f.close()
- elif cmd == "userlist":
- if args == "":
- usrs = []
- gay = []
- finale = []
- prop = 0
- prop = prop + len(room._userlist) - 1
- for i in room._userlist:
- i = str(i)
- usrs.append(i)
- while prop >= 0:
- j = usrs[prop].replace("<User: ", "")
- i = j.replace(">", "")
- gay.append(i)
- prop = prop - 1
- for i in gay:
- if i not in finale:
- finale.append(i)
- if len(finale) > 40:
- room.message("<font color='#9999FF'><b>40</b></font> of <b>%s</b> users in this room: %s"% (len(finale), ", ".join(finale[:41])), True)
- if len(finale) <=40 :
- room.message("Current <b>%s</b> users of this room: %s"% (len(finale),", ".join(finale)), True)
- if args != "":
- if args not in self.roomnames:
- room.message("I'm not there.")
- return
- users = getParticipant(str(args))
- if len(users) > 40:
- 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)
- if len(users) <=40:
- room.message("Current <b>%s</b> users in <b>%s</b>: %s"% (len(users), args.title(), ", ".join(users)), True)
- ##### bot rooms
- elif cmd == "rooms" :
- j = []
- for i in self.roomnames:
- j.append(i+'[%s]' % str(self.getRoom(i).usercount))
- j.sort()
- room.message("aku bermain Di "+'[%s] rooms: '%(len(self.roomnames))+", ".join(j))
- ## Mods
- elif cmd == "mods":
- args = args.lower()
- if args == "":
- 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)
- return
- if args in self.roomnames:
- modask = self.getRoom(args).modnames
- owner = self.getRoom(args).ownername
- room.message("<font color='#ffffff'><b>Room</b>: "+args+" <br/><b>Owner</b>: <u>"+ (owner) +"</u> <br/><b>Mods</b>: "+", ".join(modask), True)
- ####nick
- elif cmd == "nick":
- ## if user.name in reg or user.name in friends or user.name in trusted or user.name in Champion:
- if args:
- nick = args
- user = user.name
- nicks[user] = json.dumps(nick)
- room.message(user +' sip sekarang kamu tak panggil '+str(args)+'', True)
- try:
- print("[SAVING] NICKS...")
- f = open("nicks.txt", "w")
- for user in nicks:
- nick = json.loads(nicks[user])
- f.write(json.dumps([user,nick]) + "\n")
- except:
- room.message("Gagal membuat Nick baru..");return
- else:
- room.message('Ketik >nick <spasi> nama yang di inginkan', True)
- ##mynick
- elif cmd == "mynick" :
- user=user.name.lower()
- if user in nicks :
- nick = json.loads(nicks[user])
- room.message(user+" is nicked : "+nick,True)
- else:
- room.message("Belum membuat Nick di saya :D ", True)
- except Exception as e:
- try:
- et, ev, tb = sys.exc_info()
- lineno = tb.tb_lineno
- fn = tb.tb_frame.f_code.co_filename
- room.message("[Expectation Failed] %s Line %i - %s"% (fn, lineno, str(e)))
- return
- except:
- room.message("Undescribeable error detected !!")
- return
- #### MyIp
- if cmd =="myip" or cmd == "MyIp" or cmd == "MyIP" or cmd == "My IP Adress":
- try:
- room.message("Your I.P. address is : "+message.ip)
- except:
- room.message("IP lookup failed , bot is not a mod in this chat.")
- ##Other Crap here, Dont worry about it
- def onFloodWarning(self, room):
- room.reconnect()
- def onJoin(self, room, user):
- print(user.name + " joined the chat!")
- def onLeave(self, room, user):
- print(user.name + " left the chat!")
- def onUserCountChange(self, room):
- print("users: " + str(room.usercount))
- if __name__ == "__main__":
- TestBot.easy_start(rooms, botname, password)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement