Closed ghalevy closed 11 years ago
Take a look at the "Dynamic bot" example. (REPL)
var Bot = require('ttapi')
, repl = require('repl');
var bot = new Bot(AUTH, USERID, ROOMID);
repl.start('> ').context.bot = bot;
Then you can access the bot properties and functions by typing bot
... in your terminal.
Im not sure i understand this code, could you call specific commands with parameters with this coded?
Put the little piece of code in a file, execute it, than type something like (without the "> " symbol, which is added by nodejs...) :
> bot.debug;
false
> bot.on('speak', function(data) { console.log('speak received'); });
{ auth: 'xxx',
userId: 'xxx',
...
Than you can go on turntable.fm and write something in the chat, you'll see that the bot received it into the terminal.
EDIT: Just write what is after "> ". You don't have to write false
...
That is awesome, thanks Alain!
Hi - not sure how to phrase this question as I am new to node.js and TTAPI but here goes:
I have setup a bot which i run with cmd "node mybot.js" Bot is running without database and I have managed to get basic functionality that I like out of it. However, as I am learning and testing new TTAPI commands, I have to take bot offline, make my changes, then restart the bot. Is there any way for me to "interactively" test the various TTAPI commands and get output to my console?
Hope I phrased it well enough, let me know if more info is needed.