diff --git a/twitch/feeds.py b/twitch/feeds.py index eb088ca..9f4f183 100644 --- a/twitch/feeds.py +++ b/twitch/feeds.py @@ -98,6 +98,69 @@ class DropCampaignFeed(Feed): if item.end_at: description += f"
Ends: {item.end_at.strftime('%Y-%m-%d %H:%M %Z')}
" + # Add information about the drops in this campaign + drops = item.time_based_drops.select_related().prefetch_related("benefits").all() # type: ignore[attr-defined] + if drops: + description += "| Benefits | ' + 'Drop Name | ' + 'Requirements | ' + 'Period | ' + "
|---|---|---|---|
| '
+ for benefit in drop.benefits.all():
+ if benefit.image_asset_url:
+ description += format_html(
+ ' | "
+
+ # Drop name
+ description += f'{drop.name} | ' + + # Requirements + requirements = "" + if drop.required_minutes_watched: + requirements = f"{drop.required_minutes_watched} minutes watched" + if drop.required_subs > 0: + if requirements: + requirements += f" and {drop.required_subs} subscriptions required" + else: + requirements = f"{drop.required_subs} subscriptions required" + description += f'{requirements} | ' + + # Period + period = "" + if drop.start_at: + period += drop.start_at.strftime("%Y-%m-%d %H:%M %Z") + if drop.end_at: + if period: + period += " - " + drop.end_at.strftime("%Y-%m-%d %H:%M %Z") + else: + period = drop.end_at.strftime("%Y-%m-%d %H:%M %Z") + description += f'{period} | ' + + description += "