YAGPDB by default supports tickets which can be opened using /ticket open. But reaction roles don’t work that easily. So I wrote some code to add this feature.
You can also watch the video (uses text to speech).
Guide
- In YAGPDB.xyz, select a server.
- Go to “custom commands” under core.
- Add a custom command that is triggered by reactions (added and removed)
- Paste the below code. Change from the lines 3 till 5 the 12345678 to the IDs of the actual channels and catagories in your Discord server. To get the ID of a channel or catagory, you should enable developer options in your Discord settings.
{{/* Change values here */}}
{{$Ticket_Catagory:= 123456789012345678 }} {{/*Catagory in which tickets created are in. USE THE SAME AS THE ONE IN TICKET SYSTEM*/}}
{{$Making_Ticket_Channel:= 123456789012345678 }}
{{$Making_Ticket_Message:= 123456789012345678 }}
{{$Making_Ticket_Emoji:= "๐ซ"}}
{{$Solving_Ticket_Emoji:="๐"}}
{{$ao_Emoji:="๐ก๏ธ"}}
{{/* Solving the ticket Embed */}}
{{$st1 := print "Now the mod " .User.Mention " is solving this ticket!"}}
{{$st2 := print "Looks like the mod " .User.Mention " could not solve your problem.\nDon't worry! Another staff member is coming to help you ASAP!"}}
{{/* Admin Only Embed */}}
{{$ao1 := cembed "description" (print $ao_Emoji " This ticket is now in Admin Only mode") "color" 1752220}}
{{$ao2 := cembed "description" "This ticket is no longer in Admin Only mode" "color" 1752220}}
{{/* Code */}}
{{$IS_Admin:=false}}
{{if in (slice (exec "viewperms") (add 25 (len .User.Username))) `Administrator`}}
{{$IS_Admin =true}}
{{end}}
{{$IS_Mod:=false}}
{{if in (slice (exec "viewperms") (add 25 (len .User.Username))) `ManageMessages`}}
{{$IS_Mod =true}}
{{end}}
{{/*Open Ticket*/}}
{{if eq .Channel.ID $Making_Ticket_Channel}}
{{if .ReactionAdded}}
{{if eq .Reaction.Emoji.Name $Making_Ticket_Emoji}}
{{exec "ticket open ticket"}}
{{deleteMessageReaction nil $Making_Ticket_Message .User.ID $Making_Ticket_Emoji}}
{{deleteResponse 7}}
{{end}}
{{end}}
{{end}}
{{/* In ticket reactions */}}
{{if eq .Channel.ParentID $Ticket_Catagory}}
{{/* Close Ticket */}}
{{if .ReactionAdded}}
{{if eq .Reaction.Emoji.Name "๐"}}
{{deleteMessageReaction nil .ReactionMessage.ID .User.ID "๐"}}
{{addReactions "โ" "โ
"}}
{{end}}
{{if eq .Reaction.Emoji.Name "โ
"}}
{{exec "ticket close"}}
{{end}}
{{if eq .Reaction.Emoji.Name "โ"}}
{{deleteMessageReaction nil .ReactionMessage.ID .User.ID "โ
" "โ"}}
{{deleteMessageReaction nil .ReactionMessage.ID 204255221017214977 "โ
" "โ"}}
{{end}}
{{end}}
{{/* Admin Only Ticket */}}
{{if eq .Reaction.Emoji.Name $ao_Emoji}}
{{if $IS_Admin}}
{{$s := exec "ticket ao"}}
{{if .ReactionAdded}}
{{sendMessage nil $ao1}}
{{else}}
{{sendMessage nil $ao2}}
{{end}}
{{else}}
{{deleteMessageReaction nil .ReactionMessage.ID .User.ID $ao_Emoji}}
{{end}}
{{end}}
{{/* SOLVING TICKET */}}
{{if eq .Reaction.Emoji.Name $Solving_Ticket_Emoji}}
{{if or ($IS_Mod) ($IS_Admin)}}
{{if .ReactionAdded}}
{{sendMessage nil (cembed "description" $st1 "color" 1752220)}}
{{else}}
{{sendMessage nil (cembed "description" $st2 "color" 1752220)}}
{{end}}
{{else}}
{{deleteMessageReaction nil .ReactionMessage.ID .User.ID $Solving_Ticket_Emoji}}
{{end}}
{{end}}
{{/* End For the Catagory ID */}}
{{end}}
{{/* This comment and everything under it can be delted */}}
{{addMessageReactions $Making_Ticket_Channel $Making_Ticket_Message $Making_Ticket_Emoji}}
Next, go to “Ticket system” under tools & utilities, then paste this code.
{{$content := print "Welcome " .User.Mention ", a staff member will be here shortly."}}
{{$descr := print "Thank you " .User.Mention " for reaching to our Staff Team! While you wait, please explain your issue so that we can help you.\n\nAn available mod will use the ๐ icon to assign the ticket to them self.\n\nClick on ๐ to close the ticket."}}
{{$embed := cembed "color" 15218176 "description" $descr}}
{{$id := sendMessageNoEscapeRetID nil (complexMessage "content" $content "embed" $embed)}}
{{addMessageReactions nil $id "๐" "๐" "๐ก๏ธ"}}
React with anything to any message. The bot should add the emoji reactions. And you should be done.
If you have questions, don’t feel free to ask me. I wrote this years ago and have no idea how this works.