Open ItsJakeo opened 12 years ago
Can you give me a line number, and the full text of the error please? When I run the code above, it just says "bot is not defined" because you never required the tt api.
ok so when i type what genre, the bot replies blank and crashes
node.js:201 throw e; // process.nextTick error, or 'error' event on first tick ^ TypeError: string is not a function at String.CALL_NON_FUNCTION (native) at [object Object].onMessage (C:\Program Files\nodejs\node_modules\ttapi\bot .js:201:13) at [object Object].onmessage (C:\Program Files\nodejs\node_modules\ttapi\bot .js:72:49) at Array.0 (C:\Program Files\nodejs\node_modules\ttapi\websocket.js:308:30) at EventEmitter._tickCallback (node.js:192:40)
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;
});