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

288
Views
Como saber que es hoy, en discord.js

Quiero hacer que el bot sepa qué día es hoy, tengo un código de ejemplo a continuación, pero no sé cómo solucionarlo.

 client.on("message", msg =>{ if (msg.content === "!today"){ If (Today is Sunday){ msg.reply("Time to Holiday") } else if(Today is monday){ msg.reply("Time to work") } } });
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

new Date() le da la fecha y hora actual. Tiene un método .getDay() que te da el día de la semana como un número. el domingo es 0 ; el lunes es 1 Asi que:

 const dayOfWeek = new Date().getDay(); if (dayOfWeek === 0) { // is it Sunday?

Tenga en cuenta que esta es la fecha y hora del servidor bot . Diferentes usuarios pueden estar en diferentes días, debido a las zonas horarias.

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!