Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -45,7 +45,7 @@ async def on_ready():
|
|
45 |
|
46 |
@bot.command(name='generate')
|
47 |
@commands.cooldown(rate=1, per=10, type=commands.BucketType.user)
|
48 |
-
async def generate(ctx,
|
49 |
"""
|
50 |
Command to generate an image based on a description using the Hugging Face model.
|
51 |
"""
|
@@ -53,7 +53,6 @@ async def generate(ctx, *description):
|
|
53 |
await ctx.send("You need to provide a description for the image.")
|
54 |
return
|
55 |
|
56 |
-
description = " ".join(description)
|
57 |
try:
|
58 |
payload = {"inputs": description}
|
59 |
image_bytes = query(payload)
|
@@ -82,7 +81,19 @@ async def generate_error(ctx, error):
|
|
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.
|
86 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
|
88 |
|
|
|
45 |
|
46 |
@bot.command(name='generate')
|
47 |
@commands.cooldown(rate=1, per=10, type=commands.BucketType.user)
|
48 |
+
async def generate(ctx, *, description: str):
|
49 |
"""
|
50 |
Command to generate an image based on a description using the Hugging Face model.
|
51 |
"""
|
|
|
53 |
await ctx.send("You need to provide a description for the image.")
|
54 |
return
|
55 |
|
|
|
56 |
try:
|
57 |
payload = {"inputs": description}
|
58 |
image_bytes = query(payload)
|
|
|
81 |
@commands.has_permissions(administrator=True)
|
82 |
async def set_prefix(ctx, prefix: str):
|
83 |
bot.command_prefix = commands.when_mentioned_or(prefix)
|
84 |
+
await ctx.send(f"Command prefix changed to: {prefix}")
|
85 |
|
86 |
+
@bot.command(name='help_custom')
|
87 |
+
async def help_custom(ctx):
|
88 |
+
help_text = (
|
89 |
+
"Here are the commands you can use:\n"
|
90 |
+
"!generate <description> - Generate an image based on the description.\n"
|
91 |
+
"!setprefix <prefix> - Change the command prefix (admin only).\n"
|
92 |
+
"!help_custom - Display this help message."
|
93 |
+
)
|
94 |
+
await ctx.send(help_text)
|
95 |
+
|
96 |
+
# Run the bot
|
97 |
+
bot.run(DISCORD_TOKEN)
|
98 |
|
99 |
|