Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -71,36 +71,5 @@ async def generate(ctx, *description):
|
|
71 |
image_binary.seek(0)
|
72 |
await ctx.send(file=discord.File(fp=image_binary, filename='generated_image.png'))
|
73 |
else:
|
74 |
-
await ctx.send("An error
|
75 |
-
except Exception as e:
|
76 |
-
logger.error(f"Error processing the generate command: {e}")
|
77 |
-
await ctx.send("An error occurred while processing your request.")
|
78 |
-
|
79 |
-
@generate.error
|
80 |
-
async def generate_error(ctx, error):
|
81 |
-
if isinstance(error, commands.CommandOnCooldown):
|
82 |
-
await ctx.send(f"This command is on cooldown. Please try again after {int(error.retry_after)} seconds.")
|
83 |
-
else:
|
84 |
-
logger.error(f"Error in generate command: {error}")
|
85 |
-
await ctx.send("An error occurred. Please try again later.")
|
86 |
-
|
87 |
-
@bot.command(name='setprefix')
|
88 |
-
@commands.has_permissions(administrator=True)
|
89 |
-
async def set_prefix(ctx, prefix: str):
|
90 |
-
bot.command_prefix = commands.when_mentioned_or(prefix)
|
91 |
-
await ctx.send(f"Command prefix changed to: {prefix}")
|
92 |
-
|
93 |
-
@bot.command(name='help_custom')
|
94 |
-
async def help_custom(ctx):
|
95 |
-
help_text = (
|
96 |
-
"Here are the commands you can use:\n"
|
97 |
-
"!generate <description> - Generate an image based on the description.\n"
|
98 |
-
"!setprefix <prefix> - Change the command prefix (admin only).\n"
|
99 |
-
"!help_custom - Display this help message."
|
100 |
-
)
|
101 |
-
await ctx.send(help_text)
|
102 |
-
|
103 |
-
# Run the bot
|
104 |
-
bot.run(DISCORD_TOKEN)
|
105 |
-
|
106 |
|
|
|
71 |
image_binary.seek(0)
|
72 |
await ctx.send(file=discord.File(fp=image_binary, filename='generated_image.png'))
|
73 |
else:
|
74 |
+
await ctx.send("An error occ
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
|