-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmusic-search.js
57 lines (51 loc) · 1.74 KB
/
music-search.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
const { MessageEmbed, EmbedFieldData, Message } = require("discord.js");
const youtube = require("./youtube.js");
const emptyField = { name: "\u200B", value: "\u200B" };
async function makeEmbedMessage(name) {
/* Default format */
let embedMsg = new MessageEmbed()
.setColor("#FF0000")
.setURL(`https://www.youtube.com/results?search_query=${encodeURI(name)}`)
.setAuthor("Youtube", "", "https://www.youtube.com");
const red = "#FF0000";
let musicInfo = [];
// /* Get information from youtube */
await youtube(name).then(function (x) {
musicInfo = x;
});
const channeltitle = {
name: "채널",
value: musicInfo[1],
inline: true,
};
const url = {
name: "url",
value: musicInfo[2],
inline: true,
};
// if (summonerInfo === null) {
// /* handle non-existing summoner */
// return embedMsg.setTitle("존재하지 않는 소환사").setColor(red);
// }
// const [mostChamps, recentSolo] = await Promise.all([
// opgg.getMostChamps(summonerInfo.summonerID, summonerInfo.season),
// opgg.getRecentSolo(summonerInfo.summonerID),
// ]);
// let tierMedalSrc;
// if (summonerInfo.soloTier.toLowerCase() !== "unranked") {
// tierMedalSrc = opgg.getTierMedalSrc(summonerInfo.soloTier);
// } else {
// tierMedalSrc = opgg.getTierMedalSrc(summonerInfo.flexTier);
// }
/* Make a new embed message*/
embedMsg = embedMsg
.setColor(red)
.setTitle(musicInfo[0]) // 노래 제목
.setThumbnail(musicInfo[3])
// .addFields(makeTierFields(summonerInfo))
// .addFields(emptyField)
.addFields(channeltitle)
.addFields(url);
return embedMsg;
}
module.exports = makeEmbedMessage;