This repository was archived by the owner on Aug 5, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathqueue.js
89 lines (81 loc) · 2.68 KB
/
queue.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
// @ts-nocheck
"use strict"
const YTDL = require("ytdl-core");
const Discord = require('discord.js')
const langfile = require("../storage/translation/language.json")
module.exports.run = async (client, message, args) => {
let lan
if (client.language == "eng") {
lan = langfile.english.music.queue
}
if (client.language == "ger") {
lan = langfile.german.music.queue
}
if (client.language == "fr") {
lan = langfile.french.music.queue
}
if (client.language == "cz") {
lan = langfile.czech.music.queue
}
if (client.language == "ru") {
lan = langfile.russian.music.queue
}
const prefix = client.prefix
if (!global.servers[message.guild.id]) {
return message.reply("play some music first!")
}
if (!message.guild.voiceConnection) return message.reply("its empty?")
// message.channel.send(lan)
let equeue = []
let rqueue = global.servers[message.guild.id].queue
let c = 0
rqueue.forEach(i => {
c++
if (c == 6) return equeue.push(`Next 5 Songs from ${c} Songs:`)
if (c > 6) return
YTDL.getInfo(i, (err, info) => {
equeue.push(`${info.author.name} - ${info.title}`)
})
})
// for (let item of global.servers[message.guild.id].queue) {
// YTDL.getInfo(item, async(err, info) => {
// await equeue.push(`${info.author.name} - ${info.title}`)
// // setTimeout(()=>{
// // message.channel.send(info.author.name + " - " + info.title);
// // }, 1000)
// });
// }
const lembed = new Discord.RichEmbed()
.setTitle(`Fetching Queue...`)
.setColor("#ff0000")
.setFooter(`${client.user.username} made by HT`)
.setTimestamp()
message.channel.send(lembed).then(msg => {
setTimeout(() => {
const embed = new Discord.RichEmbed()
.setTitle(`Queue for ${message.guild.name}:`)
.setDescription(equeue.join("\n"))
.setColor("#ff0000")
.setFooter(`${client.user.username} made by HT`)
.setTimestamp()
msg.edit(embed)
}, 1000)
})
// message.channel.send("------------");
// for (let item of global.servers[message.guild.id].queue) {
// var songs = {};
// YTDL.getInfo(item, (err, info) => {
// songs.push(info.author.name + " - " + info.title + "\n")
// });
// message.channel.send("------------" + songs);
//}
}
module.exports.help = {
name: "queue",
description: "Shows queue of music.",
aliases: [],
permlvl: 1,
hidden: false,
category: "music",
usage: "queue"
}