mirror of
https://github.com/RafaelSolVargas/Vulkan.git
synced 2025-10-29 16:57:23 +00:00
Adding Cleaner and fixing bugs
This commit is contained in:
55
main.py
55
main.py
@@ -1,23 +1,38 @@
|
||||
import discord
|
||||
import os
|
||||
|
||||
from distutils.command.config import config
|
||||
from discord import Intents, Client
|
||||
from os import listdir
|
||||
from Config.Config import Configs
|
||||
from discord.ext import commands
|
||||
|
||||
intents = discord.Intents.default()
|
||||
intents.members = True
|
||||
config = Configs()
|
||||
|
||||
bot = commands.Bot(command_prefix=config.BOT_PREFIX, pm_help=True,
|
||||
case_insensitive=True, intents=intents)
|
||||
bot.remove_command('help')
|
||||
|
||||
if config.BOT_TOKEN == "":
|
||||
exit()
|
||||
|
||||
for filename in os.listdir('./Commands'):
|
||||
if filename.endswith('.py'):
|
||||
bot.load_extension(f'Commands.{filename[:-3]}')
|
||||
from discord.ext.commands import Bot
|
||||
|
||||
|
||||
bot.run(config.BOT_TOKEN, bot=True, reconnect=True)
|
||||
class VulkanInitializer:
|
||||
def __init__(self) -> None:
|
||||
self.__config = Configs()
|
||||
self.__intents = Intents.default()
|
||||
self.__intents.members = True
|
||||
self.__bot = self.__create_bot()
|
||||
self.__add_cogs(self.__bot)
|
||||
|
||||
def __create_bot(self) -> Client:
|
||||
bot = Bot(command_prefix=self.__config.BOT_PREFIX,
|
||||
pm_help=True,
|
||||
case_insensitive=True,
|
||||
intents=self.__intents)
|
||||
bot.remove_command('help')
|
||||
return bot
|
||||
|
||||
def __add_cogs(self, bot: Client) -> None:
|
||||
for filename in listdir(f'./{self.__config.COMMANDS_PATH}'):
|
||||
if filename.endswith('.py'):
|
||||
bot.load_extension(f'{self.__config.COMMANDS_PATH}.{filename[:-3]}')
|
||||
|
||||
def run(self) -> None:
|
||||
if self.__config.BOT_TOKEN == '':
|
||||
print('DEVELOPER NOTE -> Token not found')
|
||||
exit()
|
||||
|
||||
self.__bot.run(self.__config.BOT_TOKEN, bot=True, reconnect=True)
|
||||
|
||||
|
||||
vulkan = VulkanInitializer()
|
||||
vulkan.run()
|
||||
|
||||
Reference in New Issue
Block a user