settings application

.env db params+global settings in admin model
ECVI plugin module
This commit is contained in:
2024-12-14 20:50:11 +09:00
parent 09eb249d68
commit 93994ed929
328 changed files with 190143 additions and 538 deletions

View File

@@ -6,7 +6,7 @@ from django.core.management.base import BaseCommand
from telegram.ext import Application
from bot.utils.bot_setup import setup_bot
from scheduler.tasks import load_tasks_to_scheduler
from settings.models import TelegramSettings
class Command(BaseCommand):
help = "Запуск Telegram бота и планировщика"
@@ -32,12 +32,13 @@ class Command(BaseCommand):
return
# Настройка Telegram бота
bot_token = os.getenv("TELEGRAM_BOT_TOKEN")
# bot_token = os.getenv("TELEGRAM_BOT_TOKEN")
bot_token = TelegramSettings.objects.first().bot_token
if not bot_token:
raise ValueError("Токен бота не найден в переменных окружения.")
application = Application.builder().token(bot_token).build()
setup_bot(application)
# Основная асинхронная функция
async def main():
await application.initialize()