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

174
Views
¿Por qué la variable "recuento + contador" aparece como indefinida?

Estoy tratando de hacer un bot en Slack para publicar un mensaje en un canal cuando se recibe un mensaje en otro canal, y solo se ejecuta una vez al día. Este es mi código con el mensaje que recibí (con lo que hice). ¿Cómo soluciono esto para que sea correcto?

 const web = new WebClient(process.env.SLACK_TOKEN); const currentTime = new Date().toTimeString(); let channelId = "C02FHG0K0SY"; let conversationHistory, message, count, stop; let counter; async function fetchMessages() { const result = await web.conversations.history({ channel: channelId, limit: 11000, }); conversationHistory = result.messages; count = conversationHistory.length; } setInterval(function () { if (counter === null) { fetchMessages(); var count = fetchMessages.count; counter === count; console.log("Counter has been setup!"); } if (counter === count) { fetchMessages(); if (count > counter) { web.chat.postMessage({ token: process.env.SLACK_TOKEN, channel: "C02FB9QHW10", text: "Hits have arrived, let's get started with them! Woo-hoo! This is just a test by the way, no hits have actually arrived.", }); stop === true; console.log("Hits arrived! Posted.") } else { console.log(`No new hits! ${count} messages and ${counter} in "counter".`); } } }, 5000); setInterval(function () { if (currentTime == "23:59:59 GMT+0000 (Coordinated Universal Time)") { if (stop === true) { stop === false; } } }, 1000);
 No new hits! undefined messages and undefined in "counter".
about 4 years ago · Santiago Trujillo
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!