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

118
Views
Ticket bot solo dice la identificación

Vuelvo otra vez con una pregunta :). Estoy creando mi propia función de ticket, y acabo de empezar, pero si creo un canal para un ticket, solo dice ticket-(ID de cuenta de Discord) Y ese también es el caso de la inserción. ¿Alguien que pueda mirarlo?

 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

Limpié un poco el código, menos es más. Los canales de texto no tienen espacios en ellos, así que los reemplacé con lo que usa Discord, guiones. El siguiente código verificará si ya existe un canal y creará uno si no es así.

 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!