mirror of
https://github.com/RafaelSolVargas/Vulkan.git
synced 2025-10-29 16:57:23 +00:00
Fixing errors due to new discor d library
This commit is contained in:
@@ -2,12 +2,12 @@ from asyncio import AbstractEventLoop
|
||||
from discord import Guild, Status, Game, Message
|
||||
from discord.ext.commands.errors import CommandNotFound, MissingRequiredArgument
|
||||
from Config.Configs import Configs
|
||||
from discord.ext import commands
|
||||
from discord.ext.commands import Bot, Context
|
||||
from Config.Messages import Messages
|
||||
from Views.Embeds import Embeds
|
||||
|
||||
|
||||
class VulkanBot(commands.Bot):
|
||||
class VulkanBot(Bot):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.__configs = Configs()
|
||||
@@ -68,6 +68,6 @@ class VulkanBot(commands.Bot):
|
||||
await self.invoke(ctx)
|
||||
|
||||
|
||||
class Context(commands.Context):
|
||||
class Context(Context):
|
||||
bot: VulkanBot
|
||||
guild: Guild
|
||||
@@ -2,9 +2,10 @@ from random import choices
|
||||
import string
|
||||
from discord.bot import Bot
|
||||
from discord import Intents
|
||||
from Music.MusicBot import VulkanBot
|
||||
from Music.VulkanBot import VulkanBot
|
||||
from os import listdir
|
||||
from Config.Configs import Configs
|
||||
from Config.Exceptions import VulkanError
|
||||
|
||||
|
||||
class VulkanInitializer:
|
||||
@@ -35,9 +36,18 @@ class VulkanInitializer:
|
||||
try:
|
||||
for filename in listdir(f'./{self.__config.COMMANDS_PATH}'):
|
||||
if filename.endswith('.py'):
|
||||
print(f'Loading {filename}')
|
||||
bot.load_extension(f'{self.__config.COMMANDS_PATH}.{filename[:-3]}')
|
||||
cogPath = f'{self.__config.COMMANDS_PATH}.{filename[:-3]}'
|
||||
bot.load_extension(cogPath, store=True)
|
||||
|
||||
bot.load_extension(f'DiscordCogs.MusicCog')
|
||||
except Exception as e:
|
||||
print(e)
|
||||
if len(bot.cogs.keys()) != self.__getTotalCogs():
|
||||
raise VulkanError(message='Failed to load some Cog')
|
||||
|
||||
except VulkanError as e:
|
||||
print(f'[Error Loading Vulkan] -> {e.message}')
|
||||
|
||||
def __getTotalCogs(self) -> int:
|
||||
quant = 0
|
||||
for filename in listdir(f'./{self.__config.COMMANDS_PATH}'):
|
||||
if filename.endswith('.py'):
|
||||
quant += 1
|
||||
return quant
|
||||
|
||||
Reference in New Issue
Block a user