#Ticketing System

1 messages · Page 1 of 1 (latest)

proven lotus
#

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))```
#

I think I'm not allowed to put embed into button_callback1 but I don't know how to fetch the new channel made.

summer ermine
proven lotus
# summer ermine create_text_channel returns the created channel

What did I do wrong?

File "/home/container/cogs/ticket.py", line 50, in button_callback1 await create_text_channel.send(embed=embed) ^^^^^^^^^^^^^^^^^^^ NameError: name 'create_text_channel' is not defined

await create_text_channel.send(embed=embed)

I also tried

await interaction.create_text_channel.send(embed=embed)

summer ermine
#

Im telling you the method returns the channel created

#

The method is a method of guild...

#

Do you know OOP and basic python?

proven lotus
#

bruh