26 lines
668 B
Python
26 lines
668 B
Python
import asyncio
|
|
import logging
|
|
from sys import exit
|
|
|
|
import uvloop
|
|
|
|
from nwxraybot import NwXrayBot, Settings
|
|
from nwxraybot.handlers import *
|
|
from nwxraybot.models import User
|
|
|
|
if __name__ == "__main__":
|
|
config = Settings() # Load config from .env
|
|
logging.basicConfig(level=logging.DEBUG if config.debug else logging.INFO)
|
|
|
|
# Check if bot token is set
|
|
if config.bot_token == 'token':
|
|
logging.error("Bot token is not set")
|
|
exit(1)
|
|
|
|
User.create_table()
|
|
|
|
# Start bot
|
|
bot = NwXrayBot(config.bot_token.get_secret_value())
|
|
bot.include_routers(HelloHandler(bot), MenuHandler(bot))
|
|
uvloop.run(bot.start(skip_updates=True))
|