uodated imports

This commit is contained in:
bacon
2024-03-10 23:46:36 +03:00
parent 2ea64d8141
commit 7b54fed87f

15
bot.py
View File

@@ -1,6 +1,7 @@
#!/usr/bin/env python3
import asyncio
import os
from os import getenv
from os.path import dirname, isfile
import disnake
from dotenv import load_dotenv
@@ -12,12 +13,12 @@ from lib.Comands import determine_prefix
from lib.Logger import logger
load_dotenv()
if not os.path.isfile('.env') or not os.getenv('CONF_FILE'):
if not isfile('.env') or not getenv('CONF_FILE'):
with open('.env', 'a', encoding='utf-8') as f:
f.write("CONF_FILE='config.json'\n")
load_dotenv()
if not os.path.isfile(os.getenv('CONF_FILE')):
with open(os.getenv('CONF_FILE'), 'a', encoding='utf-8') as f:
if not isfile(getenv('CONF_FILE')):
with open(getenv('CONF_FILE'), 'a', encoding='utf-8') as f:
f.write("")
intents = disnake.Intents(messages=True,
@@ -33,8 +34,8 @@ bot = commands.Bot(command_prefix=determine_prefix,
reload=True,
test_guilds=[648126669122568215]
)
bot.i18n.load(f"{os.path.dirname(__file__)}/locale/")
logger.info(f"{os.path.dirname(__file__)}/locale/")
bot.i18n.load(f"{dirname(__file__)}/locale/")
logger.info(f"{dirname(__file__)}/locale/")
asyncio.run(work_with_cogs('load', bot, asyncio.run(cog_list())))
@@ -158,4 +159,4 @@ async def cogs_error(inter: disnake.ApplicationCommandInteraction):
logger.error(f'User {inter.author} tries to use cogs func')
bot.run(os.getenv('TOKEN'))
bot.run(getenv('TOKEN'))