Discord-Ticket-System

Take your time and work your way through the tutorial. If you have any problems, feel free to contact me via discord.

If you are using the ticket system, please give the repository a star and / or create a fork.

Requirements

  • Python3 (Tested with version: 3.9.7)
  • Database (I am using a local PostgreSQL-Database)
  • discord.py (Tested with version: 1.7.3)
  • asyncpg (Tested with version: 0.24.0)

How to create a local PostgreSQL Database

Download the installer from the website.

Start the installation by double-clicking on postgresql-13.4-1-windows-x64.exe.

A setup window will pop up. You should see these steps during the installation:

Installation Directory

Select Components

Data Directory

Password -> Choose a secure password and don't forget it!

Port

Advanced Options

Pre Installation Summary

Ready to Install

Start the installation.

After the installation is complete, you can click on Finish.

Open the PostgreSQL folder (C:\ProgramData\Microsoft\Windows\Start Menu\Programs\PostgreSQL 13) and double click on pgAdmin4.

After pgAdmin4 has loaded, it will ask you for the password you chose during the installation.

Click on Servers on the left side and open Databases. You can see that one database with the name postgres already exists.

Right click on Databases and select Create Database. Name it PostgreSQL-Tickets and click on save.

Open the database and scroll down to Schemas. After opening Shemas, you should see Tables a little further down.

Right click on Tables and select Create Table. Call it tickets and add two columns named guild_id and ticket_id. Example

Fill in your guild_id and save the changes.

Create a second table named requests and add four columns: guild_id, channel_name, channel_id, and user_id. Example

Create the same bot for your server

Open the discord developer portal and create a new application.

Click on Bot on the left side and add a new one. Make sure to enable Intents.

Open data.json and fill in your bot-token and db-password. (The one you created at the beginning)

On your discord server: Create a category named tickets and a channel also named tickets.

Start the bot via the command line and type ?ticket in the tickets channel. You should see this message.

You can now click on the small envelope below the message. A new channel should appear.

That's pretty much all. If you like the system, I would be happy if you put a star on the repository :)

If you want to change the embed-message open ticket.py.


@commands.command()
@commands.has_permissions(administrator=True)
async def ticket(self, ctx):

    embed = discord.Embed(
        description="Any questions or concerns? We will be happy to assist you.", 
        color=0x2F3136
    )

    embed.set_author(name="TiLiKas-Tickets")

    embed.add_field(
        name="Have you checked if someone already had the problem?",
        value="To make our work easier, we would be grateful if you first discuss your problem with other members. That takes some work off our shoulders and may also save you some time.",
        inline=False
    )

    embed.set_footer(text="NOTICE : one user can only have three tickets at once!")
    embed.set_thumbnail(url=ctx.me.avatar_url)

    msg = await ctx.send(embed=embed)
    await msg.add_reaction("?")

There are three options for the message in the ticket channel.

✅ -> Claim the ticket (The creator of the ticket cant claim it)

? -> Mention every supporter (Does not do anything right now - I'm at it!)

? -> Close the ticket - the channel will be delete after 10 seconds.

After clicking on the lock, the channel will be deleted and a new channel named ticket-log will pop up.

GitHub - Sk1pzz/Discord-Ticket-System: A public repository for my discord ticket system.
A public repository for my discord ticket system. Contribute to Sk1pzz/Discord-Ticket-System development by creating an account on GitHub.