Skip to content

Commit

Permalink
chore: change radarr update embeds to own channel
Browse files Browse the repository at this point in the history
  • Loading branch information
zeroquinc committed Oct 5, 2024
1 parent 5c9e3ae commit a2e52a4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
10 changes: 8 additions & 2 deletions api/radarr/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from api.tmdb.client import TMDb
from src.radarr.functions import process_webhook
from config.globals import RADARR_CHANNEL
from config.globals import RADARR_CHANNEL, UPDATE_CHANNEL

class RadarrWebhookHandler:
def __init__(self, payload, discord_bot):
Expand Down Expand Up @@ -34,5 +34,11 @@ def initialize_global_variables(self):
async def handle_webhook(self):
logger.info(f"Processing Radarr webhook payload for event type: {self.event_type}")
logger.debug(f"Payload: {json.dumps(self.payload, indent=4)}")
channel = self.discord_bot.bot.get_channel(RADARR_CHANNEL)

# Check if the event is "ApplicationUpdate" and set the channel accordingly
if self.event_type == 'ApplicationUpdate':
channel = self.discord_bot.bot.get_channel(UPDATE_CHANNEL) # Send to the update channel
else:
channel = self.discord_bot.bot.get_channel(RADARR_CHANNEL) # Send to the default Radarr channel

await process_webhook(self, channel)
1 change: 1 addition & 0 deletions config/globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
RADARR_ICON = "https://i.imgur.com/6U4aXO0.png"
SONARR_CHANNEL = int(os.getenv("SONARR_CHANNEL"))
SONARR_ICON = "https://i.imgur.com/dZSIKZE.png"
UPDATE_CHANNEL = int(os.getenv("UPDATE_CHANNEL"))

# Delay
ENABLE_DELAY = os.getenv("ENABLE_DELAY") == "True"

0 comments on commit a2e52a4

Please sign in to comment.