Fix Discord channel activation system
- Fix MySQL boolean conversion in toggle_channel_status - Improve cache management with 5-second timeout - Add bulk channel selection and toggle functionality - Fix Jinja2 template syntax errors - Add comprehensive debugging for channel status queries - Implement real-time channel activation without container restart
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import os
|
||||
import sys
|
||||
import signal
|
||||
import time
|
||||
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
|
||||
import discord
|
||||
@@ -9,7 +11,7 @@ import re
|
||||
import html
|
||||
|
||||
from botdiscord.config import get_discord_token, load_config, get_languages
|
||||
from botdiscord.database import init_db, get_active_languages, get_bot_languages, save_message, get_welcome_message
|
||||
from botdiscord.database import init_db, get_active_languages, get_bot_languages, save_message, get_welcome_message, is_channel_enabled
|
||||
from botdiscord.ui import PersistentTranslationView, ConfigView, WelcomeTranslationView, TranslationButton
|
||||
from botdiscord.translate import get_reverse_mapping, load_lang_mappings, get_name_to_code, get_flag_mapping
|
||||
|
||||
@@ -115,6 +117,14 @@ def get_active_langs_for_guild(guild_id):
|
||||
async def on_message(message):
|
||||
if message.author.bot: return
|
||||
|
||||
# Verificar si el canal está habilitado para traducción
|
||||
channel_enabled = is_channel_enabled(message.channel.id)
|
||||
print(f"[Bot] Mensaje en canal {message.channel.id} ({message.channel.name}) - Habilitado: {channel_enabled} - Timestamp: {time.strftime('%H:%M:%S')}")
|
||||
|
||||
if not channel_enabled:
|
||||
print(f"[Bot] Ignorando mensaje en canal desactivado: {message.channel.name}")
|
||||
return
|
||||
|
||||
text_content = message.content.strip()
|
||||
if not text_content: return
|
||||
|
||||
|
||||
Reference in New Issue
Block a user