Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -86,8 +86,11 @@ class MyClient(discord.Client):
|
|
| 86 |
|
| 87 |
self.is_processing = True
|
| 88 |
try:
|
| 89 |
-
|
| 90 |
-
|
|
|
|
|
|
|
|
|
|
| 91 |
if self.is_math_question(message.content):
|
| 92 |
text_response = await self.handle_math_question(message.content)
|
| 93 |
await self.send_message_with_latex(thread, text_response)
|
|
@@ -96,7 +99,7 @@ class MyClient(discord.Client):
|
|
| 96 |
await self.send_message_with_latex(thread, response)
|
| 97 |
finally:
|
| 98 |
self.is_processing = False
|
| 99 |
-
|
| 100 |
def is_message_in_specific_channel(self, message):
|
| 101 |
return message.channel.id == SPECIFIC_CHANNEL_ID or (
|
| 102 |
isinstance(message.channel, discord.Thread) and message.channel.parent_id == SPECIFIC_CHANNEL_ID
|
|
|
|
| 86 |
|
| 87 |
self.is_processing = True
|
| 88 |
try:
|
| 89 |
+
if isinstance(message.channel, discord.Thread):
|
| 90 |
+
thread = message.channel
|
| 91 |
+
else:
|
| 92 |
+
thread = await message.channel.create_thread(name=f"질문: {message.author.name}", message=message)
|
| 93 |
+
|
| 94 |
if self.is_math_question(message.content):
|
| 95 |
text_response = await self.handle_math_question(message.content)
|
| 96 |
await self.send_message_with_latex(thread, text_response)
|
|
|
|
| 99 |
await self.send_message_with_latex(thread, response)
|
| 100 |
finally:
|
| 101 |
self.is_processing = False
|
| 102 |
+
|
| 103 |
def is_message_in_specific_channel(self, message):
|
| 104 |
return message.channel.id == SPECIFIC_CHANNEL_ID or (
|
| 105 |
isinstance(message.channel, discord.Thread) and message.channel.parent_id == SPECIFIC_CHANNEL_ID
|