Exemplo n.º 1
0
def pb_reply (nick, data, oc):
	if oc:
		vh.pm (pb_nmdc (data), nick, vh.opchatname, vh.botname)
	else:
		vh.usermc (pb_nmdc (data), nick)
Exemplo n.º 2
0
def OnOperatorCommand(nick,data):
        if data=="+schedule":
                schedule=read()
                vh.usermc("\nSchedule sent via pm.")
                vh.pm(schedule,nick)
        return 0
Exemplo n.º 3
0
def OnOperatorCommand (nick, data):
	#vh.pm(data,nick)
	#print data
	i= data.find(' ')
	#print type(data)
	#print data[1:i]
	if data[1:i] == "notice":
		stri=data[i+1:]
		cmd=stri.split(' ')[0]
		if cmd == "add":
			i=stri.find(' ')
			val=stri[i+1:]
			con = mdb.connect('localhost', 'root', 'happyinbit', 'verlihub')
			with con:
				cur=con.cursor()
				print 'inserting val'
				cur.execute("insert into notice values(0,\'"+val+"\',123456)")
				content=''
				with open(motd_intro_path, 'r') as content_file:
					content = content_file.read()
				content_file=open(motd_path,'w')
				content_file.write(content+'\n')
				content_file.close()

				cur.execute("select msg from notice")
				rows=cur.fetchall()
				motd_file=open(motd_path,'a')
				for row in rows:
					#print "writing"
					motd_file.write("##########\n")
					motd_file.write(row[0]+'\n')
				motd_file.close()
			return 1
		if cmd== 'list':
			con = mdb.connect('localhost', 'root', 'happyinbit', 'verlihub')
			with con:
				cur=con.cursor()
				cur.execute("select id, utcvalid, msg from notice")
				rows=cur.fetchall()
				sendtxt='\nid\tutc valid\tmsg\n#############################################################\n\n'
				for row in rows:
					sendtxt=sendtxt+str(row[0])+'\t'+str(row[1])+'\t'+str(row[2])+'\n'
				print sendtxt
				vh.pm(sendtxt, nick)
			return 1
		if cmd =='del':
			i=stri.find(' ')
			val=stri[i+1:]
			con = mdb.connect('localhost', 'root', 'happyinbit', 'verlihub')
			with con:
				cur=con.cursor()
				cur.execute("delete from notice where id ="+val)
				content=''
				with open(motd_intro_path, 'r') as content_file:
					content = content_file.read()
				content_file=open(motd_path,'w')
				content_file.write(content+'\n')
				content_file.close()

				cur.execute("select msg from notice")
				rows=cur.fetchall()
				motd_file=open(motd_path,'a')
				for row in rows:
					#print "writing"
					motd_file.write("##########\n")
					motd_file.write(row[0]+'\n')
				motd_file.close()
			return 1
Exemplo n.º 4
0
def OnOperatorCommand(nick, data):
    if data == "+schedule":
        schedule = read()
        vh.usermc("\nSchedule sent via pm.")
        vh.pm(schedule, nick)
    return 0