Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ########################################################################
- ########################################################################
- #### Posts © Aluf ####
- #### http://D3F4ULTS.chatango.com ####
- #### ####
- _____ .__ _____ ####
- / _ \ | | __ ___/ ____\ ####
- / /_\ \| | | | \ __\ ####
- / | \ |_| | /| | ####
- \____|__ /____/____/ |__| © Aluf-[http://pastebin.com/u/Aluf] ####
- \/ ####
- #### Message me anytime for any doubts .CC's i post might not ####
- #### be working everytime,so message me for fresh cc's . ####
- #### Website : www.pastebing.tk ####
- #### If you need suggestion for the pastebin bots of chatango ####
- #### message me,lol i have run all the bots here myself,so ####
- #### i guess ,i know which is the worst and best . ####
- #### Do not ask for my bot code on pm ,i quit years back . ####
- #### If you have doubts regarding other codes on my pastebin ####
- #### Still message me on D3F4ULTS or 93. [93 FOR COMPLAINS] ####
- #### I Have been getting a lot of messages lately for cc's ####
- #### and the worst part is many want to know to hack cc ####
- #### I cannot help you with that ,you have to find a way yourself ####
- #### but ofc you can always ask for cc's but don't ask me how to ####
- ____ _ _ _____ ####
- / _ \/ \ / \ /\/ / ####
- | / \|| | | | ||| __\ ####
- | |-||| |_/\| \_/|| | ####
- \_/ \|\____/\____/\_/ © PMR [ Add me before messaging ] ####
- ########################################################################
- currentver = ("Ver 1.3.3")
- verinfo = ("<br>This version, <font color='#01DF01'>" + currentver + "</font>, now has an updated level system, nick support, options for non-mod mode. <br> <br> Out-dated command list.")
- rooms = []
- f = open("rooms.txt", "r")
- for name in f.readlines():
- if len(name.strip())>0: rooms.append(name.strip())
- f.close()
- owners = ['aluf', 'oo5']
- dev = ['Aluf']
- botname = ['generates']
- #imports################################
- import ch
- import subprocess
- import re
- import random
- import math
- import json
- from random import randint
- import os.path
- import sys
- import cgi
- import os
- import traceback
- import urllib
- import http.client
- from urllib import parse, request
- from html.parser import HTMLParser
- import datetime
- import socket
- import binascii
- import helperCmd
- import winsound
- import __future__
- import threading
- from xml.etree import cElementTree as ET
- import time
- from datetime import date
- import webbrowser,re,urllib.request
- #urllib supp
- if sys.version_info[0] > 2:
- import urllib.request as urlreq
- else:
- import urllib2 as urlreq
- #Global variables#########################################
- lockdown = False
- desu = False
- blizzard = False
- purge = False
- #Timestart########################################
- starttime = str(datetime.datetime.fromtimestamp(int(time.time())).strftime('%Y-%m-%d %H:%M:%S'))
- #On console Startup#####################################
- print ("Made by Aluf! :D")
- time.sleep(.5)
- print (currentver)
- time.sleep(1)
- print ("Loading important shit...")
- time.sleep(.5)
- #list loading####################################
- #OWNER#
- owners = []
- f = open("owners.txt", "r")
- for name in f.readlines():
- if len(name.strip())>0: owners.append(name.strip())
- f.close()
- #WHITELIST#
- whitelist = []
- f = open("whitelist.txt", "r")
- for name in f.readlines():
- if len(name.strip())>0: whitelist.append(name.strip())
- f.close()
- #BLACKLIST#
- blacklist = []
- f = open("blacklist.txt", "r")
- for name in f.readlines():
- if len(name.strip())>0: blacklist.append(name.strip())
- f.close()
- #SPECIAL#
- special = []
- f = open("special.txt", "r")
- for name in f.readlines():
- if len(name.strip())>0: special.append(name.strip())
- f.close()
- #COMMAND LISTS########################################
- #REGULAR#
- regcmd = []
- f = open("regcmd.txt", "r")
- for name in f.readlines():
- if len(name.strip())>0: regcmd.append(name.strip())
- f.close()
- #REGULAR#
- regcmd2 = []
- f = open("regcmd2.txt", "r")
- for name in f.readlines():
- if len(name.strip())>0: regcmd2.append(name.strip())
- f.close()
- #MODDIE#
- modcmd = []
- f = open("modcmd.txt", "r")
- for name in f.readlines():
- if len(name.strip())>0: modcmd.append(name.strip())
- f.close()
- #OWNER#
- owncmd = []
- f = open("owncmd.txt", "r")
- for name in f.readlines():
- if len(name.strip())>0: owncmd.append(name.strip())
- f.close()
- #DICTIONARY###################################
- 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("Def loading error in %s" % line)
- f.close()
- #NICKS######################################
- nicks = dict()
- f = open("nicks.txt","r")
- for line in f.readlines():
- try:
- if len(line.strip())>0:
- IP, nick = json.loads(line.strip())
- nicks[IP] = json.dumps([IP, nick])
- except:
- print("Def loading error in %s" % line)
- f.close()
- ###################################################
- #Bot Defs##########################################
- class LavenciBot(ch.RoomManager):
- def everything_between(text,begin,end):
- idx1=text.find(begin)
- idx2=text.find(end,idx1)
- return ' '.join(text[idx1+len(begin):idx2].strip().split())
- def onInit(self):
- self.setNameColor("333333")
- self.setFontColor("666666")
- self.setFontFace("0")
- self.setFontSize(9)
- self.enableBg()
- self.enableRecording()
- def getAccess(self, user):
- if user.name in botname: return 0
- if user.name in owners: return 3
- elif user.name in special: return 2
- elif user.name in whitelist: return 1
- else: return 0
- 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;
- def onConnect(self, room):
- print("[+] Connected to "+room.name)
- def sendCmd(self, *args, firstcmd = False):
- if not firstcmd: self.wqueue.put_nowait(bytes(':'.join(args)+"\r\n\x00", "utf-8"))
- else: self.wqueue.put_nowait(bytes(':'.join(args)+"\x00", "utf-8"))
- def onModChange(self, room):
- room.message("Room modlist updated.")
- def onReconnect(self, room):
- print("[+] Reconnected to "+room.name)
- def onDisconnect(self, room):
- print("[+] Disconnected from "+room.name)
- def onJoin(self, room, user):
- print(user.name + " joined the chat!")
- if self.getAccess(user) >= 3:
- if room.name == "animeget1":
- room.message("Hello master <font color='#00FF00'>" + user.name.capitalize() + "</font>. ^~^", True)
- def onLeave(self, room, user):
- print(user.name + user.ip + " left the chat!")
- def getUptime():
- return time.time() - startTime
- def onFloodBan(self, room):
- print("You've been flood banned in" +room.name)
- room.message("Too much spam, locking...")
- lockdown == True
- def onFloodWarning(self, room):
- room.reconnect()
- print("[+] Reconnecting...")
- def onPMMessage(self, pm, user, body):
- print("PM - "+user.name+": "+body)
- pm.message(user, "Not real.")
- def onMessage(self, room, user, message):
- global lockdown
- global shush
- global desu
- global blizzard
- global purge
- if "Botteh" in user.name: return
- print(message.ip, "[{0}] {1}: {2}".format(room.name.capitalize(), user.name.capitalize(), message.body))
- if "ryan" in message.body.lower():
- if "ryan" not in room.usernames:
- self.pm.message(ch.User("005"), "Master, "+user.name.capitalize()+" mentioned you in "+room.name+"")
- if self.user == user: return
- if user.name in blacklist: return
- if lockdown == True:
- if self.getAccess(user) < 3:
- return
- if purge == True:
- if "!anon" in user.name:
- anon = user.name
- room.clearUser(ch.User(anon))
- return
- if desu == True:
- if user.name not in dev:
- if "desu" not in message.body.lower():
- room.delete(message)
- if blizzard == True:
- if user.name not in dev:
- if "*snow*" not in message.body.lower():
- room.delete(message)
- if message.body[0] == "+":
- data = message.body[1:].split(" ", 1)
- if len(data) > 1:
- cmd, args = data[0], data[1]
- else:
- cmd, args = data[0], ""
- #commands######################################
- if cmd.lower() == "ping":
- if self.getAccess(user) >= 2:
- if len(args) >0:
- if ".com" not in message.body:
- room.message("http://www.isitdownrightnow.com/data/"+args+".com.png")
- else:
- room.message("http://www.isitdownrightnow.com/data/"+args+".png")
- if cmd.lower() == "test":
- IP = message.ip
- for IP in nicks:
- IP, nick = json.loads(nicks[IP])
- room.message("" + nick + "", True)
- return
- if cmd.lower() == "anime" and len(args) > 0:
- if args:
- try:
- search = args.replace(" ","_")
- gdata = urlreq.urlopen("http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=site:anilist.co+%s" % "+".join(search))
- xdat = gdata.read().decode()
- x = re.finditer('"unescapedUrl":"(.+?)","url":"', xdat)
- mes = []
- for m in x:
- m = str(m.group(1))
- mes.append(m)
- link = random.choice(mes)
- link = link.replace("https","http")
- room.message('%s' % link)
- except Exception as e:
- print("\n%s\n" % e),time.sleep(1)
- if cmd.lower() == "prof":
- try:
- args=args.lower()
- stuff=str(urlreq.urlopen("http://"+args+".chatango.com").read())
- 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)
- 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 = '<u>http://' + args + '.chatango.com </u><a href="http://chatango.com/fullpix?' + args + '" target="_blank"> Age: '+ age +' Gender: '+ gender +' Location: ' + location + '</a>' + picture
- room.rawMessage(prodata)
- except:
- room.message("There was an error in calculating "+args+"'s profile....are you sure they exist???")
- if (cmd.lower() == "ud") and len(args) > 0:
- try:
- term = args.replace(" ", "+")
- term2 = args
- import urllib.request
- with urllib.request.urlopen("http://www.urbandictionary.com/define.php?term=%s" % term[0:]) as url:
- udict = url.read().decode()
- a = re.finditer('<div class="definition">(.+?)</div>', udict)
- matches = []
- for match in a:
- matches.append(match.group(0))
- room.message("<br><b>defintion of %s:</b><br><br><i>%s</i></font>" % (term2, random.choice(matches)), True)
- except Exception as e:
- room.message("I was unable to find anything for <b>%s</b>" % term2, True)
- if cmd.lower() == "bg":
- if self.getAccess(user) >= 2:
- if len(args) > 0:
- if args == "on":
- room.setBgMode(1)
- room.message("Muh BG~")
- return
- if args == "off":
- room.setBgMode(0)
- room.message("I feel naked now ._.")
- return
- if cmd.lower() == "active":
- if self.getAccess(user) >= 2:
- room.message("I've been active since: " + starttime)
- if cmd.lower() == "gis" and len(args) > 0:
- if self.getAccess(user) >= 1:
- try:
- search = args.replace(" ","_")
- gdata = urlreq.urlopen("http://ajax.googleapis.com/ajax/services/search/images?v=1.0&q=%s" % "+".join(search))
- xdat = gdata.read().decode()
- x = re.finditer('"unescapedUrl":"(.+?)","url":"', xdat)
- mes = []
- for m in x:
- m = str(m.group(1))
- mes.append(m)
- link = random.choice(mes)
- link = link.replace("https","http")
- room.message('%s' % link)
- except Exception as e:
- print("\n%s\n" % e),time.sleep(1)
- if cmd.lower() == "anime" and len(args) > 0:
- if self.getAccess(user) >= 1:
- try:
- search = args.replace(" ","_")
- gdata = urlreq.urlopen("http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=site:anilist.co+%s" % "+".join(search))
- xdat = gdata.read().decode()
- x = re.finditer('"unescapedUrl":"(.+?)","url":"', xdat)
- mes = []
- for m in x:
- m = str(m.group(1))
- mes.append(m)
- link = random.choice(mes)
- link = link.replace("https","http")
- room.message('%s' % link)
- except Exception as e:
- print("\n%s\n" % e),time.sleep(1)
- if cmd.lower() == "linkz" and len(args) > 0:
- if self.getAccess(user) >= 1:
- try:
- search = args.replace(" ","_")
- gdata = urlreq.urlopen("http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=site:anilinkz.com+/series/+%s" % "+".join(search))
- xdat = gdata.read().decode()
- x = re.finditer('"unescapedUrl":"(.+?)","url":"', xdat)
- mes = []
- for m in x:
- m = str(m.group(1))
- mes.append(m)
- link = random.choice(mes)
- link = link.replace("-episode-"," ")
- room.message('%s' % link)
- except Exception as e:
- print("\n%s\n" % e),time.sleep(1)
- if cmd.lower() == "mods":
- time.sleep(1)
- room.message("Owner: <font color='#FF0000'>"+room.ownername+"</font> Mods: <font color='#FF0000'>"+" , ".join(room.modnames), True)
- if cmd.lower() == "dice":
- if self.getAccess(user) >= 1:
- room.message(random.choice(["2","3","4","5","6","7","8","9","10","11","12"]))
- if cmd.lower() == "pm" and len(args) > 0:
- if self.getAccess(user) >= 1:
- name = args.split()[0].lower()
- personalm = " ".join(args.split()[1:])
- self.pm.message(ch.User(name), "Message from "+user.name.capitalize()+" in the room http://"+room.name+".chatango.com : \""+personalm.capitalize()+"\" Go there or pm them to reply.")
- room.message("<font color='#FF0000'>"+user.name.capitalize()+"</font>, I sent a message to <font color='#FF0000'>" +name.capitalize()+ "</font>.", True)
- if cmd.lower() == "rn":
- if self.getAccess(user) >= 1:
- room.message(str(randint(1,1000000)))
- if cmd.lower() == "say":
- if self.getAccess(user) >= 1:
- if args:
- room.delete(message)
- room.message(args, True)
- else:
- room.message("What?")
- if cmd.lower() == "an":
- if self.getAccess(user) >= 3:
- if args:
- for _room in self.rooms:
- _room.message("Announcement from: <font color='#FF0000'>"+user.name.capitalize()+"</font> : "+args, True)
- else:
- room.message("<font color='#FF0000'>Say what now?</font>", True)
- if cmd.lower() == "ghost":
- if user.name == "aluf":
- if args:
- for _room in self.rooms:
- _room.message("" + args, True)
- if cmd.lower() == 'rslap':
- if self.getAccess(user) >= 1:
- (random.choice(room.usernames))
- room.message("Slaps <font color='#01DF01'>"+(random.choice(room.usernames))+"</font> xD.", True)
- if cmd.lower() == "info":
- time.sleep(1)
- room.message("Made by Aluf. <font color='#01DF01'>"+(currentver)+"</font>", True)
- if cmd.lower() == "vinfo":
- room.message(verinfo, True)
- if cmd.lower() == "ml":
- time.sleep(1)
- room.message("http://www.youtube.com/watch?v=s5CP72VutKc&list=FLTs8CmRWgK0437esCkwbmDQ&feature=share")
- if cmd.lower() == "chkmigs":
- if self.getAccess(user) >= 3:
- room.message("Checking...")
- time.sleep(1)
- room.message(random.choice(["None! =]", "6 with ID match.", "1 with ID match.","2 with ID match.", "2 with ID match.","3 with ID match.", "4 with ID match.","5 with ID match.", "7 with ID match."]))
- if cmd.lower() == "cl" or cmd.lower() == "cmds" or cmd.lower() == "cmd":
- time.sleep(1)
- if self.getAccess(user) >= 1:
- room.message("Command Help:<br><br>For regular commands:<font color='#FF0000'>'/regcmd'</font>. <br>For moddie commands:<font color='#FF0000'>'/modcmd'</font>. <br>For Master commands:<font color='#FF0000'>'/mascmd'</font>. <br> Access is limited by level.", True)
- return
- if cmd.lower() == "regcmd":
- if self.getAccess(user) >= 1:
- room.message((str(", ".join(regcmd))), True)
- room.message((str(", ".join(regcmd2))), True)
- if cmd.lower() == "modcmd":
- if self.getAccess(user) >= 2:
- room.message((str(", ".join(modcmd))), True)
- if cmd.lower() == "mascmd":
- if self.getAccess(user) >= 3:
- room.message((str(", ".join(owncmd))), True)
- if cmd.lower() == "help":
- if self.getAccess(user) >= 3:
- room.message("Why would you need help, <font color='#00FF00'>Master?</font> o. o", True)
- else:
- room.message("Commands are case-sensitive. Try '/wlme' for self-whitelisting and '/cl' for commands access. ;)")
- if cmd.lower() == "definehelp":
- if self.getAccess(user) >= 1:
- room.message("Try <br> '/define (word)' to check definition.<br> '/define (word): (definition)' to define a word. <br>'/define (word) remove' to remove a definition.", True)
- if cmd.lower() == "sav":
- if self.getAccess(user) >= 3:
- room.message("Saving...")
- print("Saving values...")
- 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()
- f = open("whitelist.txt", "w")
- f.write("\n".join(whitelist))
- f.close()
- f = open("nicks.txt", "w")
- for IP in nicks:
- IP, nick = json.loads(nicks[IP])
- f.write(json.dumps([IP,nick])+"\n")
- f.close()
- f = open("special.txt", "w")
- f.write("\n".join(special))
- f.close()
- else:
- room.message("Nope ^-^")
- if cmd.lower() == "define" and len(args) > 0:
- if self.getAccess(user) >= 1:
- try:
- word, definition = args.split(":", 1)
- word = word.lower()
- except:
- word = args.split()[0].lower()
- definition = ""
- if len(word.split()) > 1:
- room.message("The hell am i supposed to define it as? :|")
- return
- if len(args.split()) > 1 and args.lower().split()[1] == "remove":
- if self.getAccess(user) >= 2:
- if word in dictionary:
- definition, name = json.loads(dictionary[word])
- if name in owners:
- del dictionary[word]
- room.message("removed")
- return
- else:
- return
- else:
- room.message("<font color='#00FF00'>%s</font> is not defined." % args, True)
- elif len(definition) > 0:
- if word in dictionary:
- room.message("<b>%s</b>, that's is already defined. You may not define it again." % user.name, True)
- else:
- room.delete(message)
- dictionary[word] = json.dumps([definition, user.name])
- room.message(word + ": " + definition + " by " + user.name)
- else:
- if word in dictionary:
- definition, name = json.loads(dictionary[word])
- room.message(word + ": " + definition + " - " + name)
- else:
- room.message("<font color='#00FF00'><b>%s</b></font> is not defined yet." % args, True)
- if cmd.lower() == "nickr":
- if self.getAccess(user) >= 2:
- if username in nicks:
- nick = args
- username = user.name
- username, nick = json.loads(nicks[username])
- del nicks[username]
- room.message("removed")
- return
- else:
- room.message("I can't find you.")
- return
- if cmd.lower() == "nick":
- if self.getAccess(user) >= 1:
- nick = args
- username = user.name
- if len(args) == 0:
- if username in nicks:
- username, nick = json.loads(nicks[username])
- room.message("Your nickname is " + nick + ".", True)
- return
- else:
- room.message("Use /nick 'nickname' to set a nick. You may use HTML tags in your name. NICKS MAY NOT BE CHANGED. CHOOSE WISELY.")
- return
- else:
- if username in nicks:
- username, nick = json.loads(nicks[username])
- room.message("You already have a nickname, " + nick + ".", True)
- return
- else:
- nicks[username, nick] = json.dumps([username, nick])
- room.message(user.name + " set nick as " + nick, True)
- f = open("nicks.txt", "w")
- for IP in nicks:
- IP, nick = json.loads(nicks[IP])
- f.write(json.dumps([IP,nick])+"\n")
- f.close()
- return
- else:
- return
- if cmd.lower() == "addmod":
- if len(args) > 0:
- if self.name in room.ownername:
- if args in room.modnames:
- room.message("<font color='#00FF00'>%s</font> is already a moderator in this room." % args, True)
- if self.getAccess(user) == 2.5:
- room.addMod(ch.User(args))
- room.message("<font color='#00FF00'>%s</font> has been promoted to a room moderator!" % args, True)
- else:
- room.message("Denied.")
- else:
- room.message("This is not my chat, sorry! D:")
- else:
- room.message("Who am i supposed to mod? :|")
- if cmd.lower() == "fpix" and len (args) > 0:
- if self.getAccess(user) >= 1:
- name=args
- room.message("http://fp.chatango.com/profileimg/"+name[:1]+"/"+name[1:2]+"/"+name+"/full.jpg")
- if cmd.lower() == "fullpix" and len (args) > 0:
- if self.getAccess(user) >= 1:
- name=args
- room.message("http://bingo.sorch.info/picture/" + name + ".jpg")
- if cmd.lower() == "invite":
- if self.getAccess(user) >= 2:
- if len(args) > 0:
- self.pm.message(ch.User(args), "%s wants you to join me in a chatroom! www.%s.chatango.com" % (owners[0], room.name))
- room.message("I invited %s to the room." % args)
- else:
- room.message('You need to enter a username.')
- if cmd.lower() == "tracker" and self.getAccess(user) >= 1:
- try:
- if len(args) == 0:
- f = urlreq.urlopen("http://chtracker.info/index.py?output=html&x=page&y={}&results=0".format(user.name))
- data = json.loads(f.readall().decode("utf-8"))
- viewers = [(item['viewer'], item2['timestamp']) for item, item2 in data]
- room.message("The last 10 people who visited your profile: %s %s ago".format(item, stamp.getTimeStamp(item2)))
- except:
- room.message((str(sys.exc_info()[1])))
- if cmd.lower() == "sn" and len(args) > 0:
- try:
- to, body = args.split(" ", 1)
- sender = user.name
- if args:
- sasaran[to] = json.dumps([body, sender])
- room.message("sent")
- notif.append(to)
- else: room.message(to+" is not a whitelisted user")
- #if user.name : room.message( kamu dapat sn dari .... silahkan gunakan cmd 'sn read ) kek gitu aja
- except: room.message("Fail !!")
- if cmd.lower() == "rn":
- try:
- if user.name in sasaran:
- body, sender = json.loads(sasaran[user.name])
- room.message(user.name+", you got a note from "+sender+" ---> "+body)
- del sasaran[user.name]
- notif.remove(to)
- except: return
- if cmd.lower() == "shutdown":
- if user.name.lower() == '005':
- room.message("Bye bye :]")
- self.stop()
- else:
- room.message("<font color='#FF0000'>Denied.</font>", True)
- elif cmd.lower() == "ban":
- if self.user.name in room.modnames:
- if self.getAccess(user) >= 2:
- if len(args) > 0:
- if self.getAccess(user) >= 2:
- if args in botname:
- room.message("Why the hell would i ban myself? ._.")
- return
- if args.lower() == user.name:
- room.message("Banning yourself...not a wise move.")
- return
- if user.name in owners:
- room.banUser(ch.User(args))
- room.clearUser(ch.User(args))
- room.message("<font color='#F7FE2E'>%s</font> has been <font color='#FF0000'>BANNED</font> by Master. You done fucked up." % args, True)
- return
- if args in owners or args in special:
- room.message("<font color='#FF0000'>%s</font> is unbannable through me. ^^" % args.capitalize(), True)
- return
- else:
- if args in room.usernames:
- room.clearUser(ch.User(args))
- room.banUser(ch.User(args))
- room.message("<font color='#F7FE2E'>%s</font> has been <font color='#FF0000'>BANNED</font> >:D!" % args, True)
- else:
- room.message("I can't find the bastard! D:<")
- else:
- room.message("<font color='#FF0000'>Denied.</font>", True)
- else:
- room.message('Ban who?')
- else:
- room.message("I've no power in this realm...")
- if cmd.lower() == "unban":
- if self.user.name in room.modnames:
- if self.getAccess(user) >= 2:
- if len(args) > 0:
- if self.getAccess(user) >= 2:
- room.unban(ch.User(args))
- room.message("<font color='#F7FE2E'>%s</font> has been <font color='#00FF00'>unbanned</font> ^~^" % args, True)
- else:
- room.message("<font color='#FF0000'>Denied.</font>", True)
- return
- else:
- room.message('Who?')
- else:
- room.message("I've no power in this realm...")
- if (cmd.lower() == "goto" or cmd.lower() == "join") and len(args) > 0:
- if self.getAccess(user) >= 2:
- if len(args) > 0:
- if args not in rooms:
- self.joinRoom(args)
- rooms.append(args)
- f = open("rooms.txt", "w")
- f.write("\n".join(rooms))
- f.close()
- room.message("Added.")
- return
- else:
- room.message("Already there ^~^")
- return
- else:
- room.message("You room name to join~")
- if cmd.lower() == "leave" and len(args) > 0:
- if self.getAccess(user) >= 2:
- time.sleep(1)
- if len(args) > 0:
- if args in rooms:
- self.leaveRoom(args)
- rooms.remove(args)
- f = open("rooms.txt", "w")
- f.write("\n".join(rooms))
- f.close()
- room.message("Okay :<")
- else:
- room.message("I'm not there ._.")
- else:
- room.message("You room name to leave~")
- if cmd.lower() == "lock":
- if self.getAccess(user) >= 3:
- lockdown = True
- print("#####LOCKING")
- room.message("Bye for now~ *waves*")
- return
- else:
- room.message("<font color='#FF0000'>Denied.</font>", True)
- if cmd.lower() == "unlock":
- if self.getAccess(user) >= 3:
- lockdown = False
- room.message("I'm Baaack~")
- print("#####UNLOCKING")
- return
- if cmd.lower() == "locate" and len(args) > 0:
- if self.getAccess(user) >= 1:
- name = args.split()[0].lower()
- if not ch.User(name).roomnames: room.message("I'm not seeing them in any of my rooms...")
- else: room.message("<font color='#FF0000'>%s</font>, they are in <font color='#666666'>%s</font>" % (user.name.capitalize(), ", ".join(ch.User(name).roomnames)), True)
- else:
- room.message("No can do~")
- if cmd.lower() == "hug":
- if self.getAccess(user) >= 1:
- time.sleep(1)
- if not len(args) == 0:
- if args in dev or args in sara:
- room.message("*Snuggles <font color='#01DF01'>Master</font>* ^_^", True)
- return
- if args in botname:
- room.message("*hugs self*")
- return
- if args in whitelist or args in special:
- room.message("*Hugs <font color='#01DF01'>%s</font> tightly* :3" % args, True)
- return
- if args in baron:
- room.message("No hugs for Baron. :|")
- return
- if args.lower() == "chat":
- room.message("<font color='#01DF01'>G</font><font color='#FF0000'>R</font><font color='#FF00BF'>O</font><font color='#FBFBEF'>U</font><font color='#FFFF00'>P</font> HUG! >:D", True)
- return
- else:
- room.message("*Gives <font color='#01DF01'>%s</font> a hug*" % args, True)
- else:
- room.message("Lets snuggle.")
- if cmd.lower() == "dhug":
- if self.getAccess(user) >= 1:
- if not len(args) == 0:
- if args in dev or args in sara:
- room.message("*master snuggles self*")
- return
- if args in botname:
- room.message("*<font color='#01DF01'>" + user.name.capitalize() +"</font> hugs <font color='#01DF01'>Lavenci</font>*", True)
- return
- if args in whitelist or args in special:
- room.message("*<font color='#01DF01'>" + user.name.capitalize() + "</font> Hugs <font color='#01DF01'>%s</font> ." % args, True)
- return
- else:
- room.message("*<font color='#01DF01'>" + user.name.capitalize() + "</font> gives a hug to <font color='#01DF01'>%s</font> *" % args, True)
- else:
- room.message("Lets snuggle.")
- if cmd.lower() == "flip":
- if self.getAccess(user) >= 1:
- if len(args) > 0:
- (str(randint(1,2)))
- if args == (str(randint(1,2))):
- room.message("YOU GOT IT! >:D")
- return
- else:
- room.message("You lost! D:")
- return
- else:
- room.message("You need to guess a number (1 or 2), that's how this works...")
- if cmd.lower() == "wl":
- if self.getAccess(user) >= 2:
- time.sleep(1)
- if len(args) > 0:
- if args in room.usernames:
- if "anon" in args:
- room.message("Anons are unable to be whitelisted.")
- return
- else:
- if args not in whitelist:
- whitelist.append(args)
- rooms.append(args)
- f = open("whitelist.txt", "w")
- f.write("\n".join(whitelist))
- f.close()
- room.message("Added.")
- else:
- room.message("Already added.")
- else:
- room.message("I can't find them D:")
- else:
- room.message("You need a name to whitelist.")
- if cmd.lower() == "bmod":
- if self.getAccess(user) >= 3:
- time.sleep(1)
- if len(args) > 0:
- if "anon" in args:
- room.message("Anons are unable to be spec'd.")
- return
- else:
- if args not in special:
- special.append(args)
- f = open("special.txt", "w")
- f.write("\n".join(special))
- f.close()
- room.message("Added.")
- else:
- room.message("Already added.")
- else:
- room.message("You need a name to spec.")
- if cmd.lower() =="bgtime" and len(args) > 0:
- args=args.lower()
- if len(args.split(" ", -1)) != 1:
- return
- if len(args) == 1:
- f_args, s_args = args, args
- elif len(args) > 1:
- f_args, s_args = args[0], args[1]
- def getBgtime(args):
- expired = True
- url = ("http://st.chatango.com/profileimg/" + f_args + "/" + s_args + "/" + args + "/mod1.xml")
- f = urlreq.urlopen(url)
- data = f.read().decode("utf-8")
- e = ET.XML(data)
- bg = e.findtext("d")
- bg = int(urlreq.unquote(bg))
- if bg - int(time.time()) < 0:
- total_seconds = int(time.time())-bg
- else:
- total_seconds = bg-int(time.time())
- expired = False
- # 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 or 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" )
- if expired == True:
- return "expired: "+string
- elif expired == False:
- return "time is: "+string
- room.message("<font face=\"arial\" size=\"11\"><b>" + args.title() + "</b> BG " + getBgtime(args), True)
- if cmd.lower() =="userlist":
- room.message("The names of the people here are : "+str(room.usernames))
- if cmd.lower() == "bmodr":
- if self.getAccess(user) >= 3:
- time.sleep(1)
- if len(args) > 0:
- if args in special:
- special.remove(args)
- f = open("special.txt", "w")
- f.write("\n".join(special))
- f.close()
- room.message("Removed.")
- else:
- room.message("Who now?")
- return
- else:
- room.message("You need a name to remove.")
- if cmd.lower() == "bmodlist":
- if self.getAccess(user) >= 2:
- room.message(str(special))
- if cmd.lower() == "wlr":
- if self.getAccess(user) >= 2:
- time.sleep(1)
- if len(args) > 0:
- if args in whitelist:
- whitelist.remove(args)
- f = open("whitelist.txt", "w")
- f.write("\n".join(whitelist))
- f.close()
- room.message("Removed.")
- else:
- room.message("Who now?")
- return
- else:
- room.message("You need a name to remove.")
- if cmd.lower() == "banlist":
- if self.user.name in room.modnames:
- if self.getAccess(user) >= 2:
- room.message("Naughty people: " + (str(", ".join(room.banlist))))
- if cmd.lower() == "wll":
- if self.getAccess(user) >= 2:
- time.sleep(1)
- room.message(str(", ".join(whitelist)))
- if cmd.lower() == "bl":
- if self.getAccess(user) >= 3:
- time.sleep(1)
- if len(args) > 0:
- if "!anon" in args:
- room.message("Anons are unable to be blacklisted.")
- return
- else:
- if args not in blacklist:
- blacklist.append(args)
- f = open("blacklist.txt", "w")
- f.write("\n".join(blacklist))
- f.close()
- room.message("*tosses <font color='#FF0000'>" +(args)+ "</font> in a hole for eternity*", True)
- else:
- room.message("They're already dead to me ._.")
- else:
- room.message("You need a name to blacklist.")
- if cmd.lower() == "blr" and len(args) >0:
- if self.getAccess(user) >= 3:
- time.sleep(1)
- if len(args) > 0:
- if args in blacklist:
- blacklist.remove(args)
- f = open("blacklist.txt", "w")
- f.write("\n".join(blacklist))
- f.close()
- room.message("Removed, they better behave...")
- else:
- room.message("Who now?")
- return
- else:
- room.message("You need a name to blacklist.")
- if cmd.lower() == "bll":
- time.sleep(1)
- if self.getAccess(user) >= 2:
- room.message(str(", ".join(blacklist)))
- if cmd.lower() == "rr":
- time.sleep(1)
- if self.getAccess(user) >= 1:
- room.message("Shoots at " + (random.choice(room.usernames))+ " with " + (random.choice(["a rocket launcher", "a magnum", "a kitten", "an elbow", "a phone", "a boomerang", "a whip", "a guitar", "an SKS", "a car", "some bananas", "The Internet", "a Coke bottle", "a sword", "a mace", "Lavenci", "a Gameboy", "the Truth", "a television", "the sound of music", "a snowboard", "a pokeball", "some chewed gum", "a train", "a club", "an egg", "mean words", "a spaceship", "an elephant", "their keychain", "a book"]))+ (random.choice([" for a critical hit!", ", but it doesn't do much.", ", and it's super effective!", ", and they die instantly.", " and hits " + (random.choice(room.usernames)) + " for a double kill!", ", but misses.", ", Good one!"])))
- else:
- room.message("Nope. ^~^")
- if cmd == "yt" or cmd == "ytb":
- try:
- word = args\
- .replace(" ", "+")
- ydata = urlreq.urlopen('http://gdata.youtube.com/feeds/api/videos?q=' + word)
- tree = ET.parse(ydata)
- youentry = tree.findall('{http://www.w3.org/2005/Atom}entry')
- youtitle = youentry[0].findtext('{http://www.w3.org/2005/Atom}title')
- youvar99 = youentry[0].findall('{http://www.w3.org/2005/Atom}link')
- if youvar99[0].get('rel') == 'alternate':
- youvid = youvar99[0].get('href')
- youvar98 = youentry[0].findall('{http://www.w3.org/2005/Atom}author')
- youname = youvar98[0].findtext('{http://www.w3.org/2005/Atom}name')
- room.message("<font color='#01DF01'>%s</font>, I found - "% user.name.capitalize() + youtitle + " by <font color='#01DF01'>" + youname + "</font> " + youvid, True)
- else:
- room.message("This never displays :| Don't worry")
- except:
- room.message("Something went wrong! D:")
- if cmd.lower() == "wlme":
- time.sleep(1)
- if "anon" in user.name.lower():
- room.message("Please log in to whitelist.")
- return
- if user.name not in whitelist:
- whitelist.append(user.name)
- f = open("whitelist.txt", "w")
- f.write("\n".join(whitelist))
- f.close()
- room.message("Added.")
- else:
- room.message("Already added.")
- return
- if cmd.lower() == "slap":
- time.sleep(1)
- if self.getAccess(user) >= 1:
- if not len(args) == 0:
- if args in owners:
- room.message("*Slaps Master*")
- return
- if args in special:
- room.message("*pats %ss cheek*" % args)
- return
- if args in botname:
- room.message("*holds out butt* >///<")
- return
- else:
- room.message("*slaps %s*" % args)
- else:
- room.message("Who do I slap? O.o")
- #Seeded commands###################
- if message.body.lower() == "Generates":
- time.sleep(1)
- if self.getAccess(user) >= 3:
- lockdown = False
- room.message(random.choice(["Yush,<font color='#01DF01'> Master</font>?", "Yes, <font color='#01DF01'>Master</font>?", "What can i do for you, <font color='#01DF01'>Master</font>?", "<font color='#01DF01'>Master</font>?"]), True)
- else:
- room.message(random.choice(["Yush, <font color='#01DF01'>" + user.name.capitalize() + "</font>?", "What is it?", "Need something <font color='#01DF01'>" + user.name.capitalize() + "</font>?", "I could be busy, you know."]), True)
- return
- if message.body ==("hi") or message.body.lower() ==("hi."):
- time.sleep(1)
- if self.getAccess(user) >= 3:
- room.message("Hello " +user.name)
- return
- else:
- room.message("Hi")
- return
- if message.body ==("HI") or message.body ==("HI.") or message.body ==("HI!"):
- time.sleep(1)
- if self.getAccess(user) >= 3:
- room.message("HELLO, MASTER!")
- else:
- room.message("HI")
- if message.body =="FUCK":
- if self.getAccess(user) >= 3:
- room.message("Me~")
- if message.body.lower() =="good morning" or message.body.lower() =="good morning." or message.body.lower() =="good morning!":
- time.sleep(1)
- if self.getAccess(user) >= 3:
- room.message("Good morning, Master.")
- else:
- room.message("Good morning %s." % user.name.capitalize())
- #super secret numznumz :3####################################
- if __name__ == "__main__":
- error = 0
- try:
- LavenciBot.easy_start(rooms, "b0t", "prxxx")
- except KeyboardInterrupt:
- print("[ERROR] Keyboard-initiated kill.")
- except Exception as e:
- print("[ERROR] Fatal error.")
- error = 1
- #Error specification#######################################
- if error == 1:
- print("Encountered error, bumping for 10 seconds...")
- time.sleep(10)
- print("Somethingsomething...")
- pass
Add Comment
Please, Sign In to add comment