/ban
, /kick
, /mute
, /unmute
, /unban
now allow for multiple people.
Their IPIDs should be appended after one another with a space inbetween, so: `/ban 45123 42130 39212` for example. Further, they now all lead through the user as to what they're doing.
This commit is contained in:
parent
712b683fd5
commit
46e64d6077
@ -330,44 +330,61 @@ def ooc_cmd_kick(client, arg):
|
|||||||
raise ClientError('You must be authorized to do that.')
|
raise ClientError('You must be authorized to do that.')
|
||||||
if len(arg) == 0:
|
if len(arg) == 0:
|
||||||
raise ArgumentError('You must specify a target. Use /kick <ipid>.')
|
raise ArgumentError('You must specify a target. Use /kick <ipid>.')
|
||||||
targets = client.server.client_manager.get_targets(client, TargetType.IPID, int(arg), False)
|
args = list(arg.split(' '))
|
||||||
if targets:
|
client.send_host_message('Attempting to ban {} IPIDs.'.format(len(args)))
|
||||||
for c in targets:
|
for raw_ipid in args:
|
||||||
logger.log_server('Kicked {}.'.format(c.ipid), client)
|
try:
|
||||||
client.send_host_message("{} was kicked.".format(c.get_char_name()))
|
ipid = int(raw_ipid)
|
||||||
c.disconnect()
|
except:
|
||||||
else:
|
raise ClientError('{} does not look like a valid IPID.'.format(raw_ipid))
|
||||||
client.send_host_message("No targets found.")
|
targets = client.server.client_manager.get_targets(client, TargetType.IPID, ipid, False)
|
||||||
|
if targets:
|
||||||
|
for c in targets:
|
||||||
|
logger.log_server('Kicked {}.'.format(c.ipid), client)
|
||||||
|
client.send_host_message("{} was kicked.".format(c.get_char_name()))
|
||||||
|
c.disconnect()
|
||||||
|
else:
|
||||||
|
client.send_host_message("No targets with the IPID {} were found.".format(ipid))
|
||||||
|
|
||||||
def ooc_cmd_ban(client, arg):
|
def ooc_cmd_ban(client, arg):
|
||||||
if not client.is_mod:
|
if not client.is_mod:
|
||||||
raise ClientError('You must be authorized to do that.')
|
raise ClientError('You must be authorized to do that.')
|
||||||
try:
|
if len(arg) == 0:
|
||||||
ipid = int(arg.strip())
|
raise ArgumentError('You must specify a target. Use /ban <ipid>.')
|
||||||
except:
|
args = list(arg.split(' '))
|
||||||
raise ClientError('You must specify ipid')
|
client.send_host_message('Attempting to ban {} IPIDs.'.format(len(args)))
|
||||||
try:
|
for raw_ipid in args:
|
||||||
client.server.ban_manager.add_ban(ipid)
|
try:
|
||||||
except ServerError:
|
ipid = int(raw_ipid)
|
||||||
raise
|
except:
|
||||||
if ipid != None:
|
raise ClientError('{} does not look like a valid IPID.'.format(raw_ipid))
|
||||||
targets = client.server.client_manager.get_targets(client, TargetType.IPID, ipid, False)
|
try:
|
||||||
if targets:
|
client.server.ban_manager.add_ban(ipid)
|
||||||
for c in targets:
|
except ServerError:
|
||||||
c.disconnect()
|
raise
|
||||||
client.send_host_message('{} clients was kicked.'.format(len(targets)))
|
if ipid != None:
|
||||||
client.send_host_message('{} was banned.'.format(ipid))
|
targets = client.server.client_manager.get_targets(client, TargetType.IPID, ipid, False)
|
||||||
logger.log_server('Banned {}.'.format(ipid), client)
|
if targets:
|
||||||
|
for c in targets:
|
||||||
|
c.disconnect()
|
||||||
|
client.send_host_message('{} clients was kicked.'.format(len(targets)))
|
||||||
|
client.send_host_message('{} was banned.'.format(ipid))
|
||||||
|
logger.log_server('Banned {}.'.format(ipid), client)
|
||||||
|
|
||||||
def ooc_cmd_unban(client, arg):
|
def ooc_cmd_unban(client, arg):
|
||||||
if not client.is_mod:
|
if not client.is_mod:
|
||||||
raise ClientError('You must be authorized to do that.')
|
raise ClientError('You must be authorized to do that.')
|
||||||
try:
|
if len(arg) == 0:
|
||||||
client.server.ban_manager.remove_ban(int(arg.strip()))
|
raise ArgumentError('You must specify a target. Use /unban <ipid>.')
|
||||||
except:
|
args = list(arg.split(' '))
|
||||||
raise ClientError('You must specify ipid')
|
client.send_host_message('Attempting to unban {} IPIDs.'.format(len(args)))
|
||||||
logger.log_server('Unbanned {}.'.format(arg), client)
|
for raw_ipid in args:
|
||||||
client.send_host_message('Unbanned {}'.format(arg))
|
try:
|
||||||
|
client.server.ban_manager.remove_ban(int(raw_ipid))
|
||||||
|
except:
|
||||||
|
raise ClientError('{} does not look like a valid IPID.'.format(raw_ipid))
|
||||||
|
logger.log_server('Unbanned {}.'.format(raw_ipid), client)
|
||||||
|
client.send_host_message('Unbanned {}'.format(raw_ipid))
|
||||||
|
|
||||||
def ooc_cmd_play(client, arg):
|
def ooc_cmd_play(client, arg):
|
||||||
if not client.is_mod:
|
if not client.is_mod:
|
||||||
@ -382,25 +399,49 @@ def ooc_cmd_mute(client, arg):
|
|||||||
if not client.is_mod:
|
if not client.is_mod:
|
||||||
raise ClientError('You must be authorized to do that.')
|
raise ClientError('You must be authorized to do that.')
|
||||||
if len(arg) == 0:
|
if len(arg) == 0:
|
||||||
raise ArgumentError('You must specify a target.')
|
raise ArgumentError('You must specify a target. Use /mute <ipid>.')
|
||||||
try:
|
args = list(arg.split(' '))
|
||||||
c = client.server.client_manager.get_targets(client, TargetType.IPID, int(arg), False)[0]
|
client.send_host_message('Attempting to mute {} IPIDs.'.format(len(args)))
|
||||||
c.is_muted = True
|
for raw_ipid in args:
|
||||||
client.send_host_message('{} existing client(s).'.format(c.get_char_name()))
|
try:
|
||||||
except:
|
ipid = int(raw_ipid)
|
||||||
client.send_host_message("No targets found. Use /mute <id> for mute")
|
except:
|
||||||
|
raise ClientError('{} does not look like a valid IPID.'.format(raw_ipid))
|
||||||
|
try:
|
||||||
|
clients = client.server.client_manager.get_targets(client, TargetType.IPID, int(ipid), False)
|
||||||
|
msg = 'Muted ' + str(ipid) + ' clients'
|
||||||
|
for c in clients:
|
||||||
|
c.is_muted = True
|
||||||
|
msg += ' ' + c.get_char_name() + ' [' + c.id + '],'
|
||||||
|
msg = msg[:-1]
|
||||||
|
msg += '.'
|
||||||
|
client.send_host_message('{}'.format(msg))
|
||||||
|
except:
|
||||||
|
client.send_host_message("No targets found. Use /mute <ipid> for mute.")
|
||||||
|
|
||||||
def ooc_cmd_unmute(client, arg):
|
def ooc_cmd_unmute(client, arg):
|
||||||
if not client.is_mod:
|
if not client.is_mod:
|
||||||
raise ClientError('You must be authorized to do that.')
|
raise ClientError('You must be authorized to do that.')
|
||||||
if len(arg) == 0:
|
if len(arg) == 0:
|
||||||
raise ArgumentError('You must specify a target.')
|
raise ArgumentError('You must specify a target.')
|
||||||
try:
|
args = list(arg.split(' '))
|
||||||
c = client.server.client_manager.get_targets(client, TargetType.IPID, int(arg), False)[0]
|
client.send_host_message('Attempting to unmute {} IPIDs.'.format(len(args)))
|
||||||
c.is_muted = False
|
for raw_ipid in args:
|
||||||
client.send_host_message('{} existing client(s).'.format(c.get_char_name()))
|
try:
|
||||||
except:
|
ipid = int(raw_ipid)
|
||||||
client.send_host_message("No targets found. Use /mute <id> for mute")
|
except:
|
||||||
|
raise ClientError('{} does not look like a valid IPID.'.format(raw_ipid))
|
||||||
|
try:
|
||||||
|
clients = client.server.client_manager.get_targets(client, TargetType.IPID, int(ipid), False)
|
||||||
|
msg = 'Unmuted ' + str(ipid) + ' clients'
|
||||||
|
for c in clients:
|
||||||
|
c.is_muted = True
|
||||||
|
msg += ' ' + c.get_char_name() + ' [' + c.id + '],'
|
||||||
|
msg = msg[:-1]
|
||||||
|
msg += '.'
|
||||||
|
client.send_host_message('{}'.format(msg))
|
||||||
|
except:
|
||||||
|
client.send_host_message("No targets found. Use /unmute <ipid> for unmute.")
|
||||||
|
|
||||||
def ooc_cmd_login(client, arg):
|
def ooc_cmd_login(client, arg):
|
||||||
if len(arg) == 0:
|
if len(arg) == 0:
|
||||||
|
Loading…
Reference in New Issue
Block a user