fix: periodic register reload in approval scanner + direct project_name access
This commit is contained in:
7
bot.py
7
bot.py
@@ -322,8 +322,11 @@ class GravityBot(commands.Bot):
|
||||
|
||||
@tasks.loop(seconds=3)
|
||||
async def pending_approval_scanner(self):
|
||||
"""Scan bridge/pending/ for new approval requests."""
|
||||
"""Scan bridge/pending/ for new approval requests + reload registrations."""
|
||||
try:
|
||||
# Reload conv→project registrations each cycle
|
||||
self._load_registrations()
|
||||
|
||||
requests = self.bridge.get_pending_requests()
|
||||
for req in requests:
|
||||
if req.request_id in self._sent_approval_ids:
|
||||
@@ -332,7 +335,7 @@ class GravityBot(commands.Bot):
|
||||
continue
|
||||
|
||||
# Learn project mapping from pending approval
|
||||
project = getattr(req, 'project_name', '') or Config.PROJECT_NAME
|
||||
project = req.project_name or Config.PROJECT_NAME
|
||||
if req.conversation_id and req.conversation_id != '__global__':
|
||||
self.conv_to_project[req.conversation_id] = project
|
||||
|
||||
|
||||
Reference in New Issue
Block a user