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
Mi bot está recopilando su propio mensaje (bucle infinito) y enviando spam a una línea específica

el bot envía spam (`You Found ${earnings} Coins!`); y creo que está recopilando sus propios mensajes (bucle infinito) Pregunté el problema a algunos de mis amigos y dijeron lo mismo: "el bot está recopilando sus propios mensajes, elimine el recopilador". pero no sé cómo puedo reemplazar el colector.

 const profileModel = require("../models/profileSchema"); module.exports = { name: "search", aliases: [], permissions: [], description: "Search for some coin!", async execute(message, args, cmd, client, Discord, profileData) { const locations = [ "car", "bathroom", "park", "truck", "pocket", "computer" ]; const chosenLocations = locations.sort(() => Math.random() - Math.random()).slice(0, 3); const filter = ({ author, content }) => message.author == author && chosenLocations.some((location) => location.toLowerCase() == content.toLowerCase()); const collector = message.channel.createMessageCollector(filter, { max: 1}); const earnings = Math.floor(Math.random() * (1000 - 100 + 1)) + 100; collector.on('collect', async (m) => { if(message.author.bot) return; message.channel.send(`You Found ${earnings} Coins!`); await profileModel.findOneAndUpdate( { userID: message.author.id, }, { $inc: { PDMcoins: earnings, }, } ); }); message.channel.send(`<@${message.author.id}> which location would you like to search?\n type it in this channel\n \`${chosenLocations.join('` `')}\``); } }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

En discord.js v13, todas las clases y métodos relacionados con Collector (por ejemplo .createMessageCollector() o .awaitMessages() ) toman un solo parámetro de objeto que también incluye el filter . Entonces, su colector debería verse así:

 const collector = message.channel.createMessageCollector({ filter, max: 1 });
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!