mirror of
https://github.com/wlinator/luminara.git
synced 2024-10-02 16:03:12 +00:00
small tweaks
This commit is contained in:
parent
2ad200532d
commit
568b6166b0
3 changed files with 6 additions and 8 deletions
|
@ -201,6 +201,7 @@
|
||||||
"info_service_footer": "Info Service",
|
"info_service_footer": "Info Service",
|
||||||
"info_system": "**System:** {0} ({1})\n",
|
"info_system": "**System:** {0} ({1})\n",
|
||||||
"info_uptime": "**Uptime:** <t:{0}:R>\n",
|
"info_uptime": "**Uptime:** <t:{0}:R>\n",
|
||||||
|
"inspirobot_author": "InspiroBot (AI Generated)",
|
||||||
"intro_content": "Introduction by {0}",
|
"intro_content": "Introduction by {0}",
|
||||||
"intro_content_footer": "Type .intro in my DMs to start",
|
"intro_content_footer": "Type .intro in my DMs to start",
|
||||||
"intro_no_channel": "the introduction channel is not set, please contact a moderator.",
|
"intro_no_channel": "the introduction channel is not set, please contact a moderator.",
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
from discord import app_commands
|
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
|
|
||||||
import lib.format
|
import lib.format
|
||||||
from lib.client import Luminara
|
from lib.client import Luminara
|
||||||
|
from lib.const import CONST
|
||||||
from lib.exceptions import LumiException
|
from lib.exceptions import LumiException
|
||||||
from ui.embeds import Builder
|
from ui.embeds import Builder
|
||||||
from wrappers.inspirobot import InspiroBot
|
from wrappers.inspirobot import InspiroBot
|
||||||
|
@ -17,9 +17,8 @@ class Inspirobot(commands.Cog):
|
||||||
name="inspirobot",
|
name="inspirobot",
|
||||||
aliases=["inspiro", "ib"],
|
aliases=["inspiro", "ib"],
|
||||||
)
|
)
|
||||||
@app_commands.describe(ephemeral="Whether to send the image ephemerally.")
|
|
||||||
@commands.is_nsfw()
|
@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.
|
Get a random AI-generated motivational image from Inspirobot.
|
||||||
|
|
||||||
|
@ -27,8 +26,6 @@ class Inspirobot(commands.Cog):
|
||||||
----------
|
----------
|
||||||
ctx : commands.Context[Luminara]
|
ctx : commands.Context[Luminara]
|
||||||
The context of the command.
|
The context of the command.
|
||||||
ephemeral : bool, optional
|
|
||||||
Whether to send the image ephemerally. Defaults to False.
|
|
||||||
"""
|
"""
|
||||||
async with ctx.typing():
|
async with ctx.typing():
|
||||||
try:
|
try:
|
||||||
|
@ -39,10 +36,10 @@ class Inspirobot(commands.Cog):
|
||||||
|
|
||||||
embed = Builder.create_embed(
|
embed = Builder.create_embed(
|
||||||
Builder.SUCCESS,
|
Builder.SUCCESS,
|
||||||
author_text="InspiroBot (AI Generated)",
|
author_text=CONST.STRINGS["inspirobot_author"],
|
||||||
image_url=image_url,
|
image_url=image_url,
|
||||||
)
|
)
|
||||||
await ctx.send(embed=embed, ephemeral=ephemeral)
|
await ctx.send(embed=embed)
|
||||||
|
|
||||||
|
|
||||||
async def setup(bot: Luminara) -> None:
|
async def setup(bot: Luminara) -> None:
|
||||||
|
|
|
@ -14,7 +14,7 @@ class InspiroBot:
|
||||||
str
|
str
|
||||||
The URL of the image.
|
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 = await client.get(self.base_url)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
return response.text
|
return response.text
|
||||||
|
|
Loading…
Reference in a new issue