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

308
Vistas
Esperando reacciones acepta el bot y el destinatario, no el autor del comando

Estoy tratando de crear un bot de discordia y estoy escribiendo el comando "casarse".

Ya está esencialmente listo, lo principal es que quiero que la confirmación de la boda no sea un mensaje de sí/no, sino un clic en la reacción.

Ahora todo funciona, al ingresar un comando, el usuario que hace clic y responde a la propuesta de matrimonio, pero no con el que escribió el comando, sino con el bot.

Es decir, me funciona ahora que el autor del mensaje (es decir, un bot) y el destinatario de la propuesta se casan. Y es necesario que el que escribió el comando y el usuario al que va dirigido se casen.

¿Cómo puedo arreglar esto?

Aquí está mi función awaitReactions:

 (`Are you ready to get married?`).then(message => { message.react('👍').then(() => message.react('👎')); message.awaitReactions((reaction, user) => user.id == userToMarry.id && (reaction.emoji.name == '👍' || reaction.emoji.name == '👎'), { max: 1, time: 60000, errors: ['time'] }) .then(collected => { const reaction = collected.first(); if (reaction.emoji.name === '👎') { return message.channel.send('I think **no**...')} if (reaction.emoji.name === '👍') { db.set(message.author.id, { user: message.author.id, partner: userToMarry.id }); db.set(userToMarry.id, { user: userToMarry.id, partner: message.author.id }); message.channel.send(`${message.author} and ${userToMarry} now married!!`) .catch(err => { message.channel.send( `Something went wrong while trying to marry this user. ${err}` ); return console.log(err)}); } }) .catch(collected => { message.reply('You reacted with neither a thumbs up, nor a thumbs down.'); }); });

Código de comando completo

 const { Command } = require('discord.js-commando'); const db = require("quick.db"); module.exports = class MarryCommand extends Command { constructor(client) { super(client, { name: 'marry', memberName: 'marry', group: 'test', description: 'Marry the mentioned user', guildOnly: true, args: [ { key: 'userToMarry', prompt: 'Please select the member you wish to marry.', type: 'member' } ] }); } run(message, { userToMarry }) { const exists = db.get(`${message.author.id}.user`); const married = db.get(`${userToMarry.id}.user`); if (!userToMarry) { return message.channel.send('Please try again with a valid user.')} if (exists == message.author.id) { return message.channel.send('You are already married!')} if (married == userToMarry.id) { return message.channel.send('This user is already married!')} if (userToMarry.id == message.author.id) { return message.channel.send('You cannot marry yourself!'); } if (exists != message.author.id && married != userToMarry.id) { message.channel.send(`**Important announcement!** ${message.author} makes a marriage proposal ${userToMarry} Are you ready to get married?`).then(message => { message.react('👍').then(() => message.react('👎')); message.awaitReactions((reaction, user) => user.id == userToMarry.id && (reaction.emoji.name == '👍' || reaction.emoji.name == '👎'), { max: 1, time: 60000, errors: ['time'] }) .then(collected => { const reaction = collected.first(); if (reaction.emoji.name === '👎') { return message.channel.send('I think **no**...')} if (reaction.emoji.name === '👍') { db.set(message.author.id, { user: message.author.id, partner: userToMarry.id }); db.set(userToMarry.id, { user: userToMarry.id, partner: message.author.id }); message.channel.send(`${message.author} and ${userToMarry} now married!!`) .catch(err => { message.channel.send( `Something went wrong while trying to marry this user. ${err}` ); return console.log(err)}); } }) .catch(collected => { message.reply('You reacted with neither a thumbs up, nor a thumbs down.'); }); }); }}};
over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Prueba así

 .then(message => { message.react('👍').then(() => message.react('👎')); message.awaitReactions((reaction, user) => user.id == userToMarry.id && (reaction.emoji.name == '👍' || reaction.emoji.name == '👎'), { max: 1, time: 60000, errors: ['time'] }) .then(collected => { const reaction = collected.first(); if (reaction.emoji.name === '👎') { return message.channel.send('I think **no**...')} if (reaction.emoji.name === '👍') { db.set(message.author.id, { user: message.author.id, partner: userToMarry.id }); db.set(userToMarry.id, { user: userToMarry.id, partner: message.author.id }); message.channel.send(`${message.author} and ${userToMarry} now married!!`) ... }); });
over 4 years ago · Santiago Trujillo 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