Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ############################################################################
- ############################################################################
- #### Getting Started Bot ############
- #### File = ThGk.py ############
- #### Originaly by = Clonerxyz ############
- #### Edited by = Thelorgorenk ############
- #### you can PM for info about making a chatango ############
- #### bot in http://thelorgorenk.chatango.com, and you can ############
- #### and you can also chat in : ############
- #### http://khususme.chatango.com ############
- #### Last update: ############
- #### 1.40 PM 9 September, 13 2015 by Thelorgorenk ############
- ############################################################################
- ############################################################################
- import ch
- import subprocess
- import re
- import random
- import math
- import json
- from random import randint
- import os.path
- import sys
- import cgi
- import urllib.request
- 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 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
- if sys.version_info[0] > 2:
- import urllib.request as urlreq
- else:
- import urllib2 as urlreq
- from time import localtime, strftime
- wordtodaytime = dict()
- ## Love Meter Logs
- lomet = dict()
- f = open("lovelog.txt", "r")
- for line in f.readlines():
- try:
- if len(line.strip())>0:
- user1, meter = json.loads(line.strip())
- lomet[user1] = json.dumps(meter)
- except:
- print("fails")
- f.close()
- ## Send Notes
- sasaran = dict()
- f = open ("notes.txt", "r") #read-only
- print("[INF] Loading Notes")
- time.sleep(1)
- 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")
- print("[INF]Loading Notifs...")
- for name in f.readlines():
- if len(name.strip())>0: notif.append(name.strip())
- f.close
- ## Last Seen History
- filename = "roomhist.txt"#the text file you need to have in same place as bot
- hist = dict()
- f = open(filename, 'r') #open status.txt and make a writing variable called file
- print("[INF]LOADING ROOMHIST")#print to console
- time.sleep(1)#pause for one second
- for line in f.readlines():
- if len(line.strip())>0:
- nama, waktu, ruang, body = json.loads(line.strip())
- hist[nama] = json.dumps([waktu, ruang, body])
- f.close()#close the file
- ## ROOMLOG
- filename = "roomlog.txt"#the text file you need to have in same place as bot
- roomlog =[]
- f = open(filename, 'r') #open status.txt and make a writing variable called file
- print("[INFO]LOADING ROOMLOG")#print to console
- time.sleep(1)#pause for one second
- for name in f.readlines():
- if len(name.strip())>0: roomlog.append(name.strip())
- f.close()#close the file
- #Nicknames
- nicks=dict()#empty list
- f=open ("nicks.txt","r")#r=read w=right
- print ("[INF]Loading Nicks...")#print
- time.sleep(1)
- for line in f.readlines():#loop through eachline 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)
- ## definitions
- dictionary = dict() #volatile..
- f = open("definitions.txt", 'r') #read-only
- print("[INF]Loading Definitions...")
- time.sleep(1)
- for line in f.readlines():
- try:
- if len(line.strip())>0:
- word, definitions, name = json.loads(line.strip())
- dictionary[word] = json.dumps([definitions, name])
- except:
- print("{ERROR]Cant load Definitions: %s" % line)
- f.close()
- ## Locks##
- locks = []
- f = open("locks.txt", 'r')
- time.sleep(1)
- for name in f.readlines():
- if len(name.strip())>0: locks.append(name.strip())
- f.close()
- ##Rooms.. Buat newfile judulnya rooms trs text file faiq..##
- rooms = []
- f = open("rooms.txt", "r") #read-only
- print("[INF]Loading Rooms...")
- time.sleep(1)
- for name in f.readlines():
- if len(name.strip())>0: rooms.append(name.strip())
- f.close()
- ##End!!##
- ##whitelist..##
- whitelist = []
- f = open("whitelist.txt", "r") #read-only
- print("[INF]Loading Players...")
- time.sleep(1)
- for name in f.readlines():
- if len(name.strip())>0: whitelist.append(name.strip())
- f.close()
- ##End!!##
- dancemoves = [
- "(>^.^)>",
- "(v^.^)v",
- ]
- song = [
- "Dirimu, dirimulah! Orang yang beriku senyum ini",
- "Jika kita bisa membuat air mata yang bersinar, itu 'kan 'jadi bintang jatuh",
- "Tanganmu t'lah terluka, tapi jangan pernah lepaskannya lagi",
- "Dari langit yang terpenuhi keinginan, hari esok 'kan segera datang",
- "Cahya yang membimbingku adalah dirimu",
- "Dan aku pun ditarik karenanya",
- "Sebelum kusadarim kita mulai sebrangi jalan itu",
- "Sekaranglah saatnya! Jikalau kita hanya bisa bersinar di sini",
- ]
- bete = [
- "kunci",
- ]
- pagi = [
- "ohayou oni-chan",
- ]
- info = [
- "======================= sekedar info aja ya master gue si clonerxyz ol nya >senin s/d sabtu< jam >7 s/d 17< :) kalo mau liat tutor ke >> mumucontent.blogspot.com/2015/07/make-bot-chat-chatango.html jangan merasa paling jago, di sini kita sama2 belajar :v kalo ada member baru yang pengen belajar, tolong member yang on di bantu, terutama buat si thelorgorenk shamanthebeater :v ===========================",
- ]
- # implied command?
- # call bot name with command after
- # call bot name with command after
- def get_cpu_load():
- """ Returns a list CPU Loads"""
- result = []
- cmd = "WMIC CPU GET LoadPercentage "
- response = os.popen(cmd + ' 2>&1','r').read().strip().split("\r\n")
- for load in response[1:]:
- result.append(int(load))
- return result
- #Setting Pretty Colors
- def saveNicks():
- print("[SAVE] SAVING NICKS...")
- f = open("Nicks.txt", "w")
- for user in nicks:
- nick = json.loads(nicks[user])
- f.write(json.dumps([user, nick])+"\n")
- f.close()
- def sntonick(username):
- user = username.lower()
- if user in nicks:
- nick = json.loads(nicks[user])
- return nick
- else:
- return user.capitalize()
- def detik():
- rawdata = urllib.request.urlopen("http://detik.com").read().decode()
- data = re.findall('<a href="(.*?)" data-category="(.*?)" data-action="(.*?)" data-label="Artikel" ><h2>(.*?)</h2></a>', rawdata)
- newset = list()
- val = 1
- for artikel in data:
- link, title = artikel [0], artikel [3]
- newset.append("[%s] %s - %s" % (val, link , title))
- val += 1
- return "<br/>".join(newset[0:5])
- #Font setting for your bot
- def tube(args):
- try:
- 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 "<f x1233FF33='1'>Ha<f x1200F='1'>sil:<f x12F00='1'> %s <br/><br/><br/><br/><br/><br/><br/><br/><font color='#ffcc00'><b>%s</b></font><br/><font color='#ff0000'><b>Yang ngeupload</b></font>:<b> %s</b><br/><font color='#ff0000'><b>Di publikasikan pada</b></font>: %s<br/><font color='#ff0000'><b>Rincian</b></font>:<i> %s ...</i><br/> " % (link, title, uploader, count, descript[:200])
- except Exception as e:
- return str(e)
- ##Set Color for your Bot##
- class TestBot(ch.RoomManager):
- def onInit(self):
- self.setNameColor("F9F")
- self.setFontColor("F33")
- self.setFontFace("1")
- self.setFontSize(14)
- self.enableBg()
- self.enableRecording()
- ##### Pars Def
- def pars(args):
- args=args.lower()
- userlist = roomUsers()
- for name in userlist:
- if args in name:return name
- ##Connecting Crap
- #This is what will be printed on your python console when event called
- def onConnect(self, room):
- print("Connected")
- def onReconnect(self, room):
- print("Reconnected")
- def onDisconnect(self, room):
- print("Disconnected")
- def onUserCountChange(self, room):
- print(room.name+"USER yang lagi ON >>" + str(room.usercount))
- def onLeave(self, room, user):
- print("[+] "+user.name+" yah dia pergi T_T "+room.name)
- if room.usercount >= 20:
- return
- room.message(user.name+" dia pergi ")
- def onFloodWarning(self, room):
- room.reconnect()
- room.setSilent(True)
- self.setTimeout(15, room.setSilent, False)
- self.setTimeout(16, room.message, "I'm back.")
- print("[+] Reconnecting...")
- def onMessageDelete(self, room, user, msg):
- print("MESSAGE DELETED: " + user.name + ": " + msg.body)
- def rpg():
- class Hero:
- def __init__(self, name):
- self.name = name
- self.level = 1
- self.job = "Priest"
- self.title = "Strider of the East"
- if self.job == "Cleric":
- self.critical = 125
- self.str = 50
- self.exp = 254
- self.max1 = 3154
- max2 = self.level*self.max1*2/3
- self.maxHp = int(max2)
- if self.job == "Priest":
- self.critical = 95
- self.str = 20
- self.exp = 254
- self.max1 = 4478
- max2 = self.level*self.max1*2/3
- self.maxHp = int(max2)
- self.health = self.maxHp
- def expGauge(self):
- rexp1 = 3500
- rexp2 = self.level*rexp1*2/3
- gauge1 = self.exp/rexp2
- gauge2 = float(gauge1)*100.00
- self.gauge = int(gauge2)
- def lvl(self):
- rexp1 = 3500
- rexp2 = self.level*rexp1*2/3
- if self.exp >= rexp2:
- self.level = self.level+1
- self.exp = self.exp - rexp2
- max2 = self.level*self.max1*2/3
- self.maxHp = int(max2)
- print("You just leveled up !! Congratulations %s"% self.name)
- else:
- pass
- def heal(self):
- if self.health < self.maxHp:
- if self.job == "Cleric":
- heal1 = 200
- heal2 = self.level*heal1*2
- hell = heal2/3
- heal3 = int(hell)
- heal4 = random.randint(heal3,heal2)
- self.health += heal4
- if self.job == "Priest":
- heal1 = 300
- heal2 = self.level*heal1*2
- hell = heal2/3
- heal3 = int(hell)
- heal4 = random.randint(heal3,heal2)
- self.health += heal4
- if self.health > self.maxHp:
- self.health = self.maxHp
- print ("hp full")
- else:
- print ("hp full")
- def attack(self):
- atta = player.level*player.str
- atte = atta + (self.critical*self.level)
- atti = atte + atta * 2 / 3
- self.dmg = random.randint(atta,int(atti))
- momon.health -= self.dmg
- class Enemy:
- def __init__(self, name):
- self.name = "Zombie"
- self.health = 5000
- self.critical = 35
- self._tasks = set()
- def attack(self):
- self.dmg = random.randint(300,500)
- dmg = self.dmg
- miss = "Zombie attacks but misses"
- atks = ("Zombie attacks and dealt %s damage !!"% dmg)
- chose = random.choice([miss,miss,miss,atks,miss,atks,miss])
- if chose == miss:
- pass
- if chose == atks:
- print(atks)
- player.health -= dmg
- global war
- war = False
- momon = Enemy("Zombie")
- heroname = str(input("Please enter your name: "))
- player = heroname
- if heroname == player:
- player = Hero(heroname)
- print ("Welcome to another world %s !!" %heroname)
- opt = ["help","rest","job 1","job 2","hunt","atk","heal","status"]
- while True:
- choice = str(input("-->"))
- if not choice in opt:
- print("Fail command !")
- player.expGauge()
- if war == True:
- momon.attack()
- if choice == "atk":
- if player.health <= 0:
- player.health = 0
- if player.health and momon.health > 0:
- player.attack()
- if momon.health <= 0 and not player.health <= 0:
- momon.health = 0
- print("You won !!!")
- war = False
- if player.health <= 0:
- player.health = 0
- print("You are dead")
- war = False
- if war == True:
- randex1 = 50
- randex2 = 200
- randex = random.randint(randex1,randex2)
- player.lvl()
- player.exp = player.exp+randex
- php = str(player.health)
- mhp = str(momon.health)
- print("%s's ~Hp: %s ~Damage: %s | %s's ~Hp: %s"% (player.name,php,player.dmg,momon.name,mhp))
- if choice == "heal":
- player.heal()
- php = str(player.health)
- mhp = str(momon.health)
- if player.health < player.maxHp:
- print("%s's HP: %s | %s ~hp: %s"% (player.name,php,momon.name,mhp))
- else:
- pass
- else:
- momon.health = 5000
- if choice == "status":
- apus = ("%s's status :\n~Hp : %s\n~Level : %s\n~Job : %s\n~Title : %s\n~Exp : %i%s"% (player.name,player.health,player.level,player.job,player.title,player.gauge,str("%")))
- print (str(apus))
- if choice == "help":
- print("Here are available commands for you honey: help, rest, job 1, job 2, hunt, atk, heal")
- if choice == "rest":
- player.health = int(player.maxHp)
- print("%s rests under a big cherry tree and recovers from all his wounds"% player.name)
- if choice == "atk":
- print("%s started a fight with a thug and got trashed"% player.name)
- if choice == "job 1":
- player.job = "Priest"
- print("You switched your Job and becomes a holy Priest")
- if choice == "job 2":
- player.job = "Cleric"
- print("You switched your Job and becomes a Mighty Cleric")
- if choice == "hunt":
- print("You approaches a Zombie and initiates a battle !!")
- war = True
- ##### Pars Def
- def pars(args):
- args=args.lower()
- userlist = roomUsers()
- for name in userlist:
- if args in name:return name
- ##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):
- #### Comenzi fara prefix
- if "/wl me" == message.body:
- if user.name not in whitelist:
- whitelist.append(user.name)
- room.message(user.name+" can use me now. ^^")
- else: room.message("You're silly >_>")
- if message.body.startswith("test"):
- room.message("Apaan sih, test test :P")
- if message.body.startswith("hitung"):
- hasil = ai.hitung(message.body)
- if hasil:
- room.message(hasil)
- else:
- room.message("belom di ajarin kalo ngitung itu :v " +sntonick(user.name)+".", True)
- if message.body.startswith("desu"):
- room.message("Desu, Nyan ^_^ "+sntonick(user.name)+"!", True)
- if message.body.startswith("@cindhiva"):
- room.message("maaf anda salah orang! "+sntonick(user.name)+".", True)
- if message.body.startswith("woi"):
- room.message("ga usah teriak-teriak, keles...")
- if message.body.startswith("sepi"):
- room.message("Alay banget lu :P")
- if message.body.startswith("siang"):
- room.message("siang juga :)")
- if message.body.startswith("malam"):
- room.message("Good Night :)")
- if message.body.startswith("konbanwa"):
- room.message("Ohayou :v")
- if message.body.startswith("souka"):
- room.message("Iya kaka >_<")
- if message.body.startswith("master"):
- room.message("Watashiwa masta wa sekki desu >_<")
- if message.body.startswith("malas"):
- room.message("What if I told you! http://s30.postimg.org/wknymko8h/Quotes_Hyouka.jpg @"+user.name+".")
- if message.body.startswith("jam"):
- room.message(strftime("%H:%M:%S", localtime()))
- if message.body.startswith("tanggal"):
- room.message(strftime ("HARI: %a,%d-%b-%Y ", localtime()))
- if message.body.startswith("siapa yang"):
- room.message(random.choice(room.usernames))
- if message.body.startswith("siapa yang paling cantik "):
- jawab = ["Kepo banget sih","aku lah","saya","ntahlah","susah jawab nya :v"]
- room.message(random.choice(jawab) +sntonick(user.name)+".", True)
- if message.body.startswith("jones"):
- room.message("Haha, Kasian http://media.giphy.com/media/W3ZJuP6774be/giphy.gif @"+user.name+".")
- if message.body.startswith("aku jahat apa baik ?"):
- jawab = ["jahat","siapa ya? ","sok kenal kali sih!!","Ntahlah :3","coegh"]
- room.message(random.choice(jawab) +sntonick(user.name)+".", True)
- if message.body.startswith("kamu makhluk apa cin?"):
- room.message("Ntahlah, aku pun bimbang")
- if message.body.startswith("gak ada"):
- room.message("Emangnya gue pikirin :P")
- if message.body.startswith("teks"):
- room.message("<marquee>HALO SELAMAT DATANG >>>>>>>>></marquee>")
- if message.body.startswith("kamu tinggal dimana?"):
- room.message("dihatimu :3")
- if message.body.startswith("kamu udah makan?"):
- jawab = ["belom","beliin dong, kaka","kakak suapin","beliin kue dong","siapa yah ?"]
- room.message(random.choice(jawab) +sntonick(user.name)+".", True)
- if message.body.startswith("kenapa cin?"):
- if user.name == "sekkki":
- room.message("M-Master wa B-Bakaa.. http://s15.postimg.org/oruolh5kr/large.jpg @"+ user.name+".")
- else:
- room.message("U-urusai.. Hmph http://s27.postimg.org/kgdcd7msj/image.jpg @"+ user.name+".")
- if message.body.startswith("kamu make pantsu apa cin?"):
- jawab = ["hijau","pelangi","kuning","merah","biru","hitam","ungu","gambar beruang"]
- room.message(random.choice(jawab)+"" +sntonick(user.name)+".", True)
- if message.body.startswith("bapa kamu"):
- jawab = ["iya ko tau","bukan","siapa ya ?","hem mungkin","siapa yah ?"]
- room.message(random.choice(jawab)+" @"+user.name)
- if message.body.startswith("Rekom anime romance"):
- jawab = ["Clannad, after story, Sukitte ii na you, Aoharu ride, Kaichou wa maid-sama, Nisekoi, InuxBoku,Ore monogatari,Nagi no Asukara, Tonari no Kaibutsu-kun,Isshukan friend,Kamisama Hajimemashita,Special A,Soredemo sekai wa utsukushi,Hen Ouji,Amagami,Kimi ni Todoke,Toradora,sankarea,Golden Time,White Album,Bakemonogatari,Gosick,Hotarubi no Mori e,"]
- room.message(random.choice(jawab)+" @"+user.name)
- if message.body.startswith("Rekom anime harem"):
- jawab = ["Absolute Duo, Asobi ni Iku Yo, Campione, Freezing, High School DxD, Hoshizora E Kakaru Hashi,Kiss X Sis, Kore wa Zombie Desu Ka,Maken-Ki- Nisekoi,Orehura, Imocho,Seikon no Qwaser,Sekirei ,Shinmai Maou no Testament,Sora No Otoshimono,To Love ru,Walkure Romanze,Yamada-kun to 7-nin no Majo,Infinite Stratos,Trinity Seven,Zero no Tsukaima,Strike The Blood,NouCome,Kanojo ga flag wo oraretara,Air Gear, Saenai Heroine no Sodatekata,Mondaiji Tachi,Isuca,Inou Battle wa Nichijou,D-Frag,Mashiro-iro Symphony,CubexCursedxCurious,Sword Art Online,Koi to Senkyo no Chocolate,Date A Live, The World God Only Knows,Hidan no Aria, Hen Ouji,Denpa Kyoushi,Kuusen Madoushi,Grisaia no Kajitsu, Monmusu"]
- room.message(random.choice(jawab)+" @"+user.name)
- if message.body.startswith("gue cantik gak cin?"):
- jawab = ["ga cantik, tapi tamvan :D","siapa ya?","cantik","cantik sih, tapi masih cantikan aku","ga usah sok kenal!"]
- room.message(random.choice(jawab)+" @"+user.name)
- if message.body.startswith("oh"):
- jawab = ["Weteep","Gile lu Ndro","Hmm.."]
- room.message(random.choice(jawab)+" @"+user.name)
- if message.body.startswith("lol "):
- jawab = ["Alay :P","Gzz..","Hm.."]
- room.message(random.choice(jawab)+" @"+user.name)
- if message.body.startswith("soalnya kamu"):
- jawab = ["boleh juga","garing","lagi dong","so swet","siapa yah ?"]
- room.message(random.choice(jawab)+" @"+user.name)
- if message.body.startswith("karena kamu"):
- jawab = ["boleh juga","garing","lagi dong","so swet","nge gombal, ya? "]
- room.message(random.choice(jawab)+" @"+user.name)
- if message.body.startswith("asal kamu dari mana cin?"):
- room.message("aku dari tadi kok")
- if message.body.startswith("cin"):
- if user.name == "sekkki":
- room.message(" What's Going on ? "+sntonick(user.name)+".", True)
- else:
- room.message("Apaan? sok kenal banget sih... @"+ user.name+".")
- if message.body.startswith("hentong"):
- room.message("Kimoii, Shut Up")
- if message.body.startswith("off"):
- if user.name == "sekkki":
- room.message("Mata-Nee *waves* "+sntonick(user.name)+".", True)
- else:
- room.message("Tch.. Peduli apa :P")
- if message.body.startswith("tsundere"):
- room.message(" W-What ?, http://i173.photobucket.com/albums/w77/omghaet/Index/Biri-Biri.png "+sntonick(user.name)+".", True)
- if message.body.startswith("yandere"):
- room.message("Yes!, I'm here, http://vignette2.wikia.nocookie.net/futurediary/images/a/a5/YunoYandereFace.jpg/revision/latest?cb=20120128011750 "+sntonick(user.name)+".", True)
- if message.body.startswith("pagi"):
- for i, msg in enumerate(pagi):
- self.setTimeout(i / 2, room.message, msg)
- if message.body.startswith("bete nih"):
- for i, msg in enumerate(bete):
- self.setTimeout(i / 0.79, room.message, msg)
- if message.body.startswith("nyan"):
- for i, msg in enumerate():
- self.setTimeout(i / 2, room.message, msg)
- if message.body.startswith("afk"):
- if user.name == "sekkki":
- room.message("Oh! AFK? See you again :| "+sntonick(user.name)+".", True)
- else:
- room.message("Mata-Nee " +sntonick(user.name)+".", True)
- if message.body.startswith("kata bijak"):
- room.message(random.choice(["jangan lah berhenti bermimpi karena mimpi bisa itu suatu saat akan menjadi nyata.",
- "berani ambil resiko, kita tidak akan pernah tau apa yang akan terjadi.",
- "jangan pernah lupa dengan orang yang selalu mendukung mu dari belakang.",
- "jangan pernah sekali-kali sombong, karena di atas langit masih ada langit.",
- "To true friendship, how long you've known each other means nothing.",
- "You want weapons? We??re in a library! Books! The best weapons in the world!",
- "mulut lebih tajam dari benda apapun kalu kita salah menggunakan nya.",
- "Dividing an impossibly large task into smaller solvable problems is a programmer??s job.",
- "dunia ini penuh dengan melodi dan harmoni, jangan sekali2 merusak nya dengan keluhan anda :)",
- "Hold hands. That's what you're meant to do. Keep doing that... and don't let go.",
- "cintailah orang yang mencintai anda juga?",
- "jangan pernah malah olahraga",
- "Don't worry if plan A fails, there are 25 more letters in the alphabet.",
- "Life doesn't have any hands, but it can sure give you a slap sometimes.",
- "lihat ke belakang, sewaktu2 jika anda tidak sedang sibuk",
- "Belajar ketika orang lain tidur, bekerja ketika orang lain bermalasan, dan bermimpi ketika orang lain berharap.",
- "Pain has deep roots. The only way to dig it out is to forgive...",
- "Love,after all,always said more about those who felt it then it did about the ones they love.",
- "Memories are funny things.Sometimes they're real ,but other times they change into what we went them to be.",
- "The moment of impact. The moment of impact proves potential for change. Has ripples effects far beyond what we can predict."]))
- if message.body.startswith("quotes"):
- room.message(random.choice(["jangan lah berhenti bermimpi karena mimpi bisa itu suatu saat akan menjadi nyata.",
- "berani ambil resiko, kita tidak akan pernah tau apa yang akan terjadi.",
- "jangan pernah lupa dengan orang yang selalu mendukung mu dari belakang.",
- "jangan pernah sekali-kali sombong, karena di atas langit masih ada langit.",
- "To true friendship, how long you've known each other means nothing.",
- "You want weapons? We??re in a library! Books! The best weapons in the world!",
- "mulut lebih tajam dari benda apapun kalu kita salah menggunakan nya.",
- "Dividing an impossibly large task into smaller solvable problems is a programmer??s job.",
- "dunia ini penuh dengan melodi dan harmoni, jangan sekali2 merusak nya dengan keluhan anda :)",
- "Hold hands. That's what you're meant to do. Keep doing that... and don't let go.",
- "cintailah orang yang mencintai anda juga?",
- "jangan pernah malah olahraga",
- "Don't worry if plan A fails, there are 25 more letters in the alphabet.",
- "Life doesn't have any hands, but it can sure give you a slap sometimes.",
- "lihat ke belakang, sewaktu2 jika anda tidak sedang sibuk",
- "Belajar ketika orang lain tidur, bekerja ketika orang lain bermalasan, dan bermimpi ketika orang lain berharap.",
- "Pain has deep roots. The only way to dig it out is to forgive...",
- "Love,after all,always said more about those who felt it then it did about the ones they love.",
- "Memories are funny things.Sometimes they're real ,but other times they change into what we went them to be.",
- "The moment of impact. The moment of impact proves potential for change. Has ripples effects far beyond what we can predict."]))
- if message.body.startswith("ramalan jodoh"):
- room.message("masukan nama mu dan pasangan mu contoh >> mr.x dan ms.y setelah itu tulis >> ramal")
- if message.body.startswith("gua cocok gak sama"):
- jawab = ["cocok nya sama thelor","gak akan pernah cocok","gak pantes","saling suka :)",]
- room.message(random.choice(jawab)+" @"+user.name)
- if message.body.startswith("brb"):
- if user.name == "sekkki":
- room.message("Hus..Hus..")
- else:
- room.message("sampai ketemu lagi "+sntonick(user.name)+".", True)
- if message.body.startswith("back"):
- if user.name == "sekkki":
- room.message("Welcome to This Chat ^_^")
- else:
- room.message("Welcome to Indonesia "+sntonick(user.name)+".", True)
- try:
- if room.getLevel(self.user) > 0:
- print(user.name, message.body)
- else:
- print(user.name, message.body)
- if self.user == user: return
- if message.body[0] == "~" or message.body[0] == ";" : ##Here is the Prefix part
- data = message.body[1:].split(" ", 1)
- if len(data) > 1:
- cmd, args = data[0], data[1]
- else:
- cmd, args = data[0], ""
- 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
- ##COMMANDS!
- #Setting up commands for yer bot
- #commands section
- #youtube
- #say
- if cmd == "say":
- if args:
- room.message(args)
- else:
- room.message("sariawan males ngomong")
- #### Invite
- if cmd == "invite" or cmd == "Invite":
- if len (args) > 0:
- self.pm.message(ch.RoomManager(args),"%s kalo lagi sepi di room itu mampir aja kemari >>>> http://%s.chatango.com .")
- room.message("Invite on progress %s in Access group. :)" % args)
- else:
- room.message("Sry have problem. :3")
- ##You may want/need to evaluate something about your bot.
- if cmd == "ev" or cmd == "eval" or cmd == "e":
- ret = eval(args)
- if ret == None:
- room.message("Done.")
- return
- room.message(str(ret))
- #### Google Image Search
- ##Check Level
- ##Join Leave..##
- elif cmd == "leave":
- if user.name == "sekkki":
- if not args:args=room.name
- self.leaveRoom(args)
- room.message("[<b>Loading...</b>] Out from "+args+" ;)",True)
- print("[SAVE] SAVING Rooms...")
- f = open("rooms.txt", "w")
- f.write("\n".join(self.roomnames))
- f.close()
- ###### join room + roomname
- elif cmd == "rooms":
- j = []
- for i in self.roomnames:
- j.append(i+'[%s]' % str(self.getRoom(i).usercount))
- j.sort()
- room.message("I'm online in "+'[%s] room(s) ,There are: '%(len(self.roomnames))+", ".join(j))
- elif cmd == "join" and len(args) > 1:
- if user.name == "sekkki": ##kalo mau buat yang bisa nge join kan|| tambahin if user.name == "sekkki" or user.name == "textvp": gitu.. faiq intinya ditambahin or user.name == "namanya" gitu..##
- if args not in self.roomnames:
- room.message("[<b>Loading...</b>] Connected to "+args+" ;)",True)
- self.joinRoom(args)
- else:
- room.message("I was already there :| ...")
- print("[SAVE] SAVING Rooms...")
- f = open("rooms.txt", "w")
- f.write("\n".join(self.roomnames))
- f.close()
- elif (cmd == "nick"): ##tambahin sntonick(user.name) faiq, supaya bot nya manggil pake nick ;)
- try:
- if args:
- sntonick(user.name)
- nicks[user.name]=json.dumps(args)
- room.message (user.name+" <f x12FFCC00='1'>now <f x12334433='1'>will be Called, <f x126666CC='1'> "+args+" :)" ,True)
- saveNicks()
- if args == "":
- room.message("<f x12F00='1'>Type .nick <f x12FFCC00='1'>*Your Nick Here* <f x12334433='1'> .. :)",True)
- except:
- room.message("I'am Failed make a nick for, "+user.name+". :(")
- elif cmd == "mynick":
- try:
- if user.name in nicks:
- room.message("<f x12F00='1'>Your nick <f x1233FFFF='1'>right Now is: "+sntonick(user.name)+" .. :)", True)
- else:
- room.message("<f x12000='1'>Type .nick <f x12F00='1'>*Your Nick*",True)
- except:
- return
- elif cmd == "detik":
- room.message(detik(),True)
- elif cmd == "cpu":
- room.message(get_cpu_load(),True)
- #This one cmd is tho make your bot say your mod level in the current room you're in
- elif cmd == "mylvl":
- room.message("Your mod level: %i" %(room.getLevel(user)))
- ##List Mods
- #List of Mods and Owner name in the current room you're in
- elif cmd == "mods":
- room.message(", ".join(room.modnames + [room.ownername]))
- #### Seen
- elif cmd == "gis":
- try:
- import urllib
- url = urllib.request.urlopen("http://ajax.googleapis.com/ajax/services/search/images?v=1.0&q="+urllib.parse.quote(args))
- udict = json.loads(url.read().decode('utf-8'))["responseData"]["results"]
- udict = random.choice(udict)
- img = udict["unescapedUrl"]
- room.message("<font color='#FF0000'><b>"+user.name.title()+"</b></font>,I Found your images: "
- +img, True)
- except:
- room.message(args.capitalize()+' is not found Dude!')
- elif cmd == "yt":
- room.message(tube(args),True)
- elif cmd == "invitegroup" or cmd == "ig":
- if len (args) > 0:
- self.pm.message(ch.RoomManager(args),"%s You have group invite! check this Chatango Group http://%s.chatango.com ." %(room.ownername[0],room.name))
- room.message("Youre invite %s now is in Accest Group. :)" % args)
- else:
- room.message("gak mau ah nginvite dia")
- ##DANCE!!!!
- #Dance ? Of Course !!! ^_^
- elif cmd == "dance":
- for i, msg in enumerate(dancemoves):
- self.setTimeout(i / 2, room.message, msg)
- #### Pm
- elif cmd == "pm" or cmd == "Pm" or cmd == "PM" or cmd == "Private Message":
- 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("Has been sent to "+name+"")
- ##SN
- if (cmd == "sn" or cmd == "sendnote") and len(args) > 0:
- try:
- to, body = args.split(" ", 1)
- sender = user.name
- if to in spermitted or to in permitted or to in hpermitted or to in whitelist or to in friend:
- 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 !!")
- ##definied
- elif (cmd == "define" or cmd == "df") and len(args) > 0:
- try:
- word, definition = args.split(" as ", 1)
- word = word.lower()
- except:
- word = args.split()[0].lower()
- definition = ""
- if len(definition) > 0:
- if word in dictionary:
- room.message(user.name+", sorry but <b>%s</b> is already defined" % word, True)
- else:
- dictionary[word] = json.dumps([definition, user.name])
- room.message("okay, I will remember "+word+" as "+ definition, True)
- else:
- if word in dictionary:
- definition, name = json.loads(dictionary[word])
- room.message(name+" defined "+word+" as "+definition , True)
- else:
- room.message("<b>%s</b> is not yet defined, do <b>'define %s as meaning</b> to define it^^" % (args, args), True)
- elif (cmd == "delete" or cmd == "dl" or cmd == "del"):
- if room.getLevel(self.user) > 0:
- if self.getAccess(user) >= 3 or room.getLevel(user) > 0:
- name = args.split()[0].lower()
- room.clearUser(ch.User(name))
- else:room.message("You mere mortals can never do that!!")
- else:
- room.message("I can't del it :|")
- elif (cmd == "undefine" or cmd == "undef" or 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]
- room.message(word+" 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("Fail")
- return
- elif cmd == "seen":
- try:
- nama = args
- if nama in hist:
- waktu, ruang, body = json.loads(hist[nama])
- room.message("Last message i seen by "+nama+" - "+waktu+" - "+ruang+" - "+body)
- else:
- room.message("I haven't seen " + nama + " all this days :|")
- except:
- room.message("fail")
- elif cmd == ("find") and len(args) > 0:
- name = args.split()[0].lower()
- try:
- if name in room.usernames:
- if not ch.User(name).roomnames: room.message("dont see them. <_<")
- else: room.message("%s is curently in <b>%s</b> >_>" % (args, ", ".join(ch.User(name).roomnames)), True)
- except: return
- target = args[1:]
- if args[0] == "+":
- if not ch.User(target).roomnames: room.message("dont see them. <_<")
- else: room.message("%s is curently in <b>%s</b> >_>" % (args[1:], ", ".join(ch.User(target).roomnames)), True)
- #### Invite
- elif cmd == "invite" or cmd == "Invite":
- if len (args) > 0:
- self.pm.message(ch.RoomManager(args),"%s You have a group invite by ! http://%s.chatango.com ." )
- room.message("Invite on progress %s in Access group. :)" % args)
- else:
- room.message("Sry have problem. :3")
- elif cmd == "wl" and len(args) > 0:
- if args == "":
- room.message("write 'wl <user-name-to-whitelist>")
- elif args == "me": return
- elif args in room.usernames:
- if args in room.ownername or args in room.modnames or args in whitelist or args in spermitted or args in permitted or args in hpermitted:
- room.message("Are you insane ?")
- else:
- friend.append(args)
- room.message(args+" can use me now. ^^")
- elif args not in room.usernames:
- if args == "": return
- room.message("I don't see "+args+" in this room :|")
- elif (cmd == "readnote" or cmd == "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
- #### Profile
- elif cmd == "prof" or cmd == "profile" or 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 ")
- ##set rank
- elif cmd == "setrank" and len(args) > 0:
- if self.getAccess(user) < 3 and not room.getLevel(user) > 0: return
- try:
- if len(args) >= 3:
- name, rank = args.lower().split(" ", 1)
- if rank == "4":
- if self.getAccess(user) == 5:
- if name in permitted: room.message("%s is Already a Mod" % name, True)
- else:
- permitted.append(name)
- room.message("Good luck <b>%s</b> , you're now a %s !! ^^" % (name, "Councill Member"), True)
- if name in hpermitted:
- hpermitted.remove(name)
- if name in whitelist:
- whitelist.remove(name)
- if name in friend:
- friend.remove(name)
- else:
- room.message("Fook off!!")
- return
- if rank == "3":
- if self.getAccess(user) == 5:
- if name in hpermitted: room.message("%s is already an Arch Knight! :|" % name, True)
- else:
- hpermitted.append(name)
- room.message("%s is now an Arch Knight. ^^" % name, True)
- if name in permitted:
- permitted.remove(name)
- if name in whitelist:
- whitelist.remove(name)
- if name in friend:
- friend.remove(name)
- else:
- room.message("Fook off!!")
- return
- if rank == "2":
- if name in whitelist: room.message("%s is already a Player!! :|" % name, True)
- else:
- if self.getAccess(user) < 5:
- if name in permitted or name in spermitted or name in hpermitted or name in room.ownername or name in room.modnames :
- room.message("Are you nuts ? :|")
- return
- else:
- if name in room.usernames:
- room.message("%s is now a Player. ^^" % name, True)
- whitelist.append(name)
- if name in friend:
- friend.remove(name)
- else:
- whitelist.append(name)
- room.message("%s is now a Player. ^^" % name, True)
- if name in permitted:
- permitted.remove(name)
- if name in hpermitted:
- hpermitted.remove(name)
- if name in friend:
- friend.remove(name)
- if rank == "1":
- if name in friend: room.message("%s is already a citizen" % name, True)
- else:
- if self.getAccess(user) < 5:
- if name in permitted or name in spermitted or name in hpermitted or name in room.ownername or name in room.modnames:
- room.message("Are you nuts ?? :|")
- return
- else:
- friend.append(name)
- room.message("%s's rank is set to 1" % name, True)
- if name in whitelist:
- whitelist.remove(name)
- else:
- friend.append(name)
- room.message("%s's rank is set to 1" % name, True)
- if name in permitted:
- permitted.remove(name)
- if name in hpermitted:
- hpermitted.remove(name)
- if name in whitelist:
- whitelist.remove(name)
- if not rank == "1" and not rank == "2" and not rank == "3" and not rank == "4":
- room.message("Please type a propper rank number ! >_>")
- except:
- room.message("You fooked up >_> ,, Do it right next time !")
- #word today
- if cmd =="wordtoday" or cmd=="wt":
- if user.name in owners:
- if user.name in wordtodaytime:
- w = json.loads(wordtodaytime[user.name])
- if time.time() < w:
- w = int(w) - int(time.time())
- minute = 60
- hour = minute * 60
- day = hour * 24
- days = int(w / day)
- hours = int((w % day) / hour)
- minutes = int((w % hour) / minute)
- seconds = int(w % 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("You can use wordtoday after <font color='#9999FF'>%s</font> (~^o^)~ "% string,True)
- return
- if urank(user.name) >= 1:
- x=(random.choice(["sadness","happines","yaoi","yuri","horny","nice","bad","bastard","young","lazy","poor","rich","ugly","handshome","beautiful","good","gay","keep calm","arrogant","naughty","special","sweet","tits","areola","pupy","ass","sunny","dizzy","nude","old","lifeless","dying",'death',"impotent","cancer"]))
- room.message("Dear "+sntonick(user.name)+" Your word today is : <b><font color='#FF9966'>"+str(x)+"</font></b>",True)
- wordtodaytime[user.name] = json.dumps(time.time()+1200)
- ##fax
- ##lock
- if cmd == "lock":
- if self.getAccess(user) < 3 and not room.getLevel(user) >= 1:
- room.message("wat ? :|")
- return
- if args in self.roomnames:
- if self.getAccess(user) > 3:
- locks.append(args)
- room.message("locked <b>%s</b>" % args, True)
- else: room.message("Only rank 4+ gets to lock rooms remotely")
- if args == "":
- locks.append(room.name)
- room.message("locked <b>%s</b>" % room.name, True)
- if args not in self.roomnames:
- if args == "": return
- room.message("I haven't joined such room :|")
- return
- ## Save Stuffs
- if cmd == "save":
- if self.getAccess(user) >= 4:
- print("[SAVE] Saving Notes..")
- f = open("notes.txt", "w")
- for to in sasaran:
- body, sender = json.loads(sasaran[to])
- f.write(json.dumps([to, body, sender])+"\n")
- f.close()
- f = open("notif.txt", "w")
- f.write("\n".join(notif))
- f.close()
- print("[SAVE] Saving PMLOG..")
- f = open("pmlog.txt", "w")
- f.write("\n".join(pmlog))
- f.close()
- print("[SAVE] Saving ROOMLOG..")
- f = open("roomlog.txt", "w")
- f.write("\n".join(roomlog))
- f.close()
- print("[SAV] Saving Definitions..")
- 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()
- print("[SAV] Saving SuperMasters..")
- f = open("spermitted.txt", "w")
- f.write("\n".join(spermitted))
- f.close()
- print("[SAV] Saving Mods..")
- f = open("permitted.txt", "w")
- f.write("\n".join(permitted))
- f.close()
- print("[SAV] Saving Arch Knights..")
- f = open("hpermitted.txt", "w")
- f.write("\n".join(hpermitted))
- f.close()
- print("[SAV] Saving Whitelist..")
- f = open("whitelist.txt", "w")
- f.write("\n".join(whitelist))
- f.close()
- print("[SAV] Saving Rooms..")
- f = open("rooms.txt", "w")
- f.write("\n".join(self.roomnames))
- f.close()
- print("[SAV] Saving Friends..")
- f = open("friend.txt", "w")
- f.write("\n".join(friend))
- f.close()
- print("[SAVE] SAVING RPG...")
- f = open("rpg.txt", "w")
- for user in rpg:
- weapon,hp,lvl,exp = json.loads(rpg[user])
- f.write(json.dumps([user, weapon, hp , lvl , exp])+"\n")
- f.close()
- f = open("tmonlife.txt", "w")
- for monster in tmonlife:
- monlife = json.loads(tmonlife[monster])
- f.write(json.dumps([monster, monlife])+"\n")
- f.close()
- print("[SAVE] Saving History...")
- f = open("roomhist.txt", "w")
- for nama in hist:
- waktu, ruang, body = json.loads(hist[nama])
- f.write(json.dumps([nama, waktu, ruang, body])+"\n")
- f.close()
- print("[SAVE] Saving Locks...")
- f = open("locks.txt", "w")
- f.write("\n".join(locks))
- f.close()
- room.message("I've saved All ")
- #f = open("lovelog.txt", "w")
- #for user1 in lomet:
- # meter = json.loads(lomet[user1])
- # f.write(json.dumps([user1, meter]+"\n"))
- #f.close()
- else:
- room.message("wish you want =/")
- if cmd =="nas":
- sex = args
- data = urlreq.urlopen("http://nontonanime.web.id/?s="+sex+"&post_type=anime")
- udict = data.read().decode("utf-8")
- data = re.findall('<h2><a href="(.*?)">(.*?)</a>', udict)
- newset = list()
- num = 1
- for link, title in data:
- newset.append(("(%s) <b>%s</b> - %s") % (num, title, link))
- num = num+1
- room.message("This is the contain Search in NontonAnime.web.id: <br/>"+"<br/>".join(newset[0:10]),True)
- ## Command List
- elif cmd == "cmds":
- if self.getAccess(user) > 1 or room.getLevel(user) > 0:
- room.message("some cmds for rank 2+, with ['] or [:] as prefix [wl, credits, uwl, say, cmds, nick, mynick, seenick, councills, sut, uptime, rank, rankhelp, mods, ismod, level, rooms, find username/find +username, seen, multichat,, lovemeter/lm, sendnote/sn, readnote/rn, jones, sex/rape, kill/keel, fap, tea, hug, kiss, profile, yt/ytb, gis, ud, define/df, undefine/udf]")
- if self.getAccess(user) == 1 and not room.getLevel(user) > 0:
- room.message("Your rank is 1[Citizen] - Here are cmds for Citizens (help, say, cmds, uwl, nick, mynick, seenick, register/regist/reg/, credits)")
- elif (cmd == "register" or cmd == "reg" or cmd == "regist"):
- if self.getAccess(user) == 1 and not user.name in room.modnames and not user.name in room.ownername:
- whitelist.append(user.name)
- friend.remove(user.name)
- room.message(user.name+" has registered as a Player. ^^")
- ##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")
- 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
- ##Other Crap here, Dont worry about it
- def onFloodWarning(self, room):
- room.reconnect()
- def onJoin(self, room, user):
- print(user.name + " joined the chat!")
- if user.name =="sekkki":
- room.message("Goshujin- chama is Online Now")
- def onLeave(self, room, user):
- print(user.name + " left the chat!")
- if user.name =="sekkki":
- room.message("Goshujin-chama leave this chat")
- def onUserCountChange(self, room):
- print("users: " + str(room.usercount))
- def onMessageDelete(self, room, user, msg):
- print("MESSAGE DELETED: " + user.name + ": " + msg.body)
- if __name__ == "__main__": TestBot.easy_start(rooms,"","")
- #The End!!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement