Untitled
unknown
python
a year ago
1.3 kB
10
Indexable
# CLASSE FECHAR TICKET (EMBED + BOTÃO)
class Delete_Button(discord.ui.Button):
def __init__(self, label, style, user, Numero_Serie):
super().__init__(label=label, style=style, custom_id=f'delete_button_{Numero_Serie}')
self.user = user
self.Numero_Serie = Numero_Serie
async def callback(self, interaction: discord.Interaction):
if any(role.id == id_Autorizado for role in interaction.user.roles):
# Exportando o chat usando o ChatExporter
chat_exporter = ChatExporter('SUA_CHAVE_CHAT_EXPORTER')
url = await chat_exporter.export(interaction.channel)
embed = discord.Embed(color=26367)
embed.add_field(name='Número de Série', value=f'`{self.Numero_Serie}`')
embed.add_field(name='Categoria criada', value=f'{self.user.mention}')
embed.set_author(name='Registros')
logs = discord.ui.Button(label='Registro', url=url)
await interaction.guild.get_channel(id_Logs).send(embed=embed, view=discord.ui.View().add_item(logs))
await interaction.response.send_message('Excluindo canal...')
await asyncio.sleep(5)
await interaction.channel.delete()
else:
await interaction.response.send_message("Você não tem permissão.", ephemeral=True)Editor is loading...
Leave a Comment