init commit
This commit is contained in:
5
services/bot/app/core/config.py
Normal file
5
services/bot/app/core/config.py
Normal file
@@ -0,0 +1,5 @@
|
||||
import os
|
||||
class Settings:
|
||||
BOT_TOKEN = os.getenv("BOT_TOKEN", "")
|
||||
DATABASE_URL = os.getenv("DATABASE_URL", "")
|
||||
settings = Settings()
|
||||
14
services/bot/app/main.py
Normal file
14
services/bot/app/main.py
Normal file
@@ -0,0 +1,14 @@
|
||||
import asyncio
|
||||
from telegram.ext import Application, CommandHandler
|
||||
from app.core.config import settings
|
||||
async def start(update, context):
|
||||
await update.message.reply_text("Привет! Бот запущен.")
|
||||
async def main():
|
||||
app = Application.builder().token(settings.BOT_TOKEN).build()
|
||||
app.add_handler(CommandHandler("start", start))
|
||||
await app.initialize()
|
||||
await app.start()
|
||||
await app.updater.start_polling()
|
||||
await app.updater.wait_until_closed()
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(main())
|
||||
Reference in New Issue
Block a user