fmtt: Set weekly as the default time period

This commit is contained in:
SileNce5k 2024-03-07 12:43:34 +01:00
parent 3ed4714457
commit 4a67153fb9
No known key found for this signature in database
GPG key ID: 961132EB78C8915F

View file

@ -17,12 +17,13 @@ module.exports = async function (userID, option) {
} }
if(option.length === 0){ if(option.length === 0){
option[0] = "weekly" option[0] = "weekly"
}else {
option[0] = options[option[0]];
if(option[0] === undefined)
option[0] = options[option[0]];
} }
const apiKey = process.env.LAST_FM_API_KEY;
option[0] = options[option[0]];
if(option[0] === undefined)
option[0] = options[option[0]];
const apiKey = process.env.LAST_FM_API_KEY;
if(lastfmUsername != undefined){ if(lastfmUsername != undefined){
tracks = await new Promise ((resolve, reject) => { tracks = await new Promise ((resolve, reject) => {
fetch(`https://ws.audioscrobbler.com/2.0/?method=user.gettoptracks&user=${lastfmUsername}&period=${option[0]}&api_key=${apiKey}&format=json`) fetch(`https://ws.audioscrobbler.com/2.0/?method=user.gettoptracks&user=${lastfmUsername}&period=${option[0]}&api_key=${apiKey}&format=json`)