Ejemplo n.º 1
0
Archivo: Qbot2.py Proyecto: imclab/Qbot
def main():
	client = u413lib.createclient()
	if not client.login('user','pass'):
		exit()
	chat = client.joinchat('general')
	client.sendRawCommand('channel general')
	while True:
		chatget = chat.get()
		if chatget:
			for text in chatget:
				if text['Type'] == 'Message':
					command = Command(text['Msg'])
					if command['Command'] == 'say':
						if command['Args']:
							print command['Args']
							chat.send(command['Args'].replace('U413.com','http://www.u413.com'))
					elif command['Command'] == 'hw':
						if command['Args']:
							chat.send('hw args')
						else:
							string = 'Hello World!'
							for i in range(len(string)+1):
								chat.send(string[0:i])
					elif command['Command'] == 'roll':
						if command['Args']:
							pass
						else:
							num = random.choice(range(100))
							chat.send(str(num))
								
		time.sleep(7)
		print 'checking again...'
	return 0
Ejemplo n.º 2
0
def main():
    logger = u413lib.createclient()
    logger.login('USER', 'PASS')
    chatter = logger.joinchat('general')

    while True:
        time.sleep(15)
        chat = chatter.get()
        if chat:
            for c in chat:
                c['Unixtime'] = time.time()
                logstring = repr(c)
                logfile = open('chatlog.log', 'a')
                logfile.write(logstring + "\n")
                logfile.close()
Ejemplo n.º 3
0
def main():
	logger = u413lib.createclient()
	logger.login('USER','PASS')
	chatter = logger.joinchat('general')
	
	while True:
		time.sleep(15)
		chat = chatter.get()
		if chat:
			for c in chat:
				c['Unixtime'] = time.time()
				logstring = repr(c)
				logfile = open('chatlog.log','a')
				logfile.write(logstring+"\n")
				logfile.close()
Ejemplo n.º 4
0
def main():
	global laioni
	global chat
	client = u413lib.createclient()
	if not client.login('USER','PASS'):
		exit()
	chat = client.joinchat('general')
	client.sendRawCommand('channel general')
	while True:
		chatget = chat.get()
		if chatget:
			for text in chatget:
				if text['Type'] == 'Message':
					command = Command(text['Msg'])
					if command['Command'] == 'say':
						if command['Args']:
							print repr(command['Args'])
							send(command['Args'])
					elif command['Command'] == 'hw':
						if command['Args']:
							send('hw args')
						else:
							string = 'Hello World!'
							for i in range(len(string)+1):
								send(string[0:i])
					elif command['Command'] == 'roll':
						if command['Args']:
							pass
						else:
							num = random.choice(range(100))
							send(str(num))
					elif command['Command'] == 'laioni':
						if command['Args']:
							pass
						else:
							if laioni:
								laioni = False
								send("Laioni mode switched off")
							else:
								send("Laioni mode switched on")
								laioni = True
		
				print text['User'],text['Msg'],text['Timestamp']
		time.sleep(7)
	return 0
Ejemplo n.º 5
0
def main():
    global laioni
    global chat
    client = u413lib.createclient()
    if not client.login('USER', 'PASS'):
        exit()
    chat = client.joinchat('general')
    client.sendRawCommand('channel general')
    while True:
        chatget = chat.get()
        if chatget:
            for text in chatget:
                if text['Type'] == 'Message':
                    command = Command(text['Msg'])
                    if command['Command'] == 'say':
                        if command['Args']:
                            print repr(command['Args'])
                            send(command['Args'])
                    elif command['Command'] == 'hw':
                        if command['Args']:
                            send('hw args')
                        else:
                            string = 'Hello World!'
                            for i in range(len(string) + 1):
                                send(string[0:i])
                    elif command['Command'] == 'roll':
                        if command['Args']:
                            pass
                        else:
                            num = random.choice(range(100))
                            send(str(num))
                    elif command['Command'] == 'laioni':
                        if command['Args']:
                            pass
                        else:
                            if laioni:
                                laioni = False
                                send("Laioni mode switched off")
                            else:
                                send("Laioni mode switched on")
                                laioni = True

                print text['User'], text['Msg'], text['Timestamp']
        time.sleep(7)
    return 0
Ejemplo n.º 6
0
	def __init__(self,username,password,version,description,channel="general"):
		self.username=username
		self.password=password
		self.version=version
		self.description=description
		self.client=u413lib.createclient()
		if not self.client.login(username,password):
			exit()
		self.chat=self.client.joinchat(channel)
		self.client.sendRawCommand("channel "+channel)
		#admins
		txtfile=open(www+"data/admins.txt","r")
		string=txtfile.read().replace('\r','')
		txtfile.close()
		self.admins=string.split('\n')
		while '' in self.admins:
			self.admins.remove('')
		#mods
		txtfile=open(www+"data/mods.txt","r")
		string=txtfile.read().replace('\r','')
		txtfile.close()
		self.mods=string.split('\n')
		while '' in self.mods:
			self.mods.remove('')
		#bots
		txtfile=open(www+"data/bots.txt","r")
		string=txtfile.read().replace('\r','')
		txtfile.close()
		self.bots=string.split('\n')
		while '' in self.bots:
			self.bots.remove('')
		#banned
		txtfile=open(www+"data/banned.txt","r")
		string=txtfile.read().replace('\r','')
		txtfile.close()
		self.banned=string.split('\n')
		while '' in self.banned:
			self.banned.remove('')