Spaces:
No application file
No application file
Download main.py from WealthFromAI/devops-daily-tips-telegram-bot-e3cd: direct link, hf CLI and curl.
- Browser
- Download file 1.35 kB
-
https://huggingface.co/spaces/WealthFromAI/devops-daily-tips-telegram-bot-e3cd/resolve/main/main.py
- Command line
-
hf download hf://spaces/WealthFromAI/devops-daily-tips-telegram-bot-e3cd/main.py
-
curl -L -o main.py https://huggingface.co/spaces/WealthFromAI/devops-daily-tips-telegram-bot-e3cd/resolve/main/main.py
1.35 kB
| """ | |
| DevOps Daily Tips Telegram Bot — Telegram Bot | |
| Telegram bot delivering daily DevOps tips, incident postmortem summaries, tool-of-the-week spotlights, and on-call readiness prompts. Commands include /tip for today's DevOps best practice, /tool for | |
| """ | |
| import os | |
| import logging | |
| from dotenv import load_dotenv | |
| from telegram import Update | |
| from telegram.ext import Application, CommandHandler, ContextTypes | |
| load_dotenv() | |
| logging.basicConfig(level=logging.INFO) | |
| TOKEN = os.getenv("TELEGRAM_BOT_TOKEN", "") | |
| async def start(update: Update, context: ContextTypes.DEFAULT_TYPE): | |
| await update.message.reply_text( | |
| f"Welcome to DevOps Daily Tips Telegram Bot!\n\nTelegram bot delivering daily DevOps tips, incident postmortem summaries, tool-of-the-week spotlights, and on-call readiness prompts. Commands include /tip for today's DevOps best practice, /tool for \n\nType /help to see all commands." | |
| ) | |
| async def help_cmd(update: Update, context: ContextTypes.DEFAULT_TYPE): | |
| await update.message.reply_text("Available commands:\n/start - Welcome\n/help - This message") | |
| def main(): | |
| app = Application.builder().token(TOKEN).build() | |
| app.add_handler(CommandHandler("start", start)) | |
| app.add_handler(CommandHandler("help", help_cmd)) | |
| app.run_polling() | |
| if __name__ == "__main__": | |
| main() | |