Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
seawolf2357
commited on
Commit
โข
273191f
1
Parent(s):
3afb0fb
Update app.py
Browse files
app.py
CHANGED
@@ -87,8 +87,12 @@ class MyClient(discord.Client):
|
|
87 |
|
88 |
self.is_processing = True
|
89 |
try:
|
90 |
-
|
91 |
-
|
|
|
|
|
|
|
|
|
92 |
if self.is_math_question(message.content):
|
93 |
text_response = await self.handle_math_question(message.content)
|
94 |
await self.send_message_with_latex(thread, text_response)
|
@@ -98,6 +102,8 @@ class MyClient(discord.Client):
|
|
98 |
finally:
|
99 |
self.is_processing = False
|
100 |
|
|
|
|
|
101 |
def is_message_in_specific_channel(self, message):
|
102 |
return message.channel.id == SPECIFIC_CHANNEL_ID or (
|
103 |
isinstance(message.channel, discord.Thread) and message.channel.parent_id == SPECIFIC_CHANNEL_ID
|
|
|
87 |
|
88 |
self.is_processing = True
|
89 |
try:
|
90 |
+
if isinstance(message.channel, discord.Thread):
|
91 |
+
thread = message.channel # ์ด๋ฏธ ์ค๋ ๋ ์์ ์์ผ๋ฏ๋ก ํด๋น ์ค๋ ๋๋ฅผ ์ฌ์ฉ
|
92 |
+
else:
|
93 |
+
# ์๋ก์ด ์ค๋ ๋ ์์ฑ
|
94 |
+
thread = await message.channel.create_thread(name=f"์ง๋ฌธ: {message.author.name}", message=message)
|
95 |
+
|
96 |
if self.is_math_question(message.content):
|
97 |
text_response = await self.handle_math_question(message.content)
|
98 |
await self.send_message_with_latex(thread, text_response)
|
|
|
102 |
finally:
|
103 |
self.is_processing = False
|
104 |
|
105 |
+
|
106 |
+
|
107 |
def is_message_in_specific_channel(self, message):
|
108 |
return message.channel.id == SPECIFIC_CHANNEL_ID or (
|
109 |
isinstance(message.channel, discord.Thread) and message.channel.parent_id == SPECIFIC_CHANNEL_ID
|