ralphkb / sentinel-tickets

Sentinel Tickets is a free and configurable open source discord ticket bot without watermarks or bloat.
https://sentineltickets.com
MIT License
34 stars 8 forks source link

Cannot read properties of undefined (reading 'children') #57

Closed LucasB25 closed 4 months ago

LucasB25 commented 4 months ago
  - id: 3 # Unique ID for each category
    name: "jointheteam"
    categoryID: "1111368437835509790" # The ID of the category where those tickets will be created
    closedCategoryID: "1111368437835509790" # The ID of the category where the closed tickets will go
    support_role_ids: ["1109768898175316019"] # The IDs of the staff roles on your server that can access only this ticket category, for example ["000000000000000000", "111111111111111111"]
    pingRoles: true # Enable or disable pinging roles when a ticket is opened in this category
    ping_role_ids: ["1109768898175316019"] # The IDs of the roles you want to ping when a ticket is opened in this category,, for example ["000000000000000000", "111111111111111111"]
    ghostPingRoles: false # Enable or disable ghost pinging the ping_role_ids when a ticket is opened, use either {support-roles} in textContent below or this option, avoid using both because then the support roles will receive 2 pings
    textContent: "Please wait for the {support-roles} to check your ticket!" # The text content that is sent alongside the embed, use {support-roles} for the support roles only if you enabled pingRoles above
    creatorRoles: [] # The IDs of the roles that can create tickets in this category, keep it empty to allow all roles to create tickets
    buttonEmoji: "🔨" # The emoji of the button
    buttonLabel: "Join The Team" # The name of the button
    buttonStyle: "Primary" # Options: "Primary" which is blurple, "Secondary" which is grey, "Success" which is green, "Danger" which is red and do NOT use "Link"
    menuEmoji: "🔨" # The emoji of the select menu option
    menuLabel: "Join The Team" # The name of the select menu option
    menuDescription: "Click on this option to open a Join The Team ticket!" # The description of the select menu option
    embedTitle: "Join The Team" # The title of the embed
    color: "#ADD8E6" # The color of embed in the opened ticket
    description: "Welcome {user} ({user.tag}) to your report ticket! Please be patient while a staff member responds." # The description of the embed in the created ticket, right above the questions fields
    ticketName: "USERNAME" # Can be USERNAME or TICKETCOUNT
    ticketTopic: "Ticket Creator: {user} | Ticket Type: {type}" # The topic of the ticket channel
    slowmode: "0" # The slowmode of the ticket channel in seconds, keep it 0 if you don't want a slowmode and do not use negative values
    useCodeBlocks: false # Set this to true if you want to use code blocks to display the answers of the ticket category questions
    modalTitle: "Join The Team Ticket Format" # The title of the modal
    questions: # Maximum number of questions is 5, you should at least keep 1 question since that information will always help you in any ticket
      - label: "Your age"
        placeholder: "16y"
        style: "Short" # Short or Paragraph
        required: true # If this input is required or not, can be true or false
        minLength: 2 # Set the minimum number of characters required for submission
const findAvailableCategory = async (categoryIDs) => {
  for (const categoryID of categoryIDs) {
    const category = client.channels.cache.get(categoryID);
    const channelCount = category.children.cache.size;
    if (channelCount < 50) {
      return categoryID;
    }
  }
  return null; // No available category found
};
Error creating ticket: TypeError: Cannot read properties of undefined (reading 'children')
    at findAvailableCategory (/home/pi/MusicBot/LucasB25/PanaisSupport/index.js:215:35)
    at /home/pi/MusicBot/LucasB25/PanaisSupport/events/interactionCreate.js:2242:46
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

I don’t understand what the problem is