Skip to main content

What you'll build

Members press Open a ticket. Your bot makes a private channel just for them and your staff, with a number like ticket-12. When the problem is solved, someone presses Close and the channel is deleted.

Before you start

  • Make a category in your server called Tickets.
  • Make a Staff role.
  • Your bot needs the Manage Channels permission.

The variables to make

Or add Ticket counter from What do you want to make? on the Database page.

/ticket-panel

1

Make the command

A Slash command called ticket-panel.
2

Staff only

Add the check that looks at permissions (search permission): Manage Server. Under its Else block: Reply Only staff can post the panel.
3

The panel: straight under the check

Add a message block with a button (search button): text Need help? Press the button. and a button called Open a ticket.

What Open a ticket does

Under the Open a ticket button:
1

One ticket at a time

Add Compare: is {DBVAR_has-ticket} equal to true? Straight under it: Reply privately You already have a ticket open.
2

Count it: under the Else block

Do the maths on ticket-count: var + 1.
3

Remember they have one

Save a value on has-ticket, Whose variable The member who started this, Value true.
4

Make the channel

Add the block that creates a channel (search create a channel):
  • Name: ticket-{DBVAR_ticket-count}
  • Put it in the Tickets category.
  • Let only the person who pressed the button and the Staff role see it.
5

Say hello in the new channel

Add a message block that sends into the new channel, with a Close button: Hi {user_displayName}! Tell us what's wrong. Staff will be here soon.
6

Tell the member

Reply privately to the person: Your ticket is open!

What Close does

Under the Close button:
1

Keep a copy (optional, Premium)

Add the block that saves a transcript (search transcript) and send it to a staff log channel, so you keep a copy of the chat. This block needs Premium.
2

Let them open a new one later

Save a value on has-ticket, Whose variable The member who started this, Value false.
3

Warn, then wait

Send a message Closing this ticket... and add a Pause for a few seconds, so people can see what happens.
4

Delete the channel

Add the block that deletes a channel (search delete a channel) and pick the current channel.
The Close step resets has-ticket for the person who presses Close. So ask the member to press Close themselves. If staff close it instead, open the Database page, press Stored values on has-ticket and use Add value to set that member back to false.

Try it

  1. Type /ticket-panel in your help channel.
  2. Press Open a ticket. A channel called ticket-1 appears in Tickets.
  3. Press Open a ticket again. The bot says you already have one.
  4. Press Close in the ticket. The channel is deleted after a few seconds.
No channel? Check the bot has Manage Channels and look in Error Logs.

Make it yours

  • Ask a question first: add a pop-up form under Open a ticket (“What do you need help with?”) and post the answer in the new channel. See Pop-up forms.
  • Ping staff: put {^Staff} in the hello message.