REF: Removed the Twitch Module for now
This commit is contained in:
25
main.py
25
main.py
@@ -1,21 +1,31 @@
|
||||
import discord
|
||||
from config import config
|
||||
import logging
|
||||
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
|
||||
TOKEN = config['DISCORD_TOKEN']
|
||||
GUILD_ID = config['GUILD_ID']
|
||||
DISCORD_CHANNEL_ID = config['DISCORD_CHANNEL_ID']
|
||||
|
||||
intents = discord.Intents.default()
|
||||
intents.messages = True
|
||||
guild = discord.Object(id=GUILD_ID)
|
||||
|
||||
|
||||
class Selena(discord.Client):
|
||||
def __init__(self):
|
||||
super().__init__(intents=intents)
|
||||
self.tree = discord.app_commands.CommandTree(self)
|
||||
self.twitch = None
|
||||
self.load_modules()
|
||||
|
||||
async def setup_hook(self):
|
||||
logging.info("Setting up modules...")
|
||||
if self.twitch:
|
||||
logging.info("Setting up Twitch module asynchronously...")
|
||||
await self.twitch.setup_hook()
|
||||
self.tree.copy_global_to(guild=discord.Object(id=GUILD_ID))
|
||||
await self.tree.sync(guild=discord.Object(id=GUILD_ID))
|
||||
|
||||
def load_modules(self):
|
||||
if config['modules']['currency']['enabled']:
|
||||
from modules.user.currency import Currency
|
||||
@@ -27,21 +37,12 @@ class Selena(discord.Client):
|
||||
xp = XP(self)
|
||||
xp.setup(self.tree)
|
||||
|
||||
if config['modules']['twitch']['enabled']:
|
||||
from modules.social.twitch import Twitch
|
||||
twitch = Twitch(self)
|
||||
twitch.setup(self.tree)
|
||||
|
||||
async def setup_hook(self):
|
||||
self.tree.copy_global_to(guild=guild)
|
||||
await self.tree.sync(guild=guild)
|
||||
|
||||
|
||||
bot = Selena()
|
||||
|
||||
|
||||
@bot.event
|
||||
async def on_ready():
|
||||
print(f'{bot.user.name} has connected to Discord!')
|
||||
logging.info(f'Bot {bot.user.name} has connected to Discord!')
|
||||
|
||||
bot.run(TOKEN)
|
||||
|
Reference in New Issue
Block a user