This commit is contained in:
Flummi 2019-08-19 14:20:59 +00:00
parent d6a737931a
commit cd606aa6eb

View File

@ -17,10 +17,8 @@ export default async bot => {
const nick = e.args[0] || e.user.nick; const nick = e.args[0] || e.user.nick;
let res = await (await fetch(`${api}${nick}`)).json(); let res = await (await fetch(`${api}${nick}`)).json();
if(res.error) return { if(res.error)
err: true, return e.reply("User not found");
msg: "User not found"
};
res = res.recenttracks; res = res.recenttracks;
const track = res.track[0]; const track = res.track[0];
@ -30,14 +28,9 @@ export default async bot => {
playing: track["@attr"] ? true : false playing: track["@attr"] ? true : false
}; };
return { return e.reply(info.playing ?
err: false, `[b]${info.user}[/b] is listening to [b]${info.track}[/b]` :
mode: "normal", `[b]${info.user}[/b] is not listening to anything. They last listened to [b]${info.track}[/b]`);
msg: info.playing ?
`[b]${info.user}[/b] is listening to [b]${info.track}[/b]` :
`[b]${info.user}[/b] is not listening to anything. They last listened to [b]${info.track}[/b]`
};
} }
}]; }];
}; };