Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -60,8 +60,10 @@ async def generate(ctx, *description):
|
|
60 |
|
61 |
if image_bytes:
|
62 |
image = Image.open(io.BytesIO(image_bytes))
|
63 |
-
|
64 |
-
|
|
|
|
|
65 |
else:
|
66 |
await ctx.send("An error occurred while generating the image.")
|
67 |
except Exception as e:
|
@@ -80,19 +82,7 @@ async def generate_error(ctx, error):
|
|
80 |
@commands.has_permissions(administrator=True)
|
81 |
async def set_prefix(ctx, prefix: str):
|
82 |
bot.command_prefix = commands.when_mentioned_or(prefix)
|
83 |
-
await ctx.
|
84 |
|
85 |
-
@bot.command(name='help_custom')
|
86 |
-
async def help_custom(ctx):
|
87 |
-
help_text = (
|
88 |
-
"Here are the commands you can use:\n"
|
89 |
-
"!generate <description> - Generate an image based on the description.\n"
|
90 |
-
"!setprefix <prefix> - Change the command prefix (admin only).\n"
|
91 |
-
"!help_custom - Display this help message."
|
92 |
-
)
|
93 |
-
await ctx.send(help_text)
|
94 |
-
|
95 |
-
# Run the bot
|
96 |
-
bot.run(DISCORD_TOKEN)
|
97 |
|
98 |
|
|
|
60 |
|
61 |
if image_bytes:
|
62 |
image = Image.open(io.BytesIO(image_bytes))
|
63 |
+
image_path = "generated_image.png"
|
64 |
+
image.save(image_path)
|
65 |
+
await ctx.send(file=discord.File(image_path))
|
66 |
+
os.remove(image_path) # Clean up the file after sending
|
67 |
else:
|
68 |
await ctx.send("An error occurred while generating the image.")
|
69 |
except Exception as e:
|
|
|
82 |
@commands.has_permissions(administrator=True)
|
83 |
async def set_prefix(ctx, prefix: str):
|
84 |
bot.command_prefix = commands.when_mentioned_or(prefix)
|
85 |
+
await ctx.sen
|
86 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
|
88 |
|