Last Updated: February 25, 2016
·
8.71K
· mnafricano

How to Create a Turntable Bot

<a href="https://turntable.fm/lobby" target="blank">Turntable.FM</a> is a site for sharing music via DJ spots on a digital stage. Basically, it's a virtual concert. Anyone can create a room, but to manage it well, one must use a bot. It was hard for me to piece together a couple of pieces of information to finally get <a href="http://turntable.fm/electricstorm" target="_blank">my bot</a>, KanoBot, up and running, but now that I did, I can help you out.</p>

<h2>Step 1: Getting Node.JS</h2>

To start off, you are going to need to go to the Node.JS <a href="http://nodejs.org/" target="_blank">website</a> and click the green <span style="font-family:sans-serif;background-color:#8BC84B;width:200px;font-size:14px;font-weight:bold;padding:4px 6px;border-radius:2px;cursor:default;">INSTALL</span> button. Follow the instructions to install Node.JS properly.</p>

<h2>Step 2: Downloading & Installing the Turntable API</h2>

Now, you are going to install the ttapi. First, create a folder that you want to contain your bot. Then, in your command propt, type the following:</p>
cd [Folder Location] // Replace "[Folder Location]" with your actual folder location.

* Doing so will tell your command prompt that you want the next lines of code to be executed in the specified folder.</p>

Then, to download & install, type this line of code:</p>
npm install ttapi

* <font color="red">NPM</font> stands for <font color="red">N</font>ode <font color="red">P</font>ackage <font color="red">M</font>anager and is also a command prefix used when installing items in Node.JS via NPM.</p>

<h2 style="margin-top:35px;">Step 3: Downloading the Bot's Script</h2>

After downloading & installing the Turntable API, it's time to <a href="https://d2.creative.adobe.com/api/assets/ceb524f1-e9bd-44de-be62-2c7648011bd9?download=true&access_token=undefined" target="blank">download</a> the script. Be sure, once it's downloaded, to move it into your bot's folder along with the nodemodules</code> folder and to rename it to ttbot.js</code>.</p>

<h2>Step 4: Setting Up Your Bot</h2>

Open up the ttbot.js</code> file in your bot's folder. The only thing you need to change right now is this section:</p> var AUTH = 'xxxxxxxxxxxxxxxxxxxxxxxxxx'; var USERID = 'xxxxxxxxxxxxxxxxxxxxxxxxxx'; var ROOMID = 'xxxxxxxxxxxxxxxxxxxxxxxxxx'; What you are going to need to do is drag this into your bookmarks bar. Once you've done that, create an account for you bot, enter the room you want it to manage, and if it's not already, make it a moderator.</p> After that, while still in the room on your bot's account, you are going to click the the link that you just dragged into your bookmarks bar, take the codes that pop up on the top left of the window, and replace the xxxxxxxxxxxxxxxxxxxxxxxxxx</code> with the code displayed. Repeat the process for the two other codes as well, just copy the code from the white box, and paste it in between the quotes in your ttbot.js</code> file.</p> Once you are done, be sure to save! You are now ready for the final step, step 5.</p> <h2>Step 5: Run Your Bot</h2> I know you are eager to see your bot an action, but don't let that get in the way of your typing skills, it is critical that you don't make an error when typing the upcoming commands. The commands to put your bot in business are: cd [Folder Location] // Replace "[Folder Location]" with your actual folder location. node ttbot.js <h2>That's It, You Are Done!</h2> <br /> <br /> <br /> <br /> * If you happened to encounter any errors when performing step 5, go to my Coderwall <a href="https://coderwall.com/mnafricano">profile</a> and message me.</p>