/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,22 +330,34 @@ def ooc_cmd_kick(client, arg):
|
||||
raise ClientError('You must be authorized to do that.')
|
||||
if len(arg) == 0:
|
||||
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(' '))
|
||||
client.send_host_message('Attempting to ban {} IPIDs.'.format(len(args)))
|
||||
for raw_ipid in args:
|
||||
try:
|
||||
ipid = int(raw_ipid)
|
||||
except:
|
||||
raise ClientError('{} does not look like a valid IPID.'.format(raw_ipid))
|
||||
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 found.")
|
||||
client.send_host_message("No targets with the IPID {} were found.".format(ipid))
|
||||
|
||||
def ooc_cmd_ban(client, arg):
|
||||
if not client.is_mod:
|
||||
raise ClientError('You must be authorized to do that.')
|
||||
if len(arg) == 0:
|
||||
raise ArgumentError('You must specify a target. Use /ban <ipid>.')
|
||||
args = list(arg.split(' '))
|
||||
client.send_host_message('Attempting to ban {} IPIDs.'.format(len(args)))
|
||||
for raw_ipid in args:
|
||||
try:
|
||||
ipid = int(arg.strip())
|
||||
ipid = int(raw_ipid)
|
||||
except:
|
||||
raise ClientError('You must specify ipid')
|
||||
raise ClientError('{} does not look like a valid IPID.'.format(raw_ipid))
|
||||
try:
|
||||
client.server.ban_manager.add_ban(ipid)
|
||||
except ServerError:
|
||||
@ -362,12 +374,17 @@ def ooc_cmd_ban(client, arg):
|
||||
def ooc_cmd_unban(client, arg):
|
||||
if not client.is_mod:
|
||||
raise ClientError('You must be authorized to do that.')
|
||||
if len(arg) == 0:
|
||||
raise ArgumentError('You must specify a target. Use /unban <ipid>.')
|
||||
args = list(arg.split(' '))
|
||||
client.send_host_message('Attempting to unban {} IPIDs.'.format(len(args)))
|
||||
for raw_ipid in args:
|
||||
try:
|
||||
client.server.ban_manager.remove_ban(int(arg.strip()))
|
||||
client.server.ban_manager.remove_ban(int(raw_ipid))
|
||||
except:
|
||||
raise ClientError('You must specify ipid')
|
||||
logger.log_server('Unbanned {}.'.format(arg), client)
|
||||
client.send_host_message('Unbanned {}'.format(arg))
|
||||
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):
|
||||
if not client.is_mod:
|
||||
@ -382,25 +399,49 @@ def ooc_cmd_mute(client, arg):
|
||||
if not client.is_mod:
|
||||
raise ClientError('You must be authorized to do that.')
|
||||
if len(arg) == 0:
|
||||
raise ArgumentError('You must specify a target.')
|
||||
raise ArgumentError('You must specify a target. Use /mute <ipid>.')
|
||||
args = list(arg.split(' '))
|
||||
client.send_host_message('Attempting to mute {} IPIDs.'.format(len(args)))
|
||||
for raw_ipid in args:
|
||||
try:
|
||||
c = client.server.client_manager.get_targets(client, TargetType.IPID, int(arg), False)[0]
|
||||
c.is_muted = True
|
||||
client.send_host_message('{} existing client(s).'.format(c.get_char_name()))
|
||||
ipid = int(raw_ipid)
|
||||
except:
|
||||
client.send_host_message("No targets found. Use /mute <id> for mute")
|
||||
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):
|
||||
if not client.is_mod:
|
||||
raise ClientError('You must be authorized to do that.')
|
||||
if len(arg) == 0:
|
||||
raise ArgumentError('You must specify a target.')
|
||||
args = list(arg.split(' '))
|
||||
client.send_host_message('Attempting to unmute {} IPIDs.'.format(len(args)))
|
||||
for raw_ipid in args:
|
||||
try:
|
||||
c = client.server.client_manager.get_targets(client, TargetType.IPID, int(arg), False)[0]
|
||||
c.is_muted = False
|
||||
client.send_host_message('{} existing client(s).'.format(c.get_char_name()))
|
||||
ipid = int(raw_ipid)
|
||||
except:
|
||||
client.send_host_message("No targets found. Use /mute <id> for mute")
|
||||
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):
|
||||
if len(arg) == 0:
|
||||
|
Loading…
Reference in New Issue
Block a user