fixed youtube's api interaction, fixed discord connection handshake errors
This commit is contained in:
32
bot.py
32
bot.py
@@ -1,4 +1,5 @@
|
||||
from discord.ext import commands
|
||||
from discord.ext import tasks
|
||||
import config
|
||||
from cogs.music.main import music
|
||||
|
||||
@@ -8,11 +9,34 @@ cogs = [
|
||||
|
||||
class Astro(commands.Bot):
|
||||
|
||||
# Once the bot is up and running
|
||||
async def on_ready(self):
|
||||
# Set the status
|
||||
# Set status
|
||||
await self.change_presence(activity=config.get_status())
|
||||
|
||||
# Setup commands
|
||||
# Load cogs
|
||||
print(f"Loading {len(cogs)} cogs...")
|
||||
for cog in cogs:
|
||||
await self.add_cog(cog(self))
|
||||
try:
|
||||
print(f"Attempting to load: {cog.__name__}")
|
||||
await self.add_cog(cog(self))
|
||||
print(f"✅ Loaded {cog.__name__}")
|
||||
except Exception as e:
|
||||
print(f"❌ Failed to load {cog.__name__}: {e}")
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
|
||||
# Start inactivity checker
|
||||
if not self.inactivity_checker.is_running():
|
||||
self.inactivity_checker.start()
|
||||
|
||||
print(f"✅ {self.user} is ready and online!")
|
||||
|
||||
@tasks.loop(seconds=30)
|
||||
async def inactivity_checker(self):
|
||||
"""Check for inactive voice connections"""
|
||||
from cogs.music import util
|
||||
await util.check_inactivity(self)
|
||||
|
||||
@inactivity_checker.before_loop
|
||||
async def before_inactivity_checker(self):
|
||||
await self.wait_until_ready()
|
||||
|
||||
Reference in New Issue
Block a user