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/queue.py | |
| download | senator-sperma-fcc3635b9f24051ae07ed597632597e20372c889.tar.gz senator-sperma-fcc3635b9f24051ae07ed597632597e20372c889.zip | |
initial push
Diffstat (limited to '')
| -rw-r--r-- | cogs/music/queue.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/cogs/music/queue.py b/cogs/music/queue.py new file mode 100644 index 0000000..29f0c36 --- /dev/null +++ b/cogs/music/queue.py | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | from discord.ext import commands | ||
| 2 | |||
| 3 | class Queue(commands.Cog): | ||
| 4 | def __init__(self, bot): | ||
| 5 | self.bot = bot | ||
| 6 | self.queues = {} | ||
| 7 | |||
| 8 | def get_queue(self, guild_id): | ||
| 9 | return self.queues.setdefault(guild_id, []) | ||
| 10 | |||
| 11 | @commands.slash_command(name="koleyjka", description="pokazuje koleyjke") | ||
| 12 | async def queue(self, ctx): | ||
| 13 | guild_id = ctx.guild.id | ||
| 14 | queue = self.get_queue(guild_id) | ||
| 15 | if queue: | ||
| 16 | queue_str = "\n".join(f"{i+1}. {title}" for i, (_, title, _) in enumerate(queue)) | ||
| 17 | await ctx.respond(f"koleyjka:\n{queue_str}") | ||
| 18 | else: | ||
| 19 | await ctx.respond("koleyjka jest pustawa") | ||
| 20 | |||
| 21 | def setup(bot): | ||
| 22 | bot.add_cog(Queue(bot)) \ No newline at end of file | ||
