From 7cdef7dab49b46806df2116e496d0eb069a14b43 Mon Sep 17 00:00:00 2001 From: jiliby Date: Mon, 30 Jan 2023 16:24:34 +0200 Subject: [PATCH 1/2] ffmpeg is no longer used --- .gitignore | 3 --- 1 file changed, 3 deletions(-) diff --git a/.gitignore b/.gitignore index 97682c5..bb6765c 100644 --- a/.gitignore +++ b/.gitignore @@ -5,9 +5,6 @@ todo.txt .env __pycache__ -ffmpeg.exe -ffplay.exe -ffprobe.exe *.db *.jpg *.stats \ No newline at end of file -- GitLab From c31b93377effe4305a2d424916533316062d9545 Mon Sep 17 00:00:00 2001 From: jiliby Date: Tue, 31 Jan 2023 15:52:44 +0200 Subject: [PATCH 2/2] fix "sauce" command --- cogs/other/other.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/cogs/other/other.py b/cogs/other/other.py index 4635a02..1f2e043 100644 --- a/cogs/other/other.py +++ b/cogs/other/other.py @@ -9,6 +9,7 @@ from utils.messages import something_went_wrong import requests import urllib.parse from setup import COLOR +from typing import Optional random.seed() @@ -137,24 +138,25 @@ class Other(commands.Cog): await ctx.send(":coin: Решка!") @commands.command(pass_context=True, aliases=["соус"]) - async def sauce(self, ctx: commands.Context, link: str = None, similarity: int = 75): + async def sauce(self, ctx: commands.Context, link: Optional[str], similarity: Optional[int] = 75): """ Ищем соус картинки, точность по умолчанию 75% (картинку можно просто прилепить к сообщению или по url) """ source = None file = ctx.message.attachments - if len(file) == 0: + if len(file) == 0: # if the message doesn't contain any attachments if link is None: - await ctx.reply("А где картинка то?", mention_author=True, delete_after=15) await ctx.message.delete(delay=15) + return await ctx.reply("А где картинка то?", mention_author=True, delete_after=15) url = link else: url = file[0].url - if link is not None: - similarity = link + if link is not None: # if image is message attachment + similarity = link # try to use first arg as search similarity + try: - similarity = float(similarity) + similarity = int(similarity) # if similarity is not int except ValueError: return await ctx.reply(":warning: Неверно указана точность поиска.") -- GitLab