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