[decorators] moving magic, more jojo
Browse files
app.py
CHANGED
@@ -50,10 +50,11 @@ async def jojo(ctx):
|
|
50 |
|
51 |
if ctx.message.attachments:
|
52 |
attachment = ctx.message.attachments[0]
|
53 |
-
|
54 |
-
|
|
|
55 |
else:
|
56 |
-
await
|
57 |
#----------------------------------------------------------------------------------------------------------------------------------------------
|
58 |
# Stage 1
|
59 |
@bot.command()
|
@@ -172,22 +173,26 @@ async def on_reaction_add(reaction, user):
|
|
172 |
#index = 0 decided by index in front of partialpath
|
173 |
|
174 |
|
175 |
-
|
176 |
-
attachment = reaction.message.attachments[0]
|
177 |
-
image_name = attachment.filename
|
178 |
-
# we know image_name will be something like 1tmpgtv4qjix.png
|
179 |
-
# remove .png first
|
180 |
-
indexpartialpath = image_name[:-4] # should be 1tmpgtv4qjix
|
181 |
-
# extract index as an integer (dfif2 needs integer)
|
182 |
-
index = int(indexpartialpath[0]) - 1# should be 1
|
183 |
-
# extract partialpath
|
184 |
-
partialpath = indexpartialpath[1:] # should be tmpgtv4qjix
|
185 |
-
# add /tmp/ to partialpath, save as new variable
|
186 |
-
fullpath = "/tmp/" + partialpath # should be /tmp/tmpgtv4qjix
|
187 |
|
188 |
if emoji == 'π':
|
189 |
if reaction.message.attachments:
|
190 |
if user.id == reaction.message.mentions[0].id: # all we care about is upscaling whatever image this is
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
191 |
stage_1_result_path = fullpath
|
192 |
index = index
|
193 |
await dfif2(index, stage_1_result_path, thread)
|
|
|
50 |
|
51 |
if ctx.message.attachments:
|
52 |
attachment = ctx.message.attachments[0]
|
53 |
+
style = 'JoJo'
|
54 |
+
im = jojogan.predict(attachment.url, style)
|
55 |
+
await message.reply(f'Here is the {style} version of it', file=discord.File(im))
|
56 |
else:
|
57 |
+
await message.channel.send("No attachments to be found...Can't animify dat! Try sending me an image π")
|
58 |
#----------------------------------------------------------------------------------------------------------------------------------------------
|
59 |
# Stage 1
|
60 |
@bot.command()
|
|
|
173 |
#index = 0 decided by index in front of partialpath
|
174 |
|
175 |
|
176 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
177 |
|
178 |
if emoji == 'π':
|
179 |
if reaction.message.attachments:
|
180 |
if user.id == reaction.message.mentions[0].id: # all we care about is upscaling whatever image this is
|
181 |
+
|
182 |
+
# magic begins
|
183 |
+
attachment = reaction.message.attachments[0]
|
184 |
+
image_name = attachment.filename
|
185 |
+
# we know image_name will be something like 1tmpgtv4qjix.png
|
186 |
+
# remove .png first
|
187 |
+
indexpartialpath = image_name[:-4] # should be 1tmpgtv4qjix
|
188 |
+
# extract index as an integer (dfif2 needs integer)
|
189 |
+
index = int(indexpartialpath[0]) - 1# should be 1
|
190 |
+
# extract partialpath
|
191 |
+
partialpath = indexpartialpath[1:] # should be tmpgtv4qjix
|
192 |
+
# add /tmp/ to partialpath, save as new variable
|
193 |
+
fullpath = "/tmp/" + partialpath # should be /tmp/tmpgtv4qjix
|
194 |
+
|
195 |
+
|
196 |
stage_1_result_path = fullpath
|
197 |
index = index
|
198 |
await dfif2(index, stage_1_result_path, thread)
|