Hello, I'm making a ticket system for my server. Im relative new to pycord and don't know how to code this.
What I want:
User clicks on "ticket create" button -- works
New channel will be created -- works
A new embed will be sent into the new channel *-- not * working / idk how
The user will get a ephemeral message that his ticket was created - should work
This is my code:
import discord
from discord.ext import commands, tasks
from discord.commands import slash_command, message_command, user_command, Option
import asyncio
import ezcord
class Ticket(ezcord.Cog, emoji=":ticket:"):
# Ticket System in pycord
@slash_command()
@discord.default_permissions(administrator=True)
async def ticket(self, ctx):
embed3 = discord.Embed(
title="ArcaneNetworks | Ticket Erstellen",
description=f"Erstelle ein Ticket, indem du auf **Ticket erstellen** drückst.",
color=discord.Color.red(),
)
embed3.set_image(url="https://i.ibb.co/SmjMBnC/Arcane-Network-2-1.gif")
await ctx.send(embed=embed3, view=ANView())
class ANView(discord.ui.View):
def __init__(self):
super().__init__(timeout=None)
@discord.ui.button(label="Ticket erstellen", style=discord.ButtonStyle.primary, emoji=":tickets:", custom_id="ticket")
async def button_callback1(self, button, interaction):
guild = interaction.guild
await interaction.guild.create_text_channel(f"ticket", category=interaction.channel.category)
staff_role = guild.get_role(1191214100508852364)
await interaction.channel.set_permissions(staff_role, read_messages=True, send_messages=True)
embed = discord.Embed(
title="ArcaneNetworks | Neues Ticket",
description=f"hat ein neues Ticket erstellt.\n {staff_role.mention}",
color=discord.Color.red(),
)
embed.set_footer(text="Bitte warte bis sich ein Teammitglied meldet.")
embed.set_image(url="https://i.ibb.co/SmjMBnC/Arcane-Network-2-1.gif")
await send(embed=embed)
embed2 = discord.Embed(
title="ArcaneNetworks | Ticket",
description=f"Dein Ticket wurde erstellt: {interaction.channel.mention}",
color=discord.Color.red(),
)
await interaction.respond(embed=embed2, ephemeral=True)
def setup(bot: discord.Bot):
bot.add_cog(Ticket(bot))```