Untitled
unknown
python
10 months ago
1.2 kB
3
Indexable
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}") canalTemporario.append(call.id) @tasks.loop(minutes=1) async def check_empty_channels(interaction: discord.Interaction): for channel_id in canalTemporario: channel = interaction.guild.get_channel(channel_id) if channel and len(channel.members) == 0: if interaction.user in channel.members: continue await channel.delete() print(f'Canal deletado {channel.mention}') canalTemporario.remove(channel_id)
Editor is loading...
Leave a Comment