1
Fork 0
mirror of https://github.com/wlinator/luminara.git synced 2024-10-02 14:23:12 +00:00

small tweaks

This commit is contained in:
wlinator 2024-09-22 17:45:48 +02:00
parent 2ad200532d
commit 568b6166b0
3 changed files with 6 additions and 8 deletions

View file

@ -201,6 +201,7 @@
"info_service_footer": "Info Service",
"info_system": "**System:** {0} ({1})\n",
"info_uptime": "**Uptime:** <t:{0}:R>\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.",

View file

@ -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:

View file

@ -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