refractor lib code

This commit is contained in:
2022-08-21 22:24:52 +03:00
parent 5a50b2ac98
commit ea3e9dd105
9 changed files with 244 additions and 316 deletions

14
test.py
View File

@@ -1,31 +1,29 @@
import logging
import sys
import threading
import disnake
from disnake import OptionChoice, OptionType, Option
from disnake.ext import commands
import lib
from lib.CogsPrepare import cog_list, work_with_cogs
from lib.Comands import check_json, determine_prefix
bot_owner = 386629192743256065
lib.Commands.check_json()
check_json()
intents = disnake.Intents(messages=True, guilds=True, message_content=True)
intents.members = True
intents.voice_states = True
bot = commands.Bot(command_prefix=lib.Commands.determine_prefix,
bot = commands.Bot(command_prefix=determine_prefix,
intents=intents,
status=disnake.Status.idle,
reload=True,
test_guilds=[929446191270330410, 987120286933602354])
threading.current_thread().name = "main"
logging.basicConfig(stream=sys.stdout, filemode='w', level='INFO',
format='%(asctime)s - %(levelname)s - %(threadName)s - %(message)s')
for filename in lib.CogsPrepare.cog_list():
for filename in cog_list():
try:
bot.load_extension(f'cogs.{filename}')
logging.info(f'Loaded cog {filename}')
@@ -65,7 +63,7 @@ async def on_ready():
)
async def slash_cogs(inter, what_do):
if inter.author.id == bot_owner:
await lib.CogsPrepare.work_with_cogs(what_do, bot)
await work_with_cogs(what_do, bot)
await inter.response.send_message(f'Cogs are {what_do}ed', ephemeral=True)
else: