diff --git a/app/cogs/actual_utils.py b/app/cogs/actual_utils.py index ffcd9b77..ee9b112a 100644 --- a/app/cogs/actual_utils.py +++ b/app/cogs/actual_utils.py @@ -97,48 +97,51 @@ class ActualUtils(commands.Cog): required=False, ), ): - import socket - import stable_diffusion - port = "7860" - ip = "192.168.1.80" - steps = 20 + if ctx.channel.name == "stable-diffusion": + import socket + import stable_diffusion - # Send my requests to my gaming computer with the 3080 (if its up) - if ctx.author.id == 144986109804412928: - ip = "192.168.1.188" - steps = 60 - s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - s.settimeout(1) - try: - s.connect((ip, int(port))) - except: - ip = "192.168.1.80" + port = "7860" + ip = "192.168.1.80" + steps = 20 - try: - await ctx.defer() - original_message = await ctx.followup.send( - "Please be patient, I'm generating your image" - ) - file_path = await stable_diffusion.generate_image( - ip=ip, - port=port, - positives=positive_prompt, - negatives=negative_prompt or None, - steps=steps, - ) - await original_message.edit( - content="", - file=discord.File( - file_path, - filename="unknown.png", - ), - ) - os.remove(file_path) - except Exception as e: - await ctx.reply( - "Stable diffusion isnt running right now, sorry.\n%s" % e, - ) + # Send my requests to my gaming computer with the 3080 (if its up) + if ctx.author.id == 144986109804412928: + ip = "192.168.1.188" + steps = 60 + s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + s.settimeout(1) + try: + s.connect((ip, int(port))) + except: + ip = "192.168.1.80" + try: + await ctx.defer() + original_message = await ctx.followup.send( + "Please be patient, I'm generating your image" + ) + file_path = await stable_diffusion.generate_image( + ip=ip, + port=port, + positives=positive_prompt, + negatives=negative_prompt or None, + steps=steps, + ) + await original_message.edit( + content="", + file=discord.File( + file_path, + filename="unknown.png", + ), + ) + os.remove(file_path) + except Exception as e: + await ctx.reply( + "Stable diffusion isnt running right now, sorry.\n%s" % e, + ) + else: + await ctx.respond("You can only do that in the stable-diffusion channel") @commands.has_role("Track day gamers") @commands.slash_command(