-
Been trying to get mafic working for the past couple hours, successfully got it working but an issue I have is with the player. I do not have a way of having a player object i can work with throughout the cog, in terms of |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
@staticmethod
async def get_player(ctx: Context) -> mafic.Player:
if not ctx.guild.voice_client:
player = await ctx.author.voice.channel.connect(cls=mafic.Player)
else:
player = ctx.guild.voice_client
return player You can use this, basically what it does is it first checks if there's no player for the guild the command was invoked in, and if there isn't it creates one, otherwise it returns the already existing player object for that guild |
Beta Was this translation helpful? Give feedback.
You can use this, basically what it does is it first checks if there's no player for the guild the command was invoked in, and if there isn't it creates one, otherwise it returns the already existing player object for that guild