Update server_commands.py

This commit is contained in:
Elmon11 2021-01-05 00:44:57 +01:00 committed by GitHub
parent da81f4ad37
commit b762622bd2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -138,7 +138,8 @@ class ServerCommands(commands.Cog):
for arg in args:
command += f'{arg} '
try:
if args[0] in ['mute', 'stfu', 'gtfo', 'ban', 'unban', 'unmute', 'smite', 'noob', 'tban', 'tempban', 'warn', 'mv', 'kick', 'cc', 'say']:
if args[0] in ['mute', 'stfu', 'gtfo', 'ban', 'unban', 'unmute', 'smite', 'noob', 'tban', 'tempban', 'warn',
'mv', 'kick', 'cc', 'say']:
self.write_telnet_session(server,
bytes(command, 'ascii') + b"\r\n")
elif args[0] == 'saconfig':
@ -277,7 +278,8 @@ class ServerCommands(commands.Cog):
rank_fixed[word] = rank_fixed[word].capitalize()
entries.append(format_list_entry(em, json[rank], f'{" ".join(rank_fixed)}'))
order = ['Owners', 'Executives', 'Developers', 'Senior Admins', 'Admins', 'Master Builders', 'Operators', 'Imposters']
order = ['Owners', 'Executives', 'Developers', 'Senior Admins', 'Admins', 'Master Builders',
'Operators', 'Imposters']
sorted = [entry for rank in order for entry in entries if entry.name == rank]
for x in sorted:
@ -346,10 +348,12 @@ class ServerCommands(commands.Cog):
allocated_memory = allocated_memory.strip(':Free memory:')
free_memory = free_memory.strip(':World "world":')
print(f'TPS: {server_tps} UPTIME: {server_uptime} MAX MEM: {maximum_memory} ALLCTD MEM: {allocated_memory} FREE MEM: {free_memory}')
print(
f'TPS: {server_tps} UPTIME: {server_uptime} MAX MEM: {maximum_memory} ALLCTD MEM: {allocated_memory} FREE MEM: {free_memory}')
try:
server_uptime = re.match('([0-9]+ days? )?([0-9]+ hours )?([0-9]+ minutes )?([0-6]?[0-9] seconds)', server_uptime)[0]
server_uptime = \
re.match('([0-9]+ days? )?([0-9]+ hours )?([0-9]+ minutes )?([0-6]?[0-9] seconds)', server_uptime)[0]
server_tps = re.match('[0-2][0-9].?[0-9]*', server_tps)[0]
maximum_memory = re.match('[0-9]+,?[0-9]* MB', maximum_memory)[0]
allocated_memory = re.match('[0-9]+,?[0-9]* MB', allocated_memory)[0]