Ajout d'une limite à la commande find #51

This commit is contained in:
Milka64 2023-12-29 10:34:41 +01:00
parent a6a7eb07bc
commit 2d893dbda2
3 changed files with 4 additions and 4 deletions

View file

@ -6,7 +6,7 @@ stages:
variables: variables:
GL_TOKEN: $GL_TOKEN GL_TOKEN: $GL_TOKEN
VERSION: '0.2.5' VERSION: '0.2.6'
deploy: deploy:
stage: deploy stage: deploy

View file

@ -271,13 +271,13 @@ class Audio(commands.Cog, name="Commandes Audio"):
@commands.command() @commands.command()
async def find(self, ctx, query): async def find(self, ctx, query):
"""Cherche un son dans la bibliothèque""" """Cherche un son dans la bibliothèque (5 resultat max)"""
query = query.lower() query = query.lower()
audio_files = [f for f in Path(self.audio_path + '/').glob('**/*.mp3') if query in str(f).lower()] audio_files = [f for f in Path(self.audio_path + '/').glob('**/*.mp3') if query in str(f).lower()]
if not audio_files: if not audio_files:
await ctx.channel.send("%s not found" % query) await ctx.channel.send("%s not found" % query)
else: else:
for file in audio_files: for file in audio_files[:6]:
await ctx.channel.send("```"+str(file)+"```") await ctx.channel.send("```"+str(file)+"```")
@commands.command() @commands.command()

View file

@ -61,6 +61,6 @@ setup(
test_suite='tests', test_suite='tests',
tests_require=test_requirements, tests_require=test_requirements,
url='https://github.com/None/kabot', url='https://github.com/None/kabot',
version='0.2.5', version='0.2.6',
zip_safe=False, zip_safe=False,
) )