Check if user is not found
This commit is contained in:
parent
90e16e2b3c
commit
444af32def
1 changed files with 6 additions and 2 deletions
|
@ -27,13 +27,17 @@ module.exports = async function(userID, guild) {
|
|||
track = data.recenttracks.track[0];
|
||||
} catch (error) {
|
||||
scrobble.error = true;
|
||||
if(data.message === "User not found"){
|
||||
scrobble.errorMsg = "User not found. Use `<prefix>fm set <lastfm_username>` to set your last.fm username.";
|
||||
resolve(scrobble);
|
||||
}
|
||||
scrobble.errorMsg = "Last.fm is probably having problems. Try again later.";
|
||||
resolve(scrobble);
|
||||
}
|
||||
scrobble.artist = track.artist["#text"];
|
||||
scrobble.song = track.name;
|
||||
scrobble.album = track.album["#text"];
|
||||
scrobble.cover = track.image[3]["#text"];
|
||||
console.log(typeof track['@attr'].nowplaying);
|
||||
if(track['@attr'].nowplaying === "true"){
|
||||
isCurrentScrobble = "Last";
|
||||
}
|
||||
|
@ -44,7 +48,7 @@ module.exports = async function(userID, guild) {
|
|||
reject(error);
|
||||
});
|
||||
});
|
||||
if(scrobble.error){
|
||||
if(scrobble.error != null){
|
||||
sendText.text = "Last.fm is probably having problems. Try again later.";
|
||||
return sendText;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue