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

410
Vistas
How can i get the current time of the song playing in discord.js

This is my code:

const user = message.mentions.members.first() || message.author


let spotify = user.presence.activities.filter(x => x.name == 'Spotify' && x.type == 'LISTENING')[0]
const sp = spotify.status
console.log(sp) 

Is there a way to get the current time of the song on spotify and display it in seconds/minutes.

if the current song is at the 23 sec. it will display 0:23 in the console.

Discord js v13.

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

You can read currentTime from audio element

function logCurrentTime() {
  let audioElement = document.getElementById('audio')
  document.getElementById('currentTime').innerText = audioElement.currentTime
}
<body>
  <button onclick="logCurrentTime()">Click to log current time</button>

  <p id='currentTime'></p>
  <audio id="audio" controls autoplay src="http://commondatastorage.googleapis.com/codeskulptor-assets/Epoq-Lepidoptera.ogg" />
</body>

Ref :- MediaElement

about 4 years ago · Juan Pablo Isaza Denunciar

0

Have a look a the documentation. In this case, spotify.timestamps.start will be the time the user started the activity (as a date).

PS: The docs are your best friend! If there's anything you're ever unsure about, go here!

about 4 years ago · Juan Pablo Isaza 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