major fixes for inventory
This commit is contained in:
parent
00ef1d1f4b
commit
4d19e29847
10 changed files with 969 additions and 203 deletions
|
|
@ -418,9 +418,6 @@ class DiscordRareMonitor:
|
|||
# Post to Discord
|
||||
await self.post_rare_to_discord(data, rare_type)
|
||||
|
||||
# DEBUG: Also post rare info to aclog for monitoring classification
|
||||
await self.post_rare_debug_to_aclog(rare_name, rare_type, character_name)
|
||||
|
||||
logger.info(f"📬 Posted to Discord: {rare_name} ({rare_type}) from {character_name}")
|
||||
|
||||
except Exception as e:
|
||||
|
|
@ -508,20 +505,24 @@ class DiscordRareMonitor:
|
|||
logger.error(f"❌ Could not find channel {ACLOG_CHANNEL_ID}")
|
||||
except Exception as e:
|
||||
logger.error(f"💥 VORTEX WARNING POSTING FAILED: {e}", exc_info=True)
|
||||
|
||||
# Also post the original vortex message to sawatolife (raw format)
|
||||
try:
|
||||
await self.post_chat_to_discord(data)
|
||||
logger.info(f"🌪️ Posted raw vortex message to sawatolife")
|
||||
except Exception as e:
|
||||
logger.error(f"❌ Error posting vortex to sawatolife: {e}")
|
||||
|
||||
return
|
||||
elif "whirlwind of vortex" in chat_text.lower():
|
||||
logger.debug(f"🌪️ Found 'whirlwind of vortex' but not exact match in: {repr(chat_text)}")
|
||||
elif "jeebus" in chat_text.lower():
|
||||
logger.debug(f"👀 Found 'jeebus' but not vortex pattern in: {repr(chat_text)}")
|
||||
|
||||
# Skip if this message contains any rare names (common or great)
|
||||
if RARE_IN_CHAT_PATTERN.search(chat_text) or self.is_rare_message(chat_text):
|
||||
logger.debug(f"🎯 Skipping rare message from {character_name}: {chat_text}")
|
||||
return
|
||||
|
||||
# Regular chat logging
|
||||
# Log all chat messages (no longer filtering rares)
|
||||
logger.info(f"💬 Chat from {character_name}: {chat_text}")
|
||||
|
||||
|
||||
# Post to AC Log channel
|
||||
await self.post_chat_to_discord(data)
|
||||
|
||||
|
|
@ -660,6 +661,21 @@ class DiscordRareMonitor:
|
|||
except Exception as e:
|
||||
logger.error(f"❌ Error posting to Discord: {e}")
|
||||
|
||||
def clean_and_format_chat_message(self, chat_text: str) -> str:
|
||||
"""Clean chat message by removing 'Dunking Rares:' prefix and add color coding."""
|
||||
try:
|
||||
# Remove "Dunking Rares: " prefix if present
|
||||
cleaned_text = chat_text
|
||||
if cleaned_text.startswith("Dunking Rares: "):
|
||||
cleaned_text = cleaned_text[15:] # Remove "Dunking Rares: "
|
||||
|
||||
# Return cleaned text without any special formatting
|
||||
return cleaned_text
|
||||
|
||||
except Exception as e:
|
||||
logger.warning(f"⚠️ Error cleaning chat message: {e}")
|
||||
return chat_text # Return original on error
|
||||
|
||||
async def post_chat_to_discord(self, data: dict):
|
||||
"""Post chat message to sawatolife Discord channel."""
|
||||
try:
|
||||
|
|
@ -679,9 +695,11 @@ class DiscordRareMonitor:
|
|||
except ValueError:
|
||||
timestamp = datetime.now()
|
||||
|
||||
# Create simple message format similar to your old bot
|
||||
# Clean and format the message
|
||||
time_str = timestamp.strftime("%H:%M:%S")
|
||||
message_content = f"`{time_str}` **{character_name}**: {chat_text}"
|
||||
cleaned_chat = self.clean_and_format_chat_message(chat_text)
|
||||
message_content = f"`{time_str}` {cleaned_chat}"
|
||||
|
||||
|
||||
# Get sawatolife channel
|
||||
channel = self.client.get_channel(SAWATOLIFE_CHANNEL_ID)
|
||||
|
|
@ -695,23 +713,6 @@ class DiscordRareMonitor:
|
|||
except Exception as e:
|
||||
logger.error(f"❌ Error posting chat to Discord: {e}")
|
||||
|
||||
async def post_rare_debug_to_aclog(self, rare_name: str, rare_type: str, character_name: str):
|
||||
"""Post rare classification debug info to sawatolife channel."""
|
||||
try:
|
||||
# Create debug message showing classification
|
||||
debug_message = f"🔍 **RARE DEBUG**: `{rare_name}` → **{rare_type.upper()}** (found by {character_name})"
|
||||
|
||||
# Get sawatolife channel
|
||||
channel = self.client.get_channel(SAWATOLIFE_CHANNEL_ID)
|
||||
|
||||
if channel:
|
||||
await channel.send(debug_message)
|
||||
logger.debug(f"📤 Posted rare debug to #{channel.name}: {rare_name} -> {rare_type}")
|
||||
else:
|
||||
logger.error(f"❌ Could not find sawatolife channel for debug: {SAWATOLIFE_CHANNEL_ID}")
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"❌ Error posting rare debug to Discord: {e}")
|
||||
|
||||
async def post_vortex_warning_to_discord(self, data: dict):
|
||||
"""Post vortex warning as a special alert message to Discord."""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue