from discord.ext import commands class Loop(commands.Cog): def __init__(self, bot): self.bot = bot self.looping = {} def is_looping(self, guild_id): return self.looping.get(guild_id, False) def set_looping(self, guild_id, value): self.looping[guild_id] = value @commands.slash_command(name="loop", description="włącz/wyłącz loopowanie dla bieżącej melodyji") async def loop(self, ctx): guild_id = ctx.guild.id looping = not self.is_looping(guild_id) self.set_looping(guild_id, looping) await ctx.respond(f"looping jest teraz {'włączony' if looping else 'wyłączony'}.") def setup(bot): bot.add_cog(Loop(bot))