woomy/modules/music.js

35 lines
721 B
JavaScript
Raw Normal View History

2020-04-03 06:26:16 +00:00
/*
2020-03-31 04:09:50 +00:00
const ytdl = require('ytdl-core-discord')
const youtubeInfo = require('youtube-info')
const getYoutubeId = require('get-youtube-id')
const fetch = require('node-fetch')
2020-04-03 06:26:16 +00:00
*/
2020-03-31 04:09:50 +00:00
2020-03-30 16:01:13 +00:00
module.exports = client => {
// MUSIC - TIMESTAMP
2020-03-31 04:09:50 +00:00
client.createTimestamp = function (duration) {
var hrs = ~~(duration / 60 / 60)
var min = ~~(duration / 60) % 60
var sec = ~~(duration - min * 60)
2020-03-30 16:01:13 +00:00
2020-03-31 04:09:50 +00:00
if (String(hrs).length < 2) {
hrs = '0' + String(hrs) + ':'
2020-03-30 16:01:13 +00:00
}
2020-03-31 04:09:50 +00:00
if (String(min).length < 2) {
min = '0' + String(min)
2020-03-30 16:01:13 +00:00
}
2020-03-31 04:09:50 +00:00
if (String(sec).length < 2) {
sec = '0' + String(sec)
2020-03-30 16:01:13 +00:00
}
2020-03-31 04:09:50 +00:00
if (hrs === '00:') {
hrs = ''
2020-03-30 16:01:13 +00:00
}
2020-03-31 04:09:50 +00:00
var time = hrs + min + ':' + sec
2020-03-30 16:01:13 +00:00
return time
}
}