uodated imports
This commit is contained in:
15
bot.py
15
bot.py
@@ -1,6 +1,7 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import asyncio
|
import asyncio
|
||||||
import os
|
from os import getenv
|
||||||
|
from os.path import dirname, isfile
|
||||||
|
|
||||||
import disnake
|
import disnake
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
@@ -12,12 +13,12 @@ from lib.Comands import determine_prefix
|
|||||||
from lib.Logger import logger
|
from lib.Logger import logger
|
||||||
|
|
||||||
load_dotenv()
|
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:
|
with open('.env', 'a', encoding='utf-8') as f:
|
||||||
f.write("CONF_FILE='config.json'\n")
|
f.write("CONF_FILE='config.json'\n")
|
||||||
load_dotenv()
|
load_dotenv()
|
||||||
if not os.path.isfile(os.getenv('CONF_FILE')):
|
if not isfile(getenv('CONF_FILE')):
|
||||||
with open(os.getenv('CONF_FILE'), 'a', encoding='utf-8') as f:
|
with open(getenv('CONF_FILE'), 'a', encoding='utf-8') as f:
|
||||||
f.write("")
|
f.write("")
|
||||||
|
|
||||||
intents = disnake.Intents(messages=True,
|
intents = disnake.Intents(messages=True,
|
||||||
@@ -33,8 +34,8 @@ bot = commands.Bot(command_prefix=determine_prefix,
|
|||||||
reload=True,
|
reload=True,
|
||||||
test_guilds=[648126669122568215]
|
test_guilds=[648126669122568215]
|
||||||
)
|
)
|
||||||
bot.i18n.load(f"{os.path.dirname(__file__)}/locale/")
|
bot.i18n.load(f"{dirname(__file__)}/locale/")
|
||||||
logger.info(f"{os.path.dirname(__file__)}/locale/")
|
logger.info(f"{dirname(__file__)}/locale/")
|
||||||
|
|
||||||
asyncio.run(work_with_cogs('load', bot, asyncio.run(cog_list())))
|
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')
|
logger.error(f'User {inter.author} tries to use cogs func')
|
||||||
|
|
||||||
|
|
||||||
bot.run(os.getenv('TOKEN'))
|
bot.run(getenv('TOKEN'))
|
||||||
|
|||||||
Reference in New Issue
Block a user