fix(commands:info|Utils): undo testings changes

This commit is contained in:
Romain J 2021-04-22 00:22:09 +02:00
parent 561f56ca27
commit 9172331927
2 changed files with 96 additions and 94 deletions

View file

@ -134,7 +134,7 @@ To update the whole bot after a :bash:`git pull`, just execute
$ make update $ make update
.. |image0| image:: https://img.shields.io/badge/python-3.9%20%7C%203.10-%23007ec6 .. |image0| image:: https://img.shields.io/badge/python-3.10-%23007ec6
.. |image1| image:: https://img.shields.io/github/issues/Rom1-J/tuxbot-bot .. |image1| image:: https://img.shields.io/github/issues/Rom1-J/tuxbot-bot
.. |image2| image:: https://img.shields.io/badge/code%20style-black-000000.svg .. |image2| image:: https://img.shields.io/badge/code%20style-black-000000.svg
.. |image3| image:: https://wakatime.com/badge/github/Rom1-J/tuxbot-bot.svg .. |image3| image:: https://wakatime.com/badge/github/Rom1-J/tuxbot-bot.svg

View file

@ -29,108 +29,110 @@ class Utils(commands.Cog):
@command_extra(name="info", aliases=["about"]) @command_extra(name="info", aliases=["about"])
async def _info(self, ctx: ContextPlus): async def _info(self, ctx: ContextPlus):
proc = psutil.Process()
infos = fetch_info() infos = fetch_info()
mem = psutil.Process().memory_full_info() with proc.oneshot():
cpu = psutil.cpu_percent() mem = proc.memory_full_info()
cpu = proc.cpu_percent() / psutil.cpu_count()
e = discord.Embed( e = discord.Embed(
title=_("Information about TuxBot", ctx, self.bot.config), title=_("Information about TuxBot", ctx, self.bot.config),
color=0x89C4F9, color=0x89C4F9,
) )
e.add_field( e.add_field(
name=_( name=_(
"__:busts_in_silhouette: Development__", "__:busts_in_silhouette: Development__",
ctx, ctx,
self.bot.config, self.bot.config,
), ),
value="**Romain#5117:** [git](https://git.gnous.eu/Romain)\n" value="**Romain#5117:** [git](https://git.gnous.eu/Romain)\n"
"**Outout#4039:** [git](https://git.gnous.eu/mael)\n", "**Outout#4039:** [git](https://git.gnous.eu/mael)\n",
inline=True, inline=True,
) )
e.add_field( e.add_field(
name="__<:python:596577462335307777> Python__", name="__<:python:596577462335307777> Python__",
value=f"**python** `{platform.python_version()}`\n" value=f"**python** `{platform.python_version()}`\n"
f"**discord.py** `{discord.__version__}`", f"**discord.py** `{discord.__version__}`",
inline=True, inline=True,
) )
e.add_field( e.add_field(
name="__:gear: Usage__", name="__:gear: Usage__",
value=_( value=_(
"**{}** physical memory\n" "**{}** physical memory\n"
"**{}** virtual memory\n" "**{}** virtual memory\n"
"**{:.2f}**% CPU", "**{:.2f}**% CPU",
ctx, ctx,
self.bot.config, self.bot.config,
).format( ).format(
humanize.naturalsize(mem.rss), humanize.naturalsize(mem.rss),
humanize.naturalsize(mem.vms), humanize.naturalsize(mem.vms),
cpu, cpu,
), ),
inline=True, inline=True,
) )
e.add_field( e.add_field(
name=_("__Servers count__", ctx, self.bot.config), name=_("__Servers count__", ctx, self.bot.config),
value=str(len(self.bot.guilds)), value=str(len(self.bot.guilds)),
inline=True, inline=True,
) )
e.add_field( e.add_field(
name=_("__Channels count__", ctx, self.bot.config), name=_("__Channels count__", ctx, self.bot.config),
value=str(len(list(self.bot.get_all_channels()))), value=str(len(list(self.bot.get_all_channels()))),
inline=True, inline=True,
) )
e.add_field( e.add_field(
name=_("__Members count__", ctx, self.bot.config), name=_("__Members count__", ctx, self.bot.config),
value=str(len(list(self.bot.get_all_members()))), value=str(len(list(self.bot.get_all_members()))),
inline=True, inline=True,
) )
e.add_field( e.add_field(
name=_("__:file_folder: Files__", ctx, self.bot.config), name=_("__:file_folder: Files__", ctx, self.bot.config),
value=f"{infos.get('file_amount')} " value=f"{infos.get('file_amount')} "
f"*({infos.get('python_file_amount')}" f"*({infos.get('python_file_amount')}"
f" <:python:596577462335307777>)*", f" <:python:596577462335307777>)*",
inline=True, inline=True,
) )
e.add_field( e.add_field(
name=_("__¶ Lines__", ctx, self.bot.config), name=_("__¶ Lines__", ctx, self.bot.config),
value=f"{infos.get('total_lines')} " value=f"{infos.get('total_lines')} "
f"*({infos.get('total_python_class')} " f"*({infos.get('total_python_class')} "
+ _("class", ctx, self.bot.config) + _("class", ctx, self.bot.config)
+ "," + ","
f" {infos.get('total_python_functions')} " f" {infos.get('total_python_functions')} "
+ _("functions", ctx, self.bot.config) + _("functions", ctx, self.bot.config)
+ "," + ","
f" {infos.get('total_python_coroutines')} " f" {infos.get('total_python_coroutines')} "
+ _("coroutines", ctx, self.bot.config) + _("coroutines", ctx, self.bot.config)
+ "," + ","
f" {infos.get('total_python_comments')} " f" {infos.get('total_python_comments')} "
+ _("comments", ctx, self.bot.config) + _("comments", ctx, self.bot.config)
+ ")*", + ")*",
inline=True, inline=True,
) )
e.add_field( e.add_field(
name=_("__Latest changes__", ctx, self.bot.config), name=_("__Latest changes__", ctx, self.bot.config),
value=version_info.info, value=version_info.info,
inline=False, inline=False,
) )
e.add_field( e.add_field(
name=_("__:link: Links__", ctx, self.bot.config), name=_("__:link: Links__", ctx, self.bot.config),
value="[tuxbot.gnous.eu](https://tuxbot.gnous.eu/) " value="[tuxbot.gnous.eu](https://tuxbot.gnous.eu/) "
"| [gnous.eu](https://gnous.eu/) " "| [gnous.eu](https://gnous.eu/) "
"| [git](https://git.gnous.eu/gnouseu/tuxbot-bot) " "| [git](https://git.gnous.eu/gnouseu/tuxbot-bot) "
"| [status](https://status.gnous.eu/check/154250) " "| [status](https://status.gnous.eu/check/154250) "
+ _("| [Invite]", ctx, self.bot.config) + _("| [Invite]", ctx, self.bot.config)
+ "(https://discordapp.com/oauth2/authorize?client_id=" + "(https://discordapp.com/oauth2/authorize?client_id="
"301062143942590465&scope=bot&permissions=268749888)", "301062143942590465&scope=bot&permissions=268749888)",
inline=False, inline=False,
) )
e.set_footer(text=f"version: {__version__} • prefix: {ctx.prefix}") e.set_footer(text=f"version: {__version__} • prefix: {ctx.prefix}")
await ctx.send(embed=e) await ctx.send(embed=e)