Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

408
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda