I apologize for the delay. Here is the code, feel free to add more features and customize it as you like. Obviously, create additional onlyIf conditions since I've included only the basics. By the way, the variable you need is this: ticketrole: "none"
.
Edit: Before you mention it, yes, I know there's a specific function for creating tickets. However, I was encountering an error that said it couldn't read the 'id' property, meaning the $let variable was undefined. I tried fixing it by modifying the code, but I couldn't find the solution. So, I opted to use $createChannel.
module.exports = [
{
name: "setrole",
code: `
$setGuildVar[ticketrole;$findRole[$message[1];$guildID]]
$author[1;$username;$userAvatar[$authorID]]
$description[1;The <@&$findRole[$message[1];$guildID]> role has been set as the ticket moderation role.]
$color[1;Random]
$onlyIf[$roleExists[$findRole[$message[1];$guildID];$guildID]==true;The chosen role was not found or does not exist]
$onlyIf[$message[1]!=;You must mention or write the name/ID of the role you want to set as the ticket moderator.]
$onlyPerms[manageroles;You do not have the necessary permissions to set the ticket role]
`
},{
name: "panel",
code: `
$author[1;Ticket Panel]
$description[1;Click on the "Create Ticket" button to create a new ticket.]
$color[1;Random]
$addButton[1;Create Ticket;success;createticket;false]
$onlyIf[$getGuildVar[ticketrole]!=none;You must set the ticket role to access the ticket panel.]
$onlyPerms[manageguild;You do not have the necessary permissions to set the ticket role]
`
},{
name: "createticket",
type: "interaction",
prototype: "button",
code: `
$interactionReply[Ticket created successfully <#$get[id]>;;;;everyone;true]
$channelSendMessage[$get[id];{newEmbed:{author:$username:$userAvatar[$authorID]}{description:Ticket created by: $username}{color:Green}}{actionRow:{button:Close Ticket:danger:closeticket:false}};returnID?]
$modifyChannelPerms[$get[id];$guildID;-viewchannel]
$modifyChannelPerms[$get[id];$getGuildVar[ticketrole];+viewchannel;+sendmessages]
$modifyChannelPerms[$get[id];$authorID;+viewchannel;+sendmessages]
$let[id;$createChannel[$guildID;ticket-$username;Text;true]]
`
},{
name: "closeticket",
type: "interaction",
prototype: "button",
code: `
$deleteChannel[$channelID]
$wait[10s]
$interactionReply[The ticket will be closed in 10 seconds;;;;everyone;false]
`
}
];