From 5274b58ba85fd6f19c04971fdbb9e2d8465f846b Mon Sep 17 00:00:00 2001 From: Nayan <33187059+GShadow5@users.noreply.github.com> Date: Wed, 3 Sep 2025 23:59:10 +0000 Subject: [PATCH] add listplayers command --- bot.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/bot.py b/bot.py index bd957e3..24b27e1 100644 --- a/bot.py +++ b/bot.py @@ -427,6 +427,16 @@ async def list(ctx): listofservers = 'Available servers:\n' + "\n".join([('`' + s['servername'] + '` - ' + s['description']) for s in servers]) await ctx.send(listofservers) +@bot.command() +async def listplayers(ctx): + ''' Lists the players in the server ''' + global active_server + if active_server is None: + await ctx.send("No server is currently active.") + return + subprocess.Popen(f"screen -S {active_server} -p 0 -X stuff 'list\n'", shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True) + await ctx.send("Please wait, listing players may take a second...") + @bot.command() async def forcestopserver(ctx): ''' Force stop the server by sending keyboard interrupt (admin only) '''