Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

119
Views
Ticket bot only saying the id's

I am back again with a question :). I am building my own ticket function, and I just started but if I create a channel for a ticket, its only saying ticket-(Discord account ID) And thats also the case by the embed. Anyone who can look at it?

const discord = require("discord.js");
const { MessageEmbed, Collection, Permissions} = require('discord.js');
const { execute } = require("./ticket");

module.exports = {
    name: 'create',
    description: 'create your own ticket.',
    execute(message, client, args){

        if(message.guild.channels.cache.find(channel => channel.name ===   "Ticket from <@" + message.author + ">")) {
            message.reply(`${message.member.user.toString()} **You have successfully created a ticket, Please click on ${channel} to view your ticket**`).then(m => m.delete({ timeout: 14000 }).catch(e => {}));

            if(message.guild.channels.cache.find(channel => channel.name === `ticket-${message.author.id}`)) {
                return message.reply('<a:no:784463793366761532> **You already have a ticket, please close your exsisting ticket first before opening a new one**');
        }

        message.delete();

        message.guild.channels.create(`Ticket ${message.author}`, {
            permissionOverwrites: [
                {
                    id: message.author.id,
                    allow: ['SEND_MESSAGES', 'VIEW_CHANNEL'],
                },
                {
                    id: message.guild.roles.everyone,
                    deny: ['VIEW_CHANNEL'],
                },
            ],
            type: 'text',
        }).then(async channel => {
            const embed = new MessageEmbed()
            .setTitle("<@" + message.author + "> Ticket")
            .setDescription(`**${message.author}, Welcome to your channel! Support will be arriving soon**\n**While you wait please tell us what your problem is**\n**If you want to close the ticket please type .close\`**`)
            .setColor("BLUE")
            channel.send({ embeds: [embed] })
        });
    }
}
}
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I cleaned up the code a fair bit, less is more. Text channels do not have spaces in them so I replaced them with what Discord uses, hypens. The below code will check if a channel already exists and create one if it doesn't.

const {
    MessageEmbed,
} = require('discord.js');

module.exports = {
    name: 'create',
    description: 'create your own ticket.',
    async execute(message, client, args) {
        const channelName = `ticket-${message.author.username}`
        const existing = message.guild.channels.cache.find(channel => channel.name === channelName.toLowerCase());

        if (existing) {
            return message.reply({
                content: `<a:no:784463793366761532> **You already have a ticket, please close your exsisting ticket first before opening a new one**\n${existing}.`,
            }).then((m) => {
                setTimeout(() => {
                    m.delete();
                }, 14000);
            })
        }

        message.delete();

        message.guild.channels.create(channelName, {
            type: 'GUILD_TEXT',
            permissionOverwrites: [{
                id: message.guild.id,
                deny: ['VIEW_CHANNEL'],
            }, {
                id: message.author.id,
                allow: ['SEND_MESSAGES', 'VIEW_CHANNEL'],
            }],
        }).then(async channel => {
            const embed = new MessageEmbed()
                .setColor("BLUE")
                .setTitle(`${message.author.username} Ticket`)
                .setDescription(`**${message.author}, Welcome to your channel! Support will be arriving soon**\n**While you wait please tell us what your problem is**\n**If you want to close the ticket please type .close\`**`)
            channel.send({
                embeds: [embed]
            })
        });
    }
}
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!