refactor: remove startup announcement logic from on_startup function

This commit is contained in:
Andre Beging
2025-10-09 11:10:32 +02:00
parent fe3d852434
commit a29ce99420

18
bot.py
View File

@@ -405,24 +405,6 @@ def init_counters(existing: Dict[str, int], config: Dict[str, Any]) -> Dict[str,
async def on_startup(app): async def on_startup(app):
logger.info("Bot gestartet und bereit.") logger.info("Bot gestartet und bereit.")
announce_ids = os.environ.get("STARTUP_ANNOUNCE_CHAT_IDS")
if announce_ids:
ids = []
for raw in announce_ids.split(','):
raw = raw.strip()
if not raw:
continue
try:
ids.append(int(raw))
except ValueError:
logger.warning("Kann Chat ID %s nicht in int umwandeln", raw)
if ids:
me = await app.bot.get_me()
for cid in ids:
try:
await app.bot.send_message(cid, f"🤖 {me.first_name} ist bereit. Nutze /help für Befehle.")
except Exception as e:
logger.warning("Konnte Startup-Nachricht an %s nicht senden: %s", cid, e)
def main(): def main():