Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

87
Vistas
Cree una invitación desde el servidor 1 y envíela al usuario DMS en el servidor 2

Entonces, estoy tratando de crear un tipo de comando que generará 1 uso único en el servidor 1. Ahora, si tuviera que ingresar este comando en un texto general en el servidor 2, !dminvite @user , enviaría al usuario mencionado el único creado invite desde el servidor 1 y envíelo al usuario mencionado en el servidor 2, a través de DM.

Algunas notas:

1. Tengo los 2 ID de servidor guardados en mi archivo config.json y este comando de invitación requiere config.json. En esta base de archivos de comandos

2. Este comando se ejecuta en discord.js v12, pero si alguien quiere ayudar en discord.js v13, también sería increíble.

3. No tengo forma de intentar publicitar nada, soy dueño de ambos servidores.

Tengo un código escrito pero no funciona, solo un punto de vista:

 message.delete(); message.mentions.members.first() || message.guild.members.cache.get(args[0]); const Options = { temporary: false, maxAge: 0, maxUses: 1, unique: true }; const channel = message.guild.channels.cache.get('(Channel ID)'); let invite = message.channels.createInvite(Options).then(function(Invite) { message.mentions.members.first().send({embed: { title: `**INVITE**`, description: `Invite:\nhttps://discord.gg/` + Invite.code }}); message.channel.send(new Discord.MessageEmbed() .setAuthor(message.author.tag, message.author.displayAvatarURL({ dynamic: true })) .setDescription(`${message.author.tag}, invite was sent to DMs`) .setColor('BLUE') ); });
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Para lograr su objetivo hacemos esto:

  1. Obtenga el usuario mencionado del mensaje.
  2. Busca el otro gremio al que queremos invitar al usuario.
  3. Crea una invitación al canal del sistema del otro gremio (no tiene que ser systemChannel ).
  4. Envía la invitación a los DM del usuario mencionado.
 // Id of the other guild const otherGuildId = "guild id"; client.on("message", async (message) => { // Don't reply to itself if (message.author.id == client.user.id) return; // Check if the message starts with our command if (message.content.startsWith("!dminvite")) { // Get the mentioned user from the message const user = message.mentions.users.first(); if (!user) { message.channel.send("You need to mention the user to send the invitation to."); return; } // Fetch the other guild we want to invite the user to const otherGuild = await client.guilds.fetch(otherGuildId); // Create invite to the other guild's system channel const invite = await otherGuild.systemChannel.createInvite({ maxAge: 0, maxUses: 1, unique: true }); // Send the invite to the mentioned user's DMs user.send({ embed: { title: "**INVITE**", description: `${invite}` } }); } });

Tenga en cuenta que si no desea utilizar systemChannel , simplemente puede obtener cualquier canal que desee del otherGuild por su id, por ejemplo.

 // Resolve channel id into a Channel object const channel = otherGuild.channels.resolve("channel id");

Usando discord.js ^12.5.3 .

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda