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

167
Views
I can't reply or react to collected message. Discord.js V13

So, I wanted to add command /custom and after that, user would enter they nicknames through messages. Bot should check if ther nickname is in game (async function checkIfSummonerExist(m)) and if it does exist, bot should collect their name and data and push to array (async function getSummonerProfile(m.content)). Now I wanted to add bot reactions to those messages, if nickname exist, it should add one reaction (for example thumbs up), and if name does not exist one should add thumbs down. So I tried with m.react(), but it does not work. I also tried with m.reply("User approved")but I don't get reply. I am new to making discord bot.

const { SlashCommandBuilder } = require("@discordjs/builders");
const { getSummonerProfile } = require("./../functions/summonerData");
const { calculateRank } = require("./../functions/calculateRank");

let arrayOfSummoners = [];
async function checkIfSummonerExist(m) {
  const test = await getSummonerProfile(m.content);

  if (test) {
   
    return true;
  } else {
    return false;
  }
}
module.exports = {
  data: new SlashCommandBuilder()
    .setName("custom")
    .setDescription(
      "Enter the name of the user."
    ),
  async execute(interaction) {
    await interaction.deferReply();
    // `m` is a message object that will be passed through the filter function
    const filter = (m) => checkIfSummonerExist(m);
    const collector = interaction.channel.createMessageCollector({
      filter,
      time: 15000,
    });
      
    collector.on("collect", (m) => {
       m.reply('User approved');
       m.react('๐Ÿ˜„');
      arrayOfSummoners.push(getSummonerProfile(m.content));
    });

    collector.on("end", (collected) => {
      // return interaction.editReply(`Collected ${collected.size} items`);
    //  calculateRank(arrayOfSummoners);
    });

    //   return interaction.editReply();
  },
};
about 4 years ago ยท Juan Pablo Isaza
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!