From 568b6166b06dbb37b61c54249693e0b93aa5e580 Mon Sep 17 00:00:00 2001 From: wlinator Date: Sun, 22 Sep 2024 17:45:48 +0200 Subject: [PATCH] small tweaks --- locales/strings.en-US.json | 1 + modules/misc/inspirotbot.py | 11 ++++------- wrappers/inspirobot.py | 2 +- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/locales/strings.en-US.json b/locales/strings.en-US.json index 967233d..bc667a4 100644 --- a/locales/strings.en-US.json +++ b/locales/strings.en-US.json @@ -201,6 +201,7 @@ "info_service_footer": "Info Service", "info_system": "**System:** {0} ({1})\n", "info_uptime": "**Uptime:** \n", + "inspirobot_author": "InspiroBot (AI Generated)", "intro_content": "Introduction by {0}", "intro_content_footer": "Type .intro in my DMs to start", "intro_no_channel": "the introduction channel is not set, please contact a moderator.", diff --git a/modules/misc/inspirotbot.py b/modules/misc/inspirotbot.py index 92c6d0c..d1c98a1 100644 --- a/modules/misc/inspirotbot.py +++ b/modules/misc/inspirotbot.py @@ -1,8 +1,8 @@ -from discord import app_commands from discord.ext import commands import lib.format from lib.client import Luminara +from lib.const import CONST from lib.exceptions import LumiException from ui.embeds import Builder from wrappers.inspirobot import InspiroBot @@ -17,9 +17,8 @@ class Inspirobot(commands.Cog): name="inspirobot", aliases=["inspiro", "ib"], ) - @app_commands.describe(ephemeral="Whether to send the image ephemerally.") @commands.is_nsfw() - async def inspirobot(self, ctx: commands.Context[Luminara], *, ephemeral: bool = False) -> None: + async def inspirobot(self, ctx: commands.Context[Luminara]) -> None: """ Get a random AI-generated motivational image from Inspirobot. @@ -27,8 +26,6 @@ class Inspirobot(commands.Cog): ---------- ctx : commands.Context[Luminara] The context of the command. - ephemeral : bool, optional - Whether to send the image ephemerally. Defaults to False. """ async with ctx.typing(): try: @@ -39,10 +36,10 @@ class Inspirobot(commands.Cog): embed = Builder.create_embed( Builder.SUCCESS, - author_text="InspiroBot (AI Generated)", + author_text=CONST.STRINGS["inspirobot_author"], image_url=image_url, ) - await ctx.send(embed=embed, ephemeral=ephemeral) + await ctx.send(embed=embed) async def setup(bot: Luminara) -> None: diff --git a/wrappers/inspirobot.py b/wrappers/inspirobot.py index 4142f29..fb21c31 100644 --- a/wrappers/inspirobot.py +++ b/wrappers/inspirobot.py @@ -14,7 +14,7 @@ class InspiroBot: str The URL of the image. """ - async with httpx.AsyncClient() as client: + async with httpx.AsyncClient(timeout=10.0) as client: response = await client.get(self.base_url) response.raise_for_status() return response.text