Fix duration not changing in fmtt
This commit is contained in:
parent
7bd728a16e
commit
60580483ec
1 changed files with 23 additions and 2 deletions
|
@ -23,6 +23,27 @@ module.exports = async function (userID, option) {
|
|||
if(option[0] === undefined)
|
||||
option[0] = options[option[0]];
|
||||
|
||||
let duration = "";
|
||||
switch (option[0]){
|
||||
case "overall":
|
||||
duration = "all time";
|
||||
break;
|
||||
case "7day":
|
||||
duration = "weekly";
|
||||
break;
|
||||
case "1month":
|
||||
duration = "monthly";
|
||||
break;
|
||||
case "3month":
|
||||
duration = "quarterly";
|
||||
break;
|
||||
case "6month":
|
||||
duration = "half year";
|
||||
break;
|
||||
case "12month":
|
||||
duration = "yearly";
|
||||
break;
|
||||
}
|
||||
const apiKey = process.env.LAST_FM_API_KEY;
|
||||
if(lastfmUsername != undefined){
|
||||
tracks = await new Promise ((resolve, reject) => {
|
||||
|
@ -44,7 +65,7 @@ module.exports = async function (userID, option) {
|
|||
reject(error);
|
||||
});
|
||||
});
|
||||
sendText = `Top weekly tracks for ${lastfmUsername}:\n`;
|
||||
sendText = `Top ${duration} tracks for ${lastfmUsername}:\n`;
|
||||
for(let i = 0; i < tracks.length; i++){
|
||||
sendText += `${i}. ${tracks[i].artist} - ${tracks[i].song} (${tracks[i].playcount} plays)\n`;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue