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.
- 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)
-
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:
-
Password -> Choose a secure password and don't forget it!
-
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 openDatabases
. You can see that one database with the namepostgres
already exists. -
Right click on
Databases
and selectCreate Database
. Name itPostgreSQL-Tickets
and click on save. -
Open the database and scroll down to
Schemas
. After opening Shemas, you should seeTables
a little further down. -
Right click on
Tables
and selectCreate Table
. Call ittickets
and add two columns namedguild_id
andticket_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
, anduser_id
. Example
-
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 yourbot-token
anddb-password
. (The one you created at the beginning) -
On your discord server: Create a category named
tickets
and a channel also namedtickets
. -
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 :)
@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.
If you did everything correctly your bot should work like in the examples!
Still questions? Join my discord server.
Please understand that I cannot explain how it works with other databases.