fix: address review feedback for proactive reply logic
- Parse display names with ': ' split to handle colons in names - Reset cooldown to half instead of subtract-3 to reduce LLM call frequency - Remove redundant message.guild check Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
10
cogs/chat.py
10
cogs/chat.py
@@ -250,8 +250,8 @@ class ChatCog(commands.Cog):
|
|||||||
memory_parts = []
|
memory_parts = []
|
||||||
seen_users = set()
|
seen_users = set()
|
||||||
for line in recent_for_check:
|
for line in recent_for_check:
|
||||||
name = line.split(":")[0]
|
name = line.split(": ", 1)[0]
|
||||||
if name not in seen_users and message.guild:
|
if name not in seen_users:
|
||||||
seen_users.add(name)
|
seen_users.add(name)
|
||||||
member = discord.utils.find(
|
member = discord.utils.find(
|
||||||
lambda m, n=name: m.display_name == n,
|
lambda m, n=name: m.display_name == n,
|
||||||
@@ -274,10 +274,8 @@ class ChatCog(commands.Cog):
|
|||||||
should_reply = True
|
should_reply = True
|
||||||
is_proactive = True
|
is_proactive = True
|
||||||
else:
|
else:
|
||||||
# Not relevant — partially reset cooldown so we check again sooner
|
# Not relevant — reset to half cooldown so we wait a bit before rechecking
|
||||||
self._messages_since_reply[ch_id] = max(
|
self._messages_since_reply[ch_id] = cooldown // 2
|
||||||
0, self._messages_since_reply[ch_id] - 3
|
|
||||||
)
|
|
||||||
|
|
||||||
if not should_reply:
|
if not should_reply:
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user