Untitled

mail@pastecode.io avatar
unknown
python
22 days ago
1.7 kB
1
Indexable
Never
class CreateTicket(discord.ui.View):
    def __init__(self):
        super().__init__(timeout=None)
        self.add_item(ButtonTicket(label="Suporte",style=discord.ButtonStyle.blurple,emoji="<:Suporte:1256515672016552048>"))
        self.add_item(Buttonloja(label="Loja",style=discord.ButtonStyle.blurple,emoji="<:Cartfactory:1256511668620361818>"))


class ButtonTicket(discord.ui.Button):
    def init(self, label, style):
        super().__init__(label=label, style=style)

    async def callback(self, interaction:discord.Interaction):
        self.value = True
        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.'
        )
        suporte = interaction.guild.get_role(id_suporte)
        categoria = interaction.guild.get_channel(id_categoria_suporte)
        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),
            suporte: discord.PermissionOverwrite(read_messages=True,send_messages=True, use_application_commands=True)
        }

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