Untitled

mail@pastecode.io avatar
unknown
plain_text
18 days ago
1.1 kB
1
Indexable
Never
class BotaoCall(discord.ui.View):
    def __init__(self):
        super().__init__(timeout=None)
        self.value = None

    @discord.ui.button(label="Criar Canal", style=discord.ButtonStyle.blurple, emoji='<a:mic:1255056681377992855>')
    async def Call(self, interaction: discord.Interaction, button: discord.ui.Button):
        self.value = True
        self.stop()
        call = None
        categoria = interaction.guild.get_channel(id_categoria_tempcall)
        call = await interaction.guild.create_voice_channel(f"{interaction.user.name}",category=categoria)
        await interaction.response.send_message(ephemeral=True,content=f"canal criado {call.mention}")

@tasks.loop(minutes=1)
async def check_empty_channels(interaction:discord.Interaction):
    for channel_id in canalTemporario:
        channel = interaction.guild.afk_channel(channel_id)
        if channel and len(channel.member) == 0:
            await channel.delete()
            print(f'Canal deletado {channel.mention}')
            canalTemporario.remove(channel_id)
Leave a Comment