diff --git a/backend/autometabuilder/integrations/__init__.py b/backend/autometabuilder/integrations/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/backend/autometabuilder/integrations/notifications.py b/backend/autometabuilder/integrations/notifications.py deleted file mode 100644 index 2564a66..0000000 --- a/backend/autometabuilder/integrations/notifications.py +++ /dev/null @@ -1,55 +0,0 @@ -import os -import logging -from slack_sdk import WebClient -from slack_sdk.errors import SlackApiError -import discord -import asyncio - -logger = logging.getLogger("autometabuilder.notifications") - -def send_slack_notification(message: str): - token = os.environ.get("SLACK_BOT_TOKEN") - channel = os.environ.get("SLACK_CHANNEL") - if not token or not channel: - logger.warning("Slack notification skipped: SLACK_BOT_TOKEN or SLACK_CHANNEL missing.") - return - - client = WebClient(token=token) - try: - client.chat_postMessage(channel=channel, text=message) - logger.info("Slack notification sent successfully.") - except SlackApiError as e: - logger.error(f"Error sending Slack notification: {e}") - -async def send_discord_notification_async(message: str): - token = os.environ.get("DISCORD_BOT_TOKEN") - channel_id = os.environ.get("DISCORD_CHANNEL_ID") - if not token or not channel_id: - logger.warning("Discord notification skipped: DISCORD_BOT_TOKEN or DISCORD_CHANNEL_ID missing.") - return - - intents = discord.Intents.default() - client = discord.Client(intents=intents) - - @client.event - async def on_ready(): - channel = client.get_channel(int(channel_id)) - if channel: - await channel.send(message) - logger.info("Discord notification sent successfully.") - await client.close() - - try: - await client.start(token) - except Exception as e: - logger.error(f"Error sending Discord notification: {e}") - -def send_discord_notification(message: str): - try: - asyncio.run(send_discord_notification_async(message)) - except Exception as e: - logger.error(f"Error running Discord notification: {e}") - -def notify_all(message: str): - send_slack_notification(message) - send_discord_notification(message)