diff --git a/cogs/utils.py b/cogs/utils.py index f8f69c5..e307b4f 100644 --- a/cogs/utils.py +++ b/cogs/utils.py @@ -6,6 +6,9 @@ import psutil # import openai # Removed because OpenAI commands were disabled, and OpenAI fails to load due to missing "PyDantic" dependency import discord +import json +import time +import datetime from api import auth from framework.isobot import currency, embedengine, commands as cmds from framework.isobot.db import levelling @@ -30,6 +33,7 @@ class Utils(commands.Cog): def __init__(self, bot): self.bot = bot + self.start_time = time.time() @commands.slash_command( name='echo', @@ -186,12 +190,17 @@ async def status(self, ctx: ApplicationContext): sys_ram = str(f"{psutil.virtual_memory()[2]}GiB") sys_cpu = str(f"{psutil.cpu_percent(1)}%") bot_users = currency.get_user_count() + total_users = int() + for guild in self.bot.guilds: + total_users += guild.member_count localembed = discord.Embed(title="Client Info") - localembed.add_field(name="OS Name", value=os_name) + localembed.add_field(name="Uptime", value=str(datetime.timedelta(seconds=int(round(time.time()-self.start_time))))) + localembed.add_field(name="OS Name", value=os_name, inline=True) localembed.add_field(name="RAM Available", value=sys_ram) localembed.add_field(name="CPU Usage", value=sys_cpu) localembed.add_field(name="Registered Users", value=f"{bot_users} users", inline=True) - localembed.add_field(name="Uptime History", value="[here](https://stats.uptimerobot.com/PlKOmI0Aw8)") + localembed.add_field(name="Total Users", value=f"{total_users} users") + localembed.add_field(name="Uptime History", value="[here](https://stats.uptimerobot.com/PlKOmI0Aw8)", inline=True) localembed.add_field(name="Release Notes", value="[latest](https://github.com/PyBotDevs/isobot/releases/latest)") localembed.set_footer(text=f"Requested by {ctx.author.name}", icon_url=ctx.author.avatar) await ctx.respond(embed=localembed) diff --git a/main.py b/main.py index cb40d32..62c9793 100644 --- a/main.py +++ b/main.py @@ -129,6 +129,8 @@ async def on_ready(): s.log(f'[main/Client] Logged in as {client.user.name}. Start time: {start_time.strftime("%H:%M:%S")}\n[main/Client] Ready to accept commands. Click Ctrl+C to shut down the bot.') await client.change_presence(activity=discord.Activity(type=discord.ActivityType.playing, name="Isobot is finally back! Improved uptime!"), status=discord.Status.idle) s.log(f'[main/Log] {colors.green}Status set to IDLE. Rich presence set.{colors.end}') + + # Start and Deploy Ping Server if api.auth.get_mode() or api.auth.get_runtime_options()["ping_server_override"]: # If ping_server_override is set to true, it will start the pinging server no matter what. If it's set to false, it will only start if client mode is set to replit. s.log(f"[main/Flask] {f'{colors.yellow}Ping server override.{colors.end} ' if api.auth.get_runtime_options()['ping_server_override'] else ''}Starting pinger service...")