Exemplo n.º 1
0
def cmdTempBan(obj, t): 
	#!tempban Joey length reason
	db = database.DB()
	db.tableSelect('clients')
	msg = obj.data["msg"].split(" ", 3)
	sender = obj.data['sender']
	senderobj = A.findClient(sender)

	if len(msg) == 3: #!ban joey
		reason = 'No Reason Given'
	elif len(msg) == 4: #!ban joey my special reason
		reason = msg[3].strip()
	else: A.tell(sender, 'Usage: !tempban <player> <duration> [reason]')

	if 1 < len(msg) < 5:
		ctime = datetime.now()
		etime = datetime(ctime.year, ctime.month, ctime.day, ctime.hour, ctime.minute, ctime.second) + timedelta(minutes=const.timeparse(msg[2]))
		exptime = time.mktime(etime.timetuple())
		banr = A.findClient(msg[1])
		if banr != None:
			banrdb = db.rowFind(banr.cid)
			db.tableSelect('penalties')
			db.rowCreate({'userid':banr.cid, 'adminid':senderobj.cid, 'type':'tempban', 'reason':reason, 'time':ctime, 'expiration':exptime, 'status':1})
			db.commit()
			A.tell(banr.uid, 'Temp Banned tell %s' % etime.__str__())
			A.kick(banr.uid)
			A.tell(sender, 'Temp Banned %s tell %s!' % (banr.name, etime.__str__()))
	else: A.tell(sender, 'Usage: !tempban <player> <duration> [reason]')
Exemplo n.º 2
0
def cmdBan(obj, t):
	#!ban Joey He's an idiot
	db = database.DB()
	db.tableSelect('clients')
	msg = obj.data["msg"].split(" ", 2)
	sender = obj.data['sender']
	senderobj = A.findClient(sender)
	ctime = datetime.now()

	if len(msg) == 2: #!ban joey
		reason = 'No Reason Given'
	elif len(msg) == 3: #!ban joey my special reason
		reason = msg[2].strip()
	else: A.tell(sender, 'Usage: !ban <player> [reason]')

	if 1 < len(msg) < 4:
		banr = A.findClient(msg[1])
		if banr != None:
			banrdb = db.rowFind(banr.cid)
			db.tableSelect('penalties')
			db.rowCreate({'userid':banr.cid, 'adminid':senderobj.cid, 'type':'ban', 'reason':reason, 'time':ctime, 'expiration':-1, 'status':1})
			db.commit()
			A.kick(banr.uid)
			A.tell(sender, 'Banned %s!' % banr.name)
		else:
			A.tell(sender, 'No users matching %s' % msg[1])
Exemplo n.º 3
0
def cmdKickAll(obj, t):
	msg = obj.data["msg"].split(" ")
	sender = obj.data["sender"]
	for i in A.B.Clients.values():
		if i.uid != int(sender):
			A.kick(i.uid)