Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
exports.run = async (bot, msg, args) => {
if (args.length < 1) {
throw 'You must specify a Spotify URI at least!';
}
const response = await got('https://spotify-auth.doxylamin.pw/', { json: true });
if (response.body.success == true) {
spotifyApi.setAccessToken(response.body.access_token);
}
const parsed = bot.utils.parseArgs(args, ['preview']);
const spotifyUri = SpotifyUriParser.parse(parsed.leftover.join(' '));
switch (spotifyUri.type) {
case 'track':
getTrackEmbed(msg, spotifyUri.id, parsed.options.preview);
break;
case 'artist':
getArtistEmbed(msg, spotifyUri.id, parsed.options.preview);
break;
case 'playlist':
getPlaylistEmbed(msg, spotifyUri.user, spotifyUri.id, parsed.options.preview);
break;
default:
throw 'Sorry, I can\'t parse that type of URI yet.';
}
};