blob: 6e2c838c17913b516f624d856c29fee841f40da7 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# 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
import logging
from discord.ext import commands
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))
|