Skip to content

GitHub + Node.js + = Funbot!

About 7 months ago, I stumbled across, a social music website where people can take turns DJing in a round-robin format, and people can share their music among listeners.  After bouncing between several rooms, I had settled into the All Music Mix room, which was being governed by a bot that had been created by user “dj mikeb”.  This bot uses an API to collect data on the room and enforce play limits and other rules within the room (which I found to be much of the appeal of the room).  As I saw other bots pop up in this and other rooms, I began to look into how to create my own.

I ended up chatting with another user “PodcastMike”, who had created a bot of his own that watched the same room and gathered data, and he pointed me to a GitHub repository ( as a place to start off.  Well, the only problem I ran into was that this ran on Node.js, which I had never used before.  I had heard of it a few times among those I follow on twitter, but I really knew nothing about it.

In addition, I’m almost embarrassed to say, I had never used Git and GitHub to grab a project, let alone fork and update it.  However, after some experimentation and trial and error, I was able to get the project onto my computer and found that Node.js was pretty easy to work with (at least when having experience with JavaScript and sample code to work with).  While the bot I had downloaded had some of the functionality I wanted, there were a number of changes I wanted to make.

A few days later, Funbot was born (he’s the little redhead in the spotlight).  I had tweaked the database setup to allow for remote databases, adjusted the database table structure to capture more of the data I wanted to gather, added the ability to tweed to it’s @TTFunbot, and made some other DJ management changes to fit the room I wanted to run.  And rather than keep it to myself, I forked the MikeWills project, which resulted in my own version (, which is also the first GitHub repository to my name.

If you’re interested in checking out Funbot in action, or just spinning some good tunes, you can head on over to Funbot’s Musical Wonderland (I may or may not be there, but Funbot will keep you company).

And stay tuned as well, because I’ve got a lot more planned for the little guy!

Published inmusicprogramming


  1. Lindsay Lindsay

    Good stuff! Do you have an experience with the API? I was looking into making a bot for that site since it works like TT, but it works internationally and I’m in Canada so can’t use TT. I also like the idea that can reach a far wider audience when playing my mixes. 😉 If you have used their API for anything I’d like to know how you think it compares.

  2. Lindsay,

    I haven’t tried out yet, but their API looks pretty reasonable. I’d take a look at the code on GitHub for the Turntable API ( as a starting point, and I think the API interaction would be very similar.

  3. Conner C Conner C

    Hey, Greg!

    I am very new to any real computer work.. So my first “project” was a bot! I successfully made a “sparkle” bot… And he’s working great! My new idea is… (and I’ve seen it done before) how do I make my bot work as a DJ? I have logged into the bots account, and made a playlist that goes with my room, and I have tried signing in, running the bot with CMD, and then logging out… But when I log into my “real” account, and go into the room, he is djing, but he loses the ability to send the welcome PM’s, and the welcome message overall… Is there any way I can change this in the config? Or do I need to do something else..?

  4. Greg Nilsen Greg Nilsen


    It sounds like there may be something wrong with your script and it is dying when you enter the room. Try logging as much info into the console as you can to debug, from each action to the data that is being used. That should help you to pinpoint the problem.

  5. Michelle Michelle

    Hey Greg!
    Hey Alain-

    I found you via github (and your bot) & I was wondering if you could help me with a problem I’ve been running into w/getting my bot running. I’ve got everything else completed and I go to ‘node bot.js’ and I get this message:

    Darth-Vader:mom michellekehl$ node bot.js
    mom >>> Missing custom EnableQueue, loading default.
    mom >>> Initializing
    mom >>> Done
    mom >>> Hooking events
    mom >>> Done
    mom >>> Ready
    mom >>> Bot Ready
    mom >>> Room Changed
    mom >>> Registering Users

    activeDj =;
    TypeError: Cannot read property ‘metadata’ of undefined
    at global.OnRoomChanged (/Users/michellekehl/Desktop/mom/functions.js:43:22)
    at EventEmitter.emit (events.js:96:17)
    at Bot.onMessage (/Users/michellekehl/Desktop/mom/node_modules/ttapi/bot.js:196:18)
    at frameType (/Users/michellekehl/Desktop/mom/node_modules/ttapi/websocket.js:308:30)
    at process.startup.processNextTick.process._tickCallback (node.js:244:9)
    Darth-Vader:mom michellekehl$
    Is there an easy solution that I’m missing? Any help you could give would be awesome! Thanks!


  6. Michelle Michelle

    ^not sure where they ‘Hey Greg’ part popped in, that was leftover from an old email! Sorry about that!

  7. Greg Nilsen Greg Nilsen

    Well, you were right with Greg, Michelle. Not sure where Alain comes from…

    Unfortunately, I haven’t fired up my code for a while, as I’ve grown to use TT less, so I’m just going off of what you’ve posted.

    Anyway, unless the API has changed recently, that syntax looks correct. For cases like this, I’d recommend trying to output the contents of “” to the console to see the contents of that:


    If I remember correctly, node.js should write the data structure out to the console without issue.

    Hopefully that will shed some light on your problem.

  8. Austin Ludlow Austin Ludlow

    how do you install files from cmd?

Leave a Reply