update(command|info): add things to command

This commit is contained in:
Romain J 2019-09-15 02:31:31 +02:00
parent 7c65c92084
commit 68daf90938
6 changed files with 53 additions and 3 deletions

2
bot.py
View file

@ -43,7 +43,7 @@ class TuxBot(commands.AutoShardedBot):
super().__init__(command_prefix=_prefix_callable, pm_help=None, super().__init__(command_prefix=_prefix_callable, pm_help=None,
help_command=None, description=description, help_command=None, description=description,
help_attrs=dict(hidden=True), help_attrs=dict(hidden=True),
activity=discord.Game(name=Texts().get('Stating...'))) activity=discord.Game(name=Texts().get('Starting...')))
self.uptime: datetime = datetime.datetime.utcnow() self.uptime: datetime = datetime.datetime.utcnow()
self.config = config self.config = config

View file

@ -1,3 +1,4 @@
import os
import platform import platform
import time import time
@ -15,6 +16,12 @@ class Basics(commands.Cog):
def __init__(self, bot: TuxBot): def __init__(self, bot: TuxBot):
self.bot = bot self.bot = bot
@staticmethod
def _latest_commits():
cmd = 'git log -n 3 -s --format="[\`%h\`](https://git.gnous.eu/gnouseu/tuxbot-bot/commits/%H) %s (%cr)"'
return os.popen(cmd).read().strip()
"""---------------------------------------------------------------------""" """---------------------------------------------------------------------"""
@commands.command(name='ping') @commands.command(name='ping')
@ -33,7 +40,7 @@ class Basics(commands.Cog):
"""---------------------------------------------------------------------""" """---------------------------------------------------------------------"""
@commands.command(name='info') @commands.command(name='info', aliases=['about'])
async def _info(self, ctx: commands.Context): async def _info(self, ctx: commands.Context):
proc = psutil.Process() proc = psutil.Process()
with proc.oneshot(): with proc.oneshot():
@ -41,6 +48,12 @@ class Basics(commands.Cog):
e = discord.Embed( e = discord.Embed(
title=f"{Texts('basics').get('Information about TuxBot')}", title=f"{Texts('basics').get('Information about TuxBot')}",
color=0x89C4F9) color=0x89C4F9)
e.add_field(
name=f"__{Texts('basics').get('Latest changes')}__",
value=self._latest_commits(),
inline=False)
e.add_field( e.add_field(
name=f"__:busts_in_silhouette: " name=f"__:busts_in_silhouette: "
f"{Texts('basics').get('Development')}__", f"{Texts('basics').get('Development')}__",
@ -79,10 +92,29 @@ class Basics(commands.Cog):
inline=True inline=True
) )
e.add_field(
name=f"__{Texts('basics').get('Links')}__",
value="[tuxbot.gnous.eu](https://tuxbot.gnous.eu/) "
"| [gnous.eu](https://gnous.eu/) "
f"| [{Texts('basics').get('Invite')}](https://discordapp.com/oauth2/authorize?client_id=301062143942590465&scope=bot&permissions=268749888)",
inline=False
)
e.set_footer(text=f'version: {self.bot.version}') e.set_footer(text=f'version: {self.bot.version}')
await ctx.send(embed=e) await ctx.send(embed=e)
"""---------------------------------------------------------------------"""
@commands.command(name='credits')
async def _credits(self, ctx: commands.Context):
e = discord.Embed(
title=Texts('basics').get('Contributors'),
description=f"- **Romain#5117** https://git.gnous.eu/Romain\n"
f"- **Outout#4039** https://git.gnous.eu/mael",
color=0x89C4F9
)
def setup(bot: TuxBot): def setup(bot: TuxBot):
bot.add_cog(Basics(bot)) bot.add_cog(Basics(bot))

View file

@ -18,6 +18,9 @@ msgstr ""
msgid "Information about TuxBot" msgid "Information about TuxBot"
msgstr "" msgstr ""
msgid "Latest changes"
msgstr ""
msgid "Development" msgid "Development"
msgstr "" msgstr ""
@ -34,4 +37,10 @@ msgid "Channels count"
msgstr "" msgstr ""
msgid "Members count" msgid "Members count"
msgstr ""
msgid "Links"
msgstr ""
msgid "Invite"
msgstr "" msgstr ""

Binary file not shown.

Binary file not shown.

View file

@ -18,6 +18,9 @@ msgstr ""
msgid "Information about TuxBot" msgid "Information about TuxBot"
msgstr "Informations sur TuxBot" msgstr "Informations sur TuxBot"
msgid "Latest changes"
msgstr "Derniers changements"
msgid "Development" msgid "Development"
msgstr "Développement" msgstr "Développement"
@ -34,4 +37,10 @@ msgid "Channels count"
msgstr "Nombre de salons" msgstr "Nombre de salons"
msgid "Members count" msgid "Members count"
msgstr "Nombre de membres" msgstr "Nombre de membres"
msgid "Links"
msgstr "Liens"
msgid "Invite"
msgstr "Invitation"