Hello, I’m currently in the process of creating a bot with a specific feature of generating images via a custom API. however, I’ve encountered a persistent issue AttributeError: 'InteractionResponse' object has no attribute 'send'
that appears to pervade every attempt at rectification. despite exhausting all imaginable solutions, I’m afraid my efforts have been to no avail. I’d deeply appreciate your invaluable expertise to aid me in rectifying this issue.
Code:
@_bot.tree.command(name="image", description="Generate an image based on a prompt.")
@app_commands.choices(
model=[
app_commands.Choice(name="SDXL", value="sdxl"),
app_commands.Choice(name="Kandinsky 2.2", value="kandinsky-2.2"),
app_commands.Choice(name="Kandinsky 2", value="kandinsky-2"),
app_commands.Choice(name="Dall-E", value="dall-e"),
app_commands.Choice(name="Stable Diffusion 2.1", value="stable-diffusion-2.1"),
app_commands.Choice(name="Stable Diffusion 1.5", value="stable-diffusion-1.5"),
]
)
@app_commands.choices(
size=[
app_commands.Choice(name="Small", value="256x256"),
app_commands.Choice(name="Medium", value="512x512"),
app_commands.Choice(name="Large", value="1024x1024"),
]
)
@app_commands.describe(
prompt="A prompt for the image.",
size="The size of the generated image.",
)
async def generation(
ctx: discord.Interaction,
prompt: str,
model: app_commands.Choice[str],
size: app_commands.Choice[str],
):
embed = discord.Embed(
title="Image",
description="Generate an image based on a prompt.",
color=discord.Color.from_rgb(0, 0, 200),
)
_image = conversation.image(
model.value,
size.value,
prompt,
)
_file = discord.File(
"./data/image.png",
filename="output.png",
spoiler=False,
description=prompt
)
await ctx.response.send(file=_file, embed=embed)