Start message added
Deploy Summer to Server / deploy (push) Successful in 4s

This commit is contained in:
chrispi committed 2026-10-17 04:07:19 +02:00
1 parent fc5e33b396
commit beb0a72bbb
1 file changed
+15 -3
+15 -3
View File
@@ -6,18 +6,30 @@ from telegram.ext import ApplicationBuilder, ContextTypes, CommandHandler
load_dotenv() load_dotenv()
TOKEN = os.getenv("BOT_TOKEN") TOKEN = os.getenv("BOT_TOKEN")
CHAT_ID = os.getenv("ADMIN_CHAT_ID")
logging.basicConfig( logging.basicConfig(
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s" format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
level=logging.INFO
) )
async def post_init(application):
if CHAT_ID:
try:
await application.bot.send_message(
chat_id=CHAT_ID,
text="Das Deployment war erfolgreich. Ich bin zurück!"
)
except Exception as e:
print(f"Konnte Start-Nachricht nicht senden: {e}")
async def start(update: Update, context: ContextTypes.DEFAULT_TYPE): async def start(update: Update, context: ContextTypes.DEFAULT_TYPE):
user_name = update.effective_user.first_name user_name = update.effective_user.first_name
await update.message.reply_text(f"Halle {user_name} Dein Telegram Bot läuft über Gitea") await update.message.reply_text(f"Hallo {user_name} Dein Telegram Bot läuft über Gitea")
if __name__ == "__main__": if __name__ == "__main__":
if not TOKEN: if not TOKEN:
print("Fehler: KEin BOT_TOKEN in der .env gefunden") print("Fehler: Kein BOT_TOKEN in der .env gefunden")
exit(1) exit(1)
app = ApplicationBuilder().token(TOKEN).build() app = ApplicationBuilder().token(TOKEN).build()