Add initial project structure for Telegram bot
- Created Docker configuration files for development and production. - Added Dockerfile for building the bot image. - Implemented configuration loading from environment variables. - Developed main application logic and command handlers. - Included README with setup instructions and usage details. - Added .gitignore and .dockerignore files to exclude unnecessary files. - Provided example environment file (.env.example) for bot token configuration. - Established basic error handling for the bot.
This commit is contained in:
24
main.py
Normal file
24
main.py
Normal file
@@ -0,0 +1,24 @@
|
||||
"""Single entry point: build Application, register handlers, run polling."""
|
||||
import logging
|
||||
|
||||
import config
|
||||
from telegram.ext import ApplicationBuilder
|
||||
|
||||
from handlers import register_handlers
|
||||
|
||||
logging.basicConfig(
|
||||
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
|
||||
level=logging.INFO,
|
||||
)
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def main() -> None:
|
||||
app = ApplicationBuilder().token(config.BOT_TOKEN).build()
|
||||
register_handlers(app)
|
||||
logger.info("Bot starting (polling)...")
|
||||
app.run_polling(allowed_updates=["message"])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user