import logging
from aiogram import Bot, Dispatcher, types
from aiogram.contrib.middlewares.logging import LoggingMiddleware
from aiogram.utils import executor
from aiogram.dispatcher import FSMContext
from aiogram.dispatcher.filters.state import State, StatesGroup
from aiogram.types import InlineKeyboardMarkup, InlineKeyboardButton
from dotenv import load_dotenv
import os

from handlers import register_handlers
from database import create_tables

# Загрузка переменных окружения из .env файла
load_dotenv()

API_TOKEN = os.getenv('BOT_API_TOKEN')
OPERATORS_GROUP_ID = int(os.getenv('OPERATORS_GROUP_ID'))
ADMIN_GROUP_ID = int(os.getenv('ADMIN_GROUP_ID'))

logging.basicConfig(level=logging.INFO)

bot = Bot(token=API_TOKEN)
dp = Dispatcher(bot)
dp.middleware.setup(LoggingMiddleware())

# Основное приложение
if __name__ == '__main__':
    create_tables()
    register_handlers(dp, OPERATORS_GROUP_ID)
    executor.start_polling(dp, skip_updates=True)
