# This file is part of Senator Sperma # Licensed under the GPL-3.0 License # Copyright (C) 2026 Salmonik @ salmonik@tuta.io # https://codeberg.org/salmonik/senator-sperma from discord.ext import commands import logging logger = logging.getLogger(__name__) 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'}.") logger.info(f"Looping has been {'enabled' if looping else 'disabled'} for guild {guild_id}") def setup(bot): bot.add_cog(Loop(bot))