Untitled
unknown
python
a year ago
1.1 kB
8
Indexable
class CreateCallView(discord.ui.View): @discord.ui.button(label="Criar Canal de Voz", style=discord.ButtonStyle.blurple) async def CallTemp(self, interaction: discord.Interaction, button: discord.ui.Button): await CallTemp(interaction) @tree.command(guild=discord.Object(id=1254562365316399195), name="call", description="Cria um canal de voz temporário") async def CallTemp(interaction: discord.Interaction, name: str = "tempcall"): guild = interaction.guild channel = await guild.create_voice_channel(name) canalTemporario.append(channel.id) await interaction.response.send_message(f'Canal de voz temporário criado: {channel.name}', ephemeral=True) @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: await channel.delete() print(f'Canal deletado {channel.mention}') canalTemporario.remove(channel_id)
Editor is loading...
Leave a Comment