Spaces:
Runtime error
Runtime error
seawolf2357
commited on
Commit
β’
641734b
1
Parent(s):
f0a5776
Update app.py
Browse files
app.py
CHANGED
@@ -58,13 +58,20 @@ class MyClient(discord.Client):
|
|
58 |
logging.info("web.py μλ²κ° μμλμμ΅λλ€.")
|
59 |
|
60 |
async def on_message(self, message):
|
61 |
-
|
|
|
|
|
|
|
|
|
|
|
62 |
return
|
63 |
if message.content.startswith('!image '):
|
64 |
self.is_processing = True
|
65 |
try:
|
66 |
prompt = message.content[len('!image '):]
|
|
|
67 |
prompt_en = translate_prompt(prompt)
|
|
|
68 |
image = generate_image(prompt_en, negative_prompt)
|
69 |
user_id = message.author.id
|
70 |
if image:
|
@@ -78,6 +85,9 @@ class MyClient(discord.Client):
|
|
78 |
)
|
79 |
else:
|
80 |
await message.channel.send(f"<@{user_id}> μ΄λ―Έμ§ μμ±μ μ€ν¨νμμ΅λλ€.")
|
|
|
|
|
|
|
81 |
finally:
|
82 |
self.is_processing = False
|
83 |
else:
|
|
|
58 |
logging.info("web.py μλ²κ° μμλμμ΅λλ€.")
|
59 |
|
60 |
async def on_message(self, message):
|
61 |
+
logging.debug(f'λ©μμ§ κ°μ§λ¨: {message.content}')
|
62 |
+
if message.author == self.user:
|
63 |
+
logging.debug('μμ μ λ©μμ§ λ¬΄μ')
|
64 |
+
return
|
65 |
+
if message.channel.id != TARGET_CHANNEL_ID:
|
66 |
+
logging.debug('μ§μ λ μ±λμ΄ μλ')
|
67 |
return
|
68 |
if message.content.startswith('!image '):
|
69 |
self.is_processing = True
|
70 |
try:
|
71 |
prompt = message.content[len('!image '):]
|
72 |
+
logging.debug(f'μ΄λ―Έμ§ μμ± μμ²: {prompt}')
|
73 |
prompt_en = translate_prompt(prompt)
|
74 |
+
logging.debug(f'λ²μλ ν둬ννΈ: {prompt_en}')
|
75 |
image = generate_image(prompt_en, negative_prompt)
|
76 |
user_id = message.author.id
|
77 |
if image:
|
|
|
85 |
)
|
86 |
else:
|
87 |
await message.channel.send(f"<@{user_id}> μ΄λ―Έμ§ μμ±μ μ€ν¨νμμ΅λλ€.")
|
88 |
+
except Exception as e:
|
89 |
+
logging.error(f'μ΄λ―Έμ§ μμ± μ€λ₯: {e}')
|
90 |
+
await message.channel.send(f"<@{message.author.id}> μ΄λ―Έμ§ μμ± μ€ μ€λ₯κ° λ°μνμμ΅λλ€.")
|
91 |
finally:
|
92 |
self.is_processing = False
|
93 |
else:
|