Hey im trying to incorporate your lastfm genre check in my bot. But when i run it, it comes up object is not a function. So I dont know what to do or where the error is coming from. I know you can help Zect. Thanks also here is my lastfm code:
var relay_to_bot= true;
var LastFmNode = require('lastfm').LastFmNode;
var LASTFM_KEY = 'a55ed21463b01a20454346669b76e59a';
var LASTFM_SECRET = '9c0ca11ae234c4f80c4ca9a690dcadd7';
var APP_STRING = 'TurntableFM/v0.01 BotFM';
// LastFM Struct
var lastfm = new LastFmNode({
api_key: LASTFM_KEY,
secret: LASTFM_SECRET,
useragent: APP_STRING
});
bot.on('speak', function(data) {
// Get the data
var name = data.name;
var text = data.text;
// Say the genre of the song
if ( text.indexOf("what genre") != -1 && text.indexOf("woofus") != -1 ) {
console.log('\nSomeone asked me what the genre is\n\n', data);
// Get the current room info
bot.roomInfo(true, function(data) {
// Get the current song name
var songName = data.room.metadata.current_song.metadata.song;
var artist= data.room.metadata.current_song.metadata.artist;
// Ask last.fm what the genre is
var request = lastfm.request("track.getInfo", {
track: songName,
artist: artist,
handlers: {
success: function(data) {
console.log("Success: " + data);
bot.speak( bot, data.track.toptags.tag[0].name );
},
error: function(error) {
console.log("Error: " + error.message);
bot.speak( bot, "...no idea you hipster" );
}
}
});
});
handled_command = true;
}
});
Hey im trying to incorporate your lastfm genre check in my bot. But when i run it, it comes up object is not a function. So I dont know what to do or where the error is coming from. I know you can help Zect. Thanks also here is my lastfm code:
var relay_to_bot= true;
var LastFmNode = require('lastfm').LastFmNode;
var LASTFM_KEY = 'a55ed21463b01a20454346669b76e59a';
var LASTFM_SECRET = '9c0ca11ae234c4f80c4ca9a690dcadd7';
var APP_STRING = 'TurntableFM/v0.01 BotFM';
// LastFM Struct
var lastfm = new LastFmNode({
api_key: LASTFM_KEY,
secret: LASTFM_SECRET,
useragent: APP_STRING
});
bot.on('speak', function(data) {
// Get the data
var name = data.name;
var text = data.text;
// Say the genre of the song
if ( text.indexOf("what genre") != -1 && text.indexOf("woofus") != -1 ) {
console.log('\nSomeone asked me what the genre is\n\n', data);
// Get the current room info
bot.roomInfo(true, function(data) {
// Get the current song name
var songName = data.room.metadata.current_song.metadata.song;
var artist= data.room.metadata.current_song.metadata.artist;
});