reaction emojis update (feeling good about this direction)
Browse files
app.py
CHANGED
@@ -51,6 +51,10 @@ async def deepfloydif(ctx, *, prompt: str):
|
|
51 |
|
52 |
def check_reaction(reaction, user):
|
53 |
return str(reaction.emoji) == '👍' and user == ctx.author
|
|
|
|
|
|
|
|
|
54 |
|
55 |
number_of_images = 4
|
56 |
current_time = int(time.time())
|
@@ -88,12 +92,27 @@ async def deepfloydif(ctx, *, prompt: str):
|
|
88 |
# Trigger the second stage prediction
|
89 |
#await dfif2(ctx, stage_1_result_path)
|
90 |
|
91 |
-
await ctx.reply('Here is the combined image.
|
92 |
with open(combined_image_path, 'rb') as f:
|
93 |
await ctx.send(file=discord.File(f, 'combined_image.png'))
|
94 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
reaction, user = await bot.wait_for('reaction_add', check=check_reaction)
|
96 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
|
98 |
except Exception as e:
|
99 |
print(f"Error: {e}")
|
|
|
51 |
|
52 |
def check_reaction(reaction, user):
|
53 |
return str(reaction.emoji) == '👍' and user == ctx.author
|
54 |
+
|
55 |
+
def check_reaction(reaction, user):
|
56 |
+
return user == ctx.author and str(reaction.emoji) in ['1️⃣', '2️⃣', '3️⃣', '4️⃣']
|
57 |
+
|
58 |
|
59 |
number_of_images = 4
|
60 |
current_time = int(time.time())
|
|
|
92 |
# Trigger the second stage prediction
|
93 |
#await dfif2(ctx, stage_1_result_path)
|
94 |
|
95 |
+
await ctx.reply('Here is the combined image. React with the image you want to upscale!')
|
96 |
with open(combined_image_path, 'rb') as f:
|
97 |
await ctx.send(file=discord.File(f, 'combined_image.png'))
|
98 |
|
99 |
+
# bot reacts with appropriate emojis to the post, both showing the user what options they have,
|
100 |
+
# as well as showing which post to react to.
|
101 |
+
for emoji in ['1️⃣', '2️⃣', '3️⃣', '4️⃣']:
|
102 |
+
await sent_message.add_reaction(emoji)
|
103 |
+
|
104 |
+
reaction, user = await bot.wait_for('reaction_add', check=check_reaction)
|
105 |
+
await ctx.send(f"{user.mention} reacted with a thumbs-up!")
|
106 |
+
|
107 |
reaction, user = await bot.wait_for('reaction_add', check=check_reaction)
|
108 |
+
if str(reaction.emoji) == '1️⃣':
|
109 |
+
await ctx.send("You want the first image!")
|
110 |
+
elif str(reaction.emoji) == '2️⃣':
|
111 |
+
await ctx.send("You want the second image!")
|
112 |
+
elif str(reaction.emoji) == '3️⃣':
|
113 |
+
await ctx.send("You want the third image!")
|
114 |
+
elif str(reaction.emoji) == '4️⃣':
|
115 |
+
await ctx.send("You want the fourth image!")
|
116 |
|
117 |
except Exception as e:
|
118 |
print(f"Error: {e}")
|