diff options
| author | SamlonDev <stankiewiczgracjan2019@gmail.com> | 2025-05-20 05:45:23 +0200 |
|---|---|---|
| committer | SamlonDev <stankiewiczgracjan2019@gmail.com> | 2025-05-20 05:45:23 +0200 |
| commit | fcc3635b9f24051ae07ed597632597e20372c889 (patch) | |
| tree | 20a29a1a784f218b3623ff03ceb8084839ff606a /cogs/music/loop.py | |
| download | senator-sperma-fcc3635b9f24051ae07ed597632597e20372c889.tar.gz senator-sperma-fcc3635b9f24051ae07ed597632597e20372c889.zip | |
initial push
Diffstat (limited to '')
| -rw-r--r-- | cogs/music/loop.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/cogs/music/loop.py b/cogs/music/loop.py new file mode 100644 index 0000000..5f51c7e --- /dev/null +++ b/cogs/music/loop.py | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | from discord.ext import commands | ||
| 2 | |||
| 3 | class Loop(commands.Cog): | ||
| 4 | def __init__(self, bot): | ||
| 5 | self.bot = bot | ||
| 6 | self.looping = {} | ||
| 7 | |||
| 8 | def is_looping(self, guild_id): | ||
| 9 | return self.looping.get(guild_id, False) | ||
| 10 | |||
| 11 | def set_looping(self, guild_id, value): | ||
| 12 | self.looping[guild_id] = value | ||
| 13 | |||
| 14 | @commands.slash_command(name="loop", description="włącz/wyłącz loopowanie dla bieżącej melodyji") | ||
| 15 | async def loop(self, ctx): | ||
| 16 | guild_id = ctx.guild.id | ||
| 17 | looping = not self.is_looping(guild_id) | ||
| 18 | self.set_looping(guild_id, looping) | ||
| 19 | await ctx.respond(f"looping jest teraz {'włączony' if looping else 'wyłączony'}.") | ||
| 20 | |||
| 21 | def setup(bot): | ||
| 22 | bot.add_cog(Loop(bot)) \ No newline at end of file | ||
