update(command|info): add git to link's field

This commit is contained in:
Romain J 2019-12-16 19:36:55 +01:00
commit d5afdcc60b
9 changed files with 51 additions and 20 deletions

View file

@ -372,9 +372,9 @@ class Admin(commands.Cog):
@_warn.command(name='remove', aliases=['revoke'])
async def _warn_remove(self, ctx: commands.Context, warn_id: int):
warn = self.bot.database.session\
.query(Warn)\
.filter(Warn.id == warn_id)\
warn = self.bot.database.session \
.query(Warn) \
.filter(Warn.id == warn_id) \
.one()
self.bot.database.session.delete(warn)
@ -395,9 +395,9 @@ class Admin(commands.Cog):
@_warn.command(name='edit', aliases=['change'])
async def _warn_edit(self, ctx: commands.Context, warn_id: int, *, reason):
warn = self.bot.database.session\
.query(Warn)\
.filter(Warn.id == warn_id)\
warn = self.bot.database.session \
.query(Warn) \
.filter(Warn.id == warn_id) \
.one()
warn.reason = reason
@ -413,8 +413,8 @@ class Admin(commands.Cog):
available = self.bot.database.session \
.query(Lang.value) \
.filter(Lang.key == 'available') \
.one()[0] \
.split(', ')
.first()[0] \
.split(',')
if locale.lower() not in available:
await ctx.send(

View file

@ -10,6 +10,7 @@ from discord.ext import commands
from bot import TuxBot
from .utils.lang import Texts
from .utils.extra import commandExtra, groupExtra
from tcp_latency import measure_latency
@ -26,7 +27,9 @@ class Basics(commands.Cog):
"""---------------------------------------------------------------------"""
@commands.command(name='ping')
@commandExtra(name='ping',
category='basics',
description=Texts('commands').get('basics.ping'))
async def _ping(self, ctx: commands.Context):
start = time.perf_counter()
await ctx.trigger_typing()
@ -64,7 +67,9 @@ class Basics(commands.Cog):
return total, file_amount
@commands.command(name='info', aliases=['about'])
@commands.command(name='info', aliases=['about'],
category='basics',
description=Texts('commands').get('basics.info'))
async def _info(self, ctx: commands.Context):
proc = psutil.Process()
lines, files = self.fetch_info()
@ -133,6 +138,7 @@ class Basics(commands.Cog):
name=f"__:link: {Texts('basics', ctx).get('Links')}__",
value="[tuxbot.gnous.eu](https://tuxbot.gnous.eu/) "
"| [gnous.eu](https://gnous.eu/) "
"| [git](https://git.gnous.eu/gnouseu/tuxbot-bot) "
f"| [{Texts('basics', ctx).get('Invite')}](https://discordapp.com/oauth2/authorize?client_id=301062143942590465&scope=bot&permissions=268749888)",
inline=False
)
@ -144,7 +150,9 @@ class Basics(commands.Cog):
"""---------------------------------------------------------------------"""
@commands.command(name='credits', aliases=['contributors', 'authors'])
@commands.command(name='credits', aliases=['contributors', 'authors'],
category='basics',
description=Texts('commands').get('basics.credits'))
async def _credits(self, ctx: commands.Context):
e = discord.Embed(
title=Texts('basics', ctx).get('Contributors'),

21
cogs/utils/extra.py Normal file
View file

@ -0,0 +1,21 @@
from discord.ext import commands
class commandsPlus(commands.Command):
def __init__(self, func, **kwargs):
super().__init__(func, **kwargs)
self.category = kwargs.pop("category")
def commandExtra(*args, **kwargs):
return commands.command(*args, **kwargs, cls=commandsPlus)
class GroupPlus(commands.Group):
def __init__(self, func, **kwargs):
super().__init__(func, **kwargs)
self.category = kwargs.pop("category")
def groupExtra(*args, **kwargs):
return commands.group(*args, **kwargs, cls=GroupPlus)