mirror of
https://github.com/RafaelSolVargas/Vulkan.git
synced 2025-10-29 16:57:23 +00:00
Changing the organization of the project
This commit is contained in:
33
main.py
33
main.py
@@ -1,23 +1,30 @@
|
||||
import os
|
||||
import discord
|
||||
from dotenv import dotenv_values
|
||||
|
||||
from config import config
|
||||
from discord.ext import commands
|
||||
|
||||
TOKEN_BOT = dotenv_values('.env')['TOKEN_BOT']
|
||||
|
||||
intents = discord.Intents.default()
|
||||
intents.members = True
|
||||
|
||||
client = commands.Bot(command_prefix="!",
|
||||
case_insensitive=True, intents=intents)
|
||||
client.remove_command('help')
|
||||
bot = commands.Bot(command_prefix=config.BOT_PREFIX, pm_help=True,
|
||||
case_insensitive=True, intents=intents)
|
||||
bot.remove_command('help')
|
||||
|
||||
if __name__ == '__main__':
|
||||
config.ABSOLUTE_PATH = os.path.dirname(os.path.abspath(__file__))
|
||||
config.COOKIE_PATH = config.ABSOLUTE_PATH + config.COOKIE_PATH
|
||||
|
||||
if config.BOT_TOKEN == "":
|
||||
print("Error: No bot token!")
|
||||
exit()
|
||||
|
||||
for extension in config.INITIAL_EXTENSIONS:
|
||||
try:
|
||||
bot.load_extension(extension)
|
||||
except Exception as e:
|
||||
print(e)
|
||||
|
||||
|
||||
def load_cogs(bot):
|
||||
for filename in os.listdir('cogs'):
|
||||
if filename.endswith('.py'):
|
||||
bot.load_extension(f'cogs.{filename[:-3]}')
|
||||
|
||||
|
||||
load_cogs(client)
|
||||
client.run(TOKEN_BOT)
|
||||
bot.run(config.BOT_TOKEN, bot=True, reconnect=True)
|
||||
|
||||
Reference in New Issue
Block a user