Untitled

mail@pastecode.io avatar
unknown
python
8 days ago
1.7 kB
4
Indexable
Never
class DropdownView(discord.ui.View): 
    def __init__(self): 
        super().__init__(timeout=None) 
        self.add_item(Dropdown())

class CreateTicket(discord.ui.View):
    def __init__(self):
        super().__init__(timeout=None)
        self.value=None

    @discord.ui.button(label="Abrir Ticket",style=discord.ButtonStyle.gray,emoji="📁")
    async def ticket(self,interaction: discord.Interaction, button: discord.ui.Button):
        self.value = True
        self.stop()
        ticket = None
        embedticket = discord.Embed(
            colour=26367,
            title='Suporte',
            description=f"> Olá, {interaction.user.mention}. Para adiantar o atendimento informe o assunto do seu ticket e aguarde a resposta do nosso suporte."
        )
        
        atendente = interaction.guild.get_role(staff)
        categoria = interaction.guild.get_channel(categoriadeatendimento)
        overwrites = {
            interaction.guild.default_role: discord.PermissionOverwrite(read_messages=False,send_messages=True,attach_files=True,use_application_commands=True),
            interaction.user: discord.PermissionOverwrite(read_messages=True,send_messages=True),
            atendente: discord.PermissionOverwrite(read_messages=True,send_messages=True, use_application_commands=True)
        }

        ticket = await interaction.guild.create_text_channel(f"{emojiglobal}┃{interaction.user.name}",overwrites=overwrites,category=categoria)
        await interaction.response.send_message(ephemeral=True,content=f"ticket criado \n{ticket.mention}")
        await ticket.send(embed=embedticket, view=DeleteTicket(interaction.user))
Leave a Comment