feat(aurora): add [p]aurora info
command
This commit is contained in:
parent
fa8036291c
commit
6560f98aef
1 changed files with 45 additions and 3 deletions
|
@ -45,8 +45,9 @@ class Aurora(commands.Cog):
|
||||||
It is heavily inspired by GalacticBot, and is designed to be a more user-friendly alternative to Red's core Mod cogs.
|
It is heavily inspired by GalacticBot, and is designed to be a more user-friendly alternative to Red's core Mod cogs.
|
||||||
This cog stores all of its data in an SQLite database."""
|
This cog stores all of its data in an SQLite database."""
|
||||||
|
|
||||||
__author__ = ["cswimr"]
|
__author__ = ["[cswimr](https://www.coastalcommits.com/cswimr)"]
|
||||||
__version__ = "3.0.0-indev21"
|
__version__ = "3.0.0-indev22"
|
||||||
|
__git__ = "https://www.coastalcommits.com/cswimr/SeaCogs"
|
||||||
__documentation__ = "https://seacogs.coastalcommits.com/aurora/"
|
__documentation__ = "https://seacogs.coastalcommits.com/aurora/"
|
||||||
|
|
||||||
async def red_delete_data_for_user(self, *, requester, user_id: int):
|
async def red_delete_data_for_user(self, *, requester, user_id: int):
|
||||||
|
@ -91,7 +92,7 @@ class Aurora(commands.Cog):
|
||||||
n = "\n" if "\n\n" not in pre_processed else ""
|
n = "\n" if "\n\n" not in pre_processed else ""
|
||||||
text = [
|
text = [
|
||||||
f"{pre_processed}{n}",
|
f"{pre_processed}{n}",
|
||||||
f"{bold('Cog Version:')} {self.__version__}",
|
f"{bold('Cog Version:')} [{self.__version__}]({self.__git__})",
|
||||||
f"{bold('Author:')} {humanize_list(self.__author__)}",
|
f"{bold('Author:')} {humanize_list(self.__author__)}",
|
||||||
f"{bold('Documentation:')} {self.__documentation__}",
|
f"{bold('Documentation:')} {self.__documentation__}",
|
||||||
]
|
]
|
||||||
|
@ -1333,3 +1334,44 @@ class Aurora(commands.Cog):
|
||||||
await ctx.send(error("Please provide a convertible value!"))
|
await ctx.send(error("Please provide a convertible value!"))
|
||||||
return
|
return
|
||||||
await ctx.send(f"`{parsed_time}`")
|
await ctx.send(f"`{parsed_time}`")
|
||||||
|
|
||||||
|
@aurora.command(name="info")
|
||||||
|
async def aurora_info(self, ctx: commands.Context):
|
||||||
|
"""Get information about Aurora."""
|
||||||
|
embed = discord.Embed(
|
||||||
|
title="Aurora Information",
|
||||||
|
color=await self.bot.get_embed_color(ctx.channel),
|
||||||
|
timestamp=datetime.now(),
|
||||||
|
)
|
||||||
|
embed.set_thumbnail(url=self.bot.user.avatar.url)
|
||||||
|
embed.add_field(
|
||||||
|
name="Version",
|
||||||
|
value=f"[{self.__version__}](https://www.coastalcommits.com/cswimr/SeaCogs)"
|
||||||
|
)
|
||||||
|
embed.add_field(
|
||||||
|
name="Author",
|
||||||
|
value=', '.join(self.__author__)
|
||||||
|
)
|
||||||
|
if ctx.author.id in self.bot.owner_ids:
|
||||||
|
results = await Moderation.execute(query="SELECT name FROM sqlite_master WHERE type='table';", return_obj=False)
|
||||||
|
tables = [table[0] for table in results]
|
||||||
|
table_count = len(tables)
|
||||||
|
row_count = 0
|
||||||
|
|
||||||
|
for table in tables:
|
||||||
|
count_query = f"SELECT COUNT() FROM {table}"
|
||||||
|
result = await Moderation.execute(query=count_query, return_obj=False)
|
||||||
|
row_count += result[0][0]
|
||||||
|
|
||||||
|
filesize = os.path.getsize(str(data_manager.cog_data_path(cog_instance=self) / "aurora.db")) / 1024
|
||||||
|
|
||||||
|
embed.add_field(
|
||||||
|
name="Database Stats",
|
||||||
|
value=f"{bold('Table Count:')} {table_count:,}\n{bold('Row Count:')} {row_count:,}\n{bold('File Size:')} {filesize:,.0f} KB",
|
||||||
|
)
|
||||||
|
embed.add_field(
|
||||||
|
name="Moderation Types",
|
||||||
|
value=f"{len(type_registry)} registered types\n{box(', '.join(type_registry.keys()))}",
|
||||||
|
inline=False
|
||||||
|
)
|
||||||
|
await ctx.send(embed=embed)
|
||||||
|
|
Loading…
Reference in a new issue