enforcing 1 channel per space
Browse files
app.py
CHANGED
@@ -88,8 +88,12 @@ async def safetychecks(ctx):
|
|
88 |
|
89 |
#β
β
check if the command is in the allowed channel(s)
|
90 |
bot_test = 1100458786826747945
|
91 |
-
|
92 |
-
|
|
|
|
|
|
|
|
|
93 |
if ctx.channel.id not in channel_ids:
|
94 |
print(f"{ctx.author}, commands are not permitted in {ctx.channel}")
|
95 |
thread = await ctx.message.create_thread(name=f'Channel Error')
|
@@ -187,28 +191,29 @@ async def jojo(ctx):
|
|
187 |
# safety checks?β
|
188 |
# bot no crash β
|
189 |
try:
|
190 |
-
if await safetychecks(ctx): #β
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
|
|
212 |
except Exception as e: # no generation / img + no face
|
213 |
await fullqueue(e, thread)
|
214 |
print(f"Error: {e}")
|
@@ -224,22 +229,23 @@ async def jojo(ctx):
|
|
224 |
async def spidey(ctx):
|
225 |
try:
|
226 |
if await safetychecks(ctx): #β
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
|
|
243 |
except Exception as e: # no generation / img + no face
|
244 |
await fullqueue(e, thread)
|
245 |
print(f"Error: {e}")
|
@@ -253,22 +259,23 @@ async def spidey(ctx):
|
|
253 |
async def sketch(ctx):
|
254 |
try:
|
255 |
if await safetychecks(ctx): #β
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
|
|
272 |
except Exception as e: # no generation / img + no face
|
273 |
await fullqueue(e, thread)
|
274 |
print(f"Error: {e}")
|
@@ -324,23 +331,24 @@ async def deepfloydif(ctx, *, prompt: str):
|
|
324 |
try:
|
325 |
try:
|
326 |
if await safetychecks(ctx): #β
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
|
|
344 |
|
345 |
except Exception as e:
|
346 |
print(f"Error: {e}")
|
|
|
88 |
|
89 |
#β
β
check if the command is in the allowed channel(s)
|
90 |
bot_test = 1100458786826747945
|
91 |
+
deepfloydif_channel = 1113182673859518514
|
92 |
+
jojo_channel = 1114217739473649764
|
93 |
+
sketch_channel = 1114218145343877180
|
94 |
+
spidey_channel = 1114218191594471514
|
95 |
+
|
96 |
+
channel_ids = [bot_test, deepfloydif_channel, jojo_channel, spidey_channel, sketch_channel]
|
97 |
if ctx.channel.id not in channel_ids:
|
98 |
print(f"{ctx.author}, commands are not permitted in {ctx.channel}")
|
99 |
thread = await ctx.message.create_thread(name=f'Channel Error')
|
|
|
191 |
# safety checks?β
|
192 |
# bot no crash β
|
193 |
try:
|
194 |
+
if await safetychecks(ctx): #β
|
195 |
+
if ctx.channel.id == 1114217739473649764:
|
196 |
+
await ctx.message.add_reaction('<a:loading:1114111677990981692>')
|
197 |
+
thread = await ctx.message.create_thread(name=f'Jojo | {ctx.author}', auto_archive_duration=60)
|
198 |
+
if ctx.message.attachments:
|
199 |
+
await thread.send(f'{ctx.author.mention} Generating images in thread, can take ~1 minute...yare yare, daze ...')
|
200 |
+
attachment = ctx.message.attachments[0]
|
201 |
+
style = 'JoJo'
|
202 |
+
#im = jojogan.predict(attachment.url, style)
|
203 |
+
im = await asyncio.get_running_loop().run_in_executor(None, jojogan.predict, attachment.url, style)
|
204 |
+
#await ctx.message.reply(f'Here is the {style} version of it', file=discord.File(im))
|
205 |
+
await thread.send(f'{ctx.author.mention} Here is the {style} version of it', file=discord.File(im))
|
206 |
+
|
207 |
+
#testing animated
|
208 |
+
# <a:hugging_spin:1102656012621713488>
|
209 |
+
await ctx.message.add_reaction('<:agree:1098629085955113011>') # β
|
210 |
+
await ctx.message.remove_reaction('<a:loading:1114111677990981692>', bot.user)
|
211 |
+
await thread.edit(archived=True)
|
212 |
+
else: # no image
|
213 |
+
await thread.send(f"{ctx.author.mention} No attachments to be found...Can't animify dat! Try sending me an image π")
|
214 |
+
await ctx.message.add_reaction('<:disagree:1098628957521313892>') # β
|
215 |
+
await ctx.message.remove_reaction('<a:loading:1114111677990981692>', bot.user)
|
216 |
+
await thread.edit(archived=True)
|
217 |
except Exception as e: # no generation / img + no face
|
218 |
await fullqueue(e, thread)
|
219 |
print(f"Error: {e}")
|
|
|
229 |
async def spidey(ctx):
|
230 |
try:
|
231 |
if await safetychecks(ctx): #β
|
232 |
+
if ctx.channel.id == 1114218191594471514:
|
233 |
+
await ctx.message.add_reaction('<a:loading:1114111677990981692>')
|
234 |
+
thread = await ctx.message.create_thread(name=f'Spider-verse | {ctx.author}', auto_archive_duration=60)
|
235 |
+
if ctx.message.attachments:
|
236 |
+
await thread.send(f'{ctx.author.mention} Generating images in thread, can take ~1 minute...')
|
237 |
+
attachment = ctx.message.attachments[0]
|
238 |
+
style = 'Spider-Verse'
|
239 |
+
im = await asyncio.get_running_loop().run_in_executor(None, jojogan.predict, attachment.url, style)
|
240 |
+
await thread.send(f'{ctx.author.mention} Here is the {style} version of it', file=discord.File(im))
|
241 |
+
await ctx.message.add_reaction('<:agree:1098629085955113011>') # img + face
|
242 |
+
await ctx.message.remove_reaction('<a:loading:1114111677990981692>', bot.user)
|
243 |
+
await thread.edit(archived=True)
|
244 |
+
else: # no image
|
245 |
+
await thread.send(f"{ctx.author.mention} No attachments to be found...Can't animify dat! Try sending me an image π")
|
246 |
+
await ctx.message.add_reaction('<:disagree:1098628957521313892>')
|
247 |
+
await ctx.message.remove_reaction('<a:loading:1114111677990981692>', bot.user)
|
248 |
+
await thread.edit(archived=True)
|
249 |
except Exception as e: # no generation / img + no face
|
250 |
await fullqueue(e, thread)
|
251 |
print(f"Error: {e}")
|
|
|
259 |
async def sketch(ctx):
|
260 |
try:
|
261 |
if await safetychecks(ctx): #β
|
262 |
+
if ctx.channel.id == 1114218145343877180:
|
263 |
+
await ctx.message.add_reaction('<a:loading:1114111677990981692>')
|
264 |
+
thread = await ctx.message.create_thread(name=f'Sketch | {ctx.author}', auto_archive_duration=60)
|
265 |
+
if ctx.message.attachments:
|
266 |
+
await thread.send(f'{ctx.author.mention} Generating images in thread, can take ~1 minute...')
|
267 |
+
attachment = ctx.message.attachments[0]
|
268 |
+
#style = 'sketch'
|
269 |
+
im = await asyncio.get_running_loop().run_in_executor(None, jojogan.predict, attachment.url, 'sketch')
|
270 |
+
await thread.send(f'{ctx.author.mention} Here is the sketch version of it', file=discord.File(im))
|
271 |
+
await ctx.message.add_reaction('<:agree:1098629085955113011>') # img + face
|
272 |
+
await ctx.message.remove_reaction('<a:loading:1114111677990981692>', bot.user)
|
273 |
+
await thread.edit(archived=True)
|
274 |
+
else: # no image
|
275 |
+
await thread.send(f"{ctx.author.mention} No attachments to be found...Can't animify dat! Try sending me an image π")
|
276 |
+
await ctx.message.add_reaction('<:disagree:1098628957521313892>')
|
277 |
+
await ctx.message.remove_reaction('<a:loading:1114111677990981692>', bot.user)
|
278 |
+
await thread.edit(archived=True)
|
279 |
except Exception as e: # no generation / img + no face
|
280 |
await fullqueue(e, thread)
|
281 |
print(f"Error: {e}")
|
|
|
331 |
try:
|
332 |
try:
|
333 |
if await safetychecks(ctx): #β
|
334 |
+
if ctx.channel.id == 1113182673859518514:
|
335 |
+
await ctx.message.add_reaction('<a:loading:1114111677990981692>')
|
336 |
+
dfif_command_message_id = ctx.message.id # we will use this in some magic later on
|
337 |
+
thread = await ctx.message.create_thread(name=f'DeepfloydIF | {prompt}', auto_archive_duration=60) # could also just use prompt, no deepfloydif
|
338 |
+
# create thread -> send new message inside thread + combined_image -> add reactions -> dfif2
|
339 |
+
|
340 |
+
#current_time = int(time.time())
|
341 |
+
#random.seed(current_time)
|
342 |
+
|
343 |
+
negative_prompt = ''
|
344 |
+
seed = random.randint(0, 1000)
|
345 |
+
#seed = 1
|
346 |
+
number_of_images = 4
|
347 |
+
guidance_scale = 7
|
348 |
+
custom_timesteps_1 = 'smart50'
|
349 |
+
number_of_inference_steps = 50
|
350 |
+
api_name = '/generate64'
|
351 |
+
await thread.send(f'{ctx.author.mention}Generating images in thread, can take ~1 minute...')
|
352 |
|
353 |
except Exception as e:
|
354 |
print(f"Error: {e}")
|