seawolf2357
commited on
Commit
β’
6a30e5d
1
Parent(s):
12bb502
Update app.py
Browse files
app.py
CHANGED
@@ -34,10 +34,11 @@ class MyClient(discord.Client):
|
|
34 |
subprocess.Popen(["python", "web.py"])
|
35 |
logging.info("Web.py server has been started.")
|
36 |
|
|
|
37 |
async def on_message(self, message):
|
38 |
if message.author == self.user:
|
39 |
return
|
40 |
-
if
|
41 |
return
|
42 |
if self.is_processing:
|
43 |
return
|
@@ -48,6 +49,13 @@ class MyClient(discord.Client):
|
|
48 |
finally:
|
49 |
self.is_processing = False
|
50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
async def generate_response(message):
|
52 |
global conversation_history # μ μ λ³μ μ¬μ©μ λͺ
μ
|
53 |
user_input = message.content
|
|
|
34 |
subprocess.Popen(["python", "web.py"])
|
35 |
logging.info("Web.py server has been started.")
|
36 |
|
37 |
+
|
38 |
async def on_message(self, message):
|
39 |
if message.author == self.user:
|
40 |
return
|
41 |
+
if not self.is_message_in_specific_channel(message):
|
42 |
return
|
43 |
if self.is_processing:
|
44 |
return
|
|
|
49 |
finally:
|
50 |
self.is_processing = False
|
51 |
|
52 |
+
def is_message_in_specific_channel(self, message):
|
53 |
+
# λ©μμ§κ° μ§μ λ μ±λμ΄κ±°λ, ν΄λΉ μ±λμ μ°λ λμΈ κ²½μ° True λ°ν
|
54 |
+
return message.channel.id == SPECIFIC_CHANNEL_ID or (
|
55 |
+
isinstance(message.channel, discord.Thread) and message.channel.parent_id == SPECIFIC_CHANNEL_ID
|
56 |
+
)
|
57 |
+
|
58 |
+
|
59 |
async def generate_response(message):
|
60 |
global conversation_history # μ μ λ³μ μ¬μ©μ λͺ
μ
|
61 |
user_input = message.content
|