mirror of
https://github.com/TotalFreedomMC/TotalFreedomBot.git
synced 2024-12-22 15:44:57 +00:00
Update server_commands.py
This commit is contained in:
parent
da81f4ad37
commit
b762622bd2
1 changed files with 42 additions and 38 deletions
|
@ -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]
|
||||
|
|
Loading…
Reference in a new issue