feat(fuenfvoracht): Schreibstil heute/morgen im Tages-Briefing
Bot fragt CT109 /api/auto5vor8/style-preview ab und zeigt den rotierenden Auto-5vor8-Stil (heute/morgen) im 15-Uhr-Briefing an.
This commit is contained in:
parent
668055d260
commit
b704a5949a
1 changed files with 21 additions and 0 deletions
|
|
@ -359,6 +359,20 @@ async def job_check_notify(bot: Bot):
|
||||||
flog.info('article_auto_approved', date=d, post_time=pt)
|
flog.info('article_auto_approved', date=d, post_time=pt)
|
||||||
|
|
||||||
|
|
||||||
|
def _fetch_style_preview():
|
||||||
|
"""Holt heutigen/morgigen 5vor8-Schreibstil von rss-manager (CT109)."""
|
||||||
|
try:
|
||||||
|
req = urllib.request.Request(
|
||||||
|
"http://10.10.10.109:8080/api/auto5vor8/style-preview",
|
||||||
|
headers={"User-Agent": "fuenfvoracht-briefing/1.0"},
|
||||||
|
)
|
||||||
|
with urllib.request.urlopen(req, timeout=5) as resp:
|
||||||
|
import json
|
||||||
|
return json.loads(resp.read().decode("utf-8"))
|
||||||
|
except Exception:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
async def job_morning_briefing(bot: Bot):
|
async def job_morning_briefing(bot: Bot):
|
||||||
"""Morgen-Briefing: was ist heute geplant, was fehlt."""
|
"""Morgen-Briefing: was ist heute geplant, was fehlt."""
|
||||||
d = today_str()
|
d = today_str()
|
||||||
|
|
@ -408,6 +422,13 @@ async def job_morning_briefing(bot: Bot):
|
||||||
|
|
||||||
lines.append(f"\n📆 <b>Nächste 3 Tage:</b>")
|
lines.append(f"\n📆 <b>Nächste 3 Tage:</b>")
|
||||||
lines.extend(plan_lines)
|
lines.extend(plan_lines)
|
||||||
|
|
||||||
|
style_preview = _fetch_style_preview()
|
||||||
|
if style_preview:
|
||||||
|
lines.append(f"\n🎨 <b>Schreibstil Auto-5vor8:</b>")
|
||||||
|
lines.append(f" Heute: {style_preview[today][style]}")
|
||||||
|
lines.append(f" Morgen: {style_preview[tomorrow][style]}")
|
||||||
|
|
||||||
lines.append(f"\n👉 https://fuenfvoracht.orbitalo.net")
|
lines.append(f"\n👉 https://fuenfvoracht.orbitalo.net")
|
||||||
|
|
||||||
await notify_reviewers(bot, '\n'.join(lines))
|
await notify_reviewers(bot, '\n'.join(lines))
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue