This commit is contained in:
parent
4aaf72e4b4
commit
f1f9e3aaa3
2 changed files with 2 additions and 2 deletions
|
@ -77,7 +77,7 @@ module.exports = async function (userID, option, guild, compatibility=false) {
|
||||||
fetch(`https://ws.audioscrobbler.com/2.0/?method=user.gettopalbums&user=${lastfmUsername}&period=${option[0]}&api_key=${process.env.LAST_FM_API_KEY}&format=json`)
|
fetch(`https://ws.audioscrobbler.com/2.0/?method=user.gettopalbums&user=${lastfmUsername}&period=${option[0]}&api_key=${process.env.LAST_FM_API_KEY}&format=json`)
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
const maxIterations = data.topartists.artist.length >= 10 ? 10 : data.topartists.artist.length;
|
const maxIterations = data.topalbums.album.length >= 10 ? 10 : data.topalbums.album.length;
|
||||||
for(let i = 0; i < maxIterations; i++){
|
for(let i = 0; i < maxIterations; i++){
|
||||||
let album = {}
|
let album = {}
|
||||||
let currentAlbum = data.topalbums.album[i];
|
let currentAlbum = data.topalbums.album[i];
|
||||||
|
|
|
@ -78,7 +78,7 @@ module.exports = async function (userID, option, guild, compatibility=false) {
|
||||||
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`)
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
const maxIterations = data.topartists.artist.length >= 10 ? 10 : data.topartists.artist.length;
|
const maxIterations = data.toptracks.track.length >= 10 ? 10 : data.toptracks.track.length;
|
||||||
for(let i = 0; i < maxIterations; i++){
|
for(let i = 0; i < maxIterations; i++){
|
||||||
let track = {}
|
let track = {}
|
||||||
let currentTrack = data.toptracks.track[i];
|
let currentTrack = data.toptracks.track[i];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue