aboutsummaryrefslogtreecommitdiffstats
path: root/cogs/music/join.py
blob: d68ca79f06a23624963f3e2e75cd593c9e5bdd6d (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
# 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
from cogs.voice import get_voice_manager

logger = logging.getLogger(__name__)


class Join(commands.Cog):
    def __init__(self, bot):
        self.bot = bot

    @commands.slash_command(name="join", description="dołącza do kanalu")
    async def join(self, ctx):
        voice_mgr = get_voice_manager(self.bot)
        channel = ctx.author.voice.channel
        await voice_mgr.connect(channel)
        await ctx.respond(content="\u200b", ephemeral=True)
        await ctx.interaction.delete_original_response()
        logger.info("Bot connected to voice channel")


def setup(bot):
    bot.add_cog(Join(bot))