blob: 5f51c7ec4470a5a917182d9ae1be19417898041b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
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))
|