mirror of
https://github.com/Matthww/TuneBot.git
synced 2026-09-21 21:27:48 +00:00
Dit moet later op een nettere manier gebeuren
This commit is contained in:
@@ -11,6 +11,7 @@ from cogs.music.interactions import MusicCommands
|
|||||||
from cogs.music.interactions import QUEUE_SIZE
|
from cogs.music.interactions import QUEUE_SIZE
|
||||||
from cogs.music.voice_client import LavalinkVoiceClient
|
from cogs.music.voice_client import LavalinkVoiceClient
|
||||||
from utils.classes import BaseCog
|
from utils.classes import BaseCog
|
||||||
|
from utils.log import logger
|
||||||
|
|
||||||
|
|
||||||
if typing.TYPE_CHECKING:
|
if typing.TYPE_CHECKING:
|
||||||
@@ -32,6 +33,7 @@ class MusicCog(BaseCog, name="Music"):
|
|||||||
|
|
||||||
redis_result = await self.bot.global_autojoin.fetch_channels()
|
redis_result = await self.bot.global_autojoin.fetch_channels()
|
||||||
for guild_id, (voicechannel_id, textchannel_id) in redis_result.items():
|
for guild_id, (voicechannel_id, textchannel_id) in redis_result.items():
|
||||||
|
try:
|
||||||
player = self.bot.lavalink.player_manager.create(guild_id)
|
player = self.bot.lavalink.player_manager.create(guild_id)
|
||||||
player.store("channel", textchannel_id)
|
player.store("channel", textchannel_id)
|
||||||
voice_channel = await self.bot.fetch_channel(voicechannel_id)
|
voice_channel = await self.bot.fetch_channel(voicechannel_id)
|
||||||
@@ -39,6 +41,9 @@ class MusicCog(BaseCog, name="Music"):
|
|||||||
if not player.is_playing:
|
if not player.is_playing:
|
||||||
await helper.fill_player_queue(self.bot, player, QUEUE_SIZE)
|
await helper.fill_player_queue(self.bot, player, QUEUE_SIZE)
|
||||||
await player.play()
|
await player.play()
|
||||||
|
except:
|
||||||
|
logger.error(f"Failed to autojoin guild {guild_id}.")
|
||||||
|
|
||||||
|
|
||||||
async def track_hook(self, event: lavalink.Event):
|
async def track_hook(self, event: lavalink.Event):
|
||||||
if isinstance(event, lavalink.events.QueueEndEvent):
|
if isinstance(event, lavalink.events.QueueEndEvent):
|
||||||
|
|||||||
Reference in New Issue
Block a user