got rid of my shitty timestamp generator
This commit is contained in:
parent
1760fbcda1
commit
5440ae0daa
1 changed files with 6 additions and 22 deletions
|
@ -1,34 +1,18 @@
|
||||||
const ytdl = require('ytdl-core-discord')
|
const ytdl = require('ytdl-core-discord')
|
||||||
const fetch = require('node-fetch')
|
const fetch = require('node-fetch')
|
||||||
const { MessageEmbed } = require('discord.js')
|
const { MessageEmbed } = require('discord.js')
|
||||||
|
const { utc } = require('moment')
|
||||||
|
|
||||||
module.exports = client => {
|
module.exports = client => {
|
||||||
client.music = { guilds: {} }
|
client.music = { guilds: {} }
|
||||||
|
|
||||||
// MUSIC - TIMESTAMP
|
// MUSIC - TIMESTAMP
|
||||||
client.createTimestamp = function (duration) {
|
client.createTimestamp = function (s) {
|
||||||
var hrs = ~~(duration / 60 / 60)
|
if (s >= 3600) {
|
||||||
var min = ~~(duration / 60) % 60
|
return utc(s * 1000).format('HH:mm:ss')
|
||||||
var sec = ~~(duration - min * 60)
|
} else {
|
||||||
|
return utc(s * 1000).format('mm:ss')
|
||||||
if (String(hrs).length < 2) {
|
|
||||||
hrs = '0' + String(hrs) + ':'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (String(min).length < 2) {
|
|
||||||
min = '0' + String(min)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (String(sec).length < 2) {
|
|
||||||
sec = '0' + String(sec)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hrs === '00:') {
|
|
||||||
hrs = ''
|
|
||||||
}
|
|
||||||
|
|
||||||
var time = hrs + min + ':' + sec
|
|
||||||
return time
|
|
||||||
}
|
}
|
||||||
|
|
||||||
client.music.getGuild = function (id) {
|
client.music.getGuild = function (id) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue