lunarflu HF Staff commited on
Commit
aee814d
Β·
1 Parent(s): 00a4c25

enforcing 1 channel per space

Browse files
Files changed (1) hide show
  1. app.py +81 -73
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
- testing_the_bot = 1113182673859518514
92
- channel_ids = [bot_test, testing_the_bot]
 
 
 
 
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
- await ctx.message.add_reaction('<a:loading:1114111677990981692>')
192
- thread = await ctx.message.create_thread(name=f'Jojo | {ctx.author}', auto_archive_duration=60)
193
- if ctx.message.attachments:
194
- await thread.send(f'{ctx.author.mention} Generating images in thread, can take ~1 minute...yare yare, daze ...')
195
- attachment = ctx.message.attachments[0]
196
- style = 'JoJo'
197
- #im = jojogan.predict(attachment.url, style)
198
- im = await asyncio.get_running_loop().run_in_executor(None, jojogan.predict, attachment.url, style)
199
- #await ctx.message.reply(f'Here is the {style} version of it', file=discord.File(im))
200
- await thread.send(f'{ctx.author.mention} Here is the {style} version of it', file=discord.File(im))
201
-
202
- #testing animated
203
- # <a:hugging_spin:1102656012621713488>
204
- await ctx.message.add_reaction('<:agree:1098629085955113011>') # βœ…
205
- await ctx.message.remove_reaction('<a:loading:1114111677990981692>', bot.user)
206
- await thread.edit(archived=True)
207
- else: # no image
208
- await thread.send(f"{ctx.author.mention} No attachments to be found...Can't animify dat! Try sending me an image πŸ˜‰")
209
- await ctx.message.add_reaction('<:disagree:1098628957521313892>') # ❌
210
- await ctx.message.remove_reaction('<a:loading:1114111677990981692>', bot.user)
211
- await thread.edit(archived=True)
 
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
- await ctx.message.add_reaction('<a:loading:1114111677990981692>')
228
- thread = await ctx.message.create_thread(name=f'Spider-verse | {ctx.author}', auto_archive_duration=60)
229
- if ctx.message.attachments:
230
- await thread.send(f'{ctx.author.mention} Generating images in thread, can take ~1 minute...')
231
- attachment = ctx.message.attachments[0]
232
- style = 'Spider-Verse'
233
- im = await asyncio.get_running_loop().run_in_executor(None, jojogan.predict, attachment.url, style)
234
- await thread.send(f'{ctx.author.mention} Here is the {style} version of it', file=discord.File(im))
235
- await ctx.message.add_reaction('<:agree:1098629085955113011>') # img + face
236
- await ctx.message.remove_reaction('<a:loading:1114111677990981692>', bot.user)
237
- await thread.edit(archived=True)
238
- else: # no image
239
- await thread.send(f"{ctx.author.mention} No attachments to be found...Can't animify dat! Try sending me an image πŸ˜‰")
240
- await ctx.message.add_reaction('<:disagree:1098628957521313892>')
241
- await ctx.message.remove_reaction('<a:loading:1114111677990981692>', bot.user)
242
- await thread.edit(archived=True)
 
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
- await ctx.message.add_reaction('<a:loading:1114111677990981692>')
257
- thread = await ctx.message.create_thread(name=f'Sketch | {ctx.author}', auto_archive_duration=60)
258
- if ctx.message.attachments:
259
- await thread.send(f'{ctx.author.mention} Generating images in thread, can take ~1 minute...')
260
- attachment = ctx.message.attachments[0]
261
- #style = 'sketch'
262
- im = await asyncio.get_running_loop().run_in_executor(None, jojogan.predict, attachment.url, 'sketch')
263
- await thread.send(f'{ctx.author.mention} Here is the sketch version of it', file=discord.File(im))
264
- await ctx.message.add_reaction('<:agree:1098629085955113011>') # img + face
265
- await ctx.message.remove_reaction('<a:loading:1114111677990981692>', bot.user)
266
- await thread.edit(archived=True)
267
- else: # no image
268
- await thread.send(f"{ctx.author.mention} No attachments to be found...Can't animify dat! Try sending me an image πŸ˜‰")
269
- await ctx.message.add_reaction('<:disagree:1098628957521313892>')
270
- await ctx.message.remove_reaction('<a:loading:1114111677990981692>', bot.user)
271
- await thread.edit(archived=True)
 
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
- await ctx.message.add_reaction('<a:loading:1114111677990981692>')
328
- dfif_command_message_id = ctx.message.id # we will use this in some magic later on
329
- thread = await ctx.message.create_thread(name=f'DeepfloydIF | {prompt}', auto_archive_duration=60) # could also just use prompt, no deepfloydif
330
- # create thread -> send new message inside thread + combined_image -> add reactions -> dfif2
331
-
332
- #current_time = int(time.time())
333
- #random.seed(current_time)
334
-
335
- negative_prompt = ''
336
- seed = random.randint(0, 1000)
337
- #seed = 1
338
- number_of_images = 4
339
- guidance_scale = 7
340
- custom_timesteps_1 = 'smart50'
341
- number_of_inference_steps = 50
342
- api_name = '/generate64'
343
- await thread.send(f'{ctx.author.mention}Generating images in thread, can take ~1 minute...')
 
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}")