/hashbot

turntable.fm hashbot

Primary LanguageJavaScript

Basic start-up information:

Take the config.js.default file and rename it to config.js.  Update the default values to the proper values for your bot.

To figure out your AUTH, USERID and ROOMID, please follow the directions from the Turntable API Wiki:
https://github.com/alaingilbert/Turntable-API/wiki/How-to-find-the:-auth,-userid-and-roomid

-----------------------------------------------------------------------
Goes Down Easy's Comments:
-----------------------------------------------------------------------
To figure out the TWITTER* config settings:
Create a twitter account
Register a twitter application through dev.twitter.com
Make sure the application has read/write/direct message access
Generate the Consumer Key and Consumer Secret

Install node.js
To install missing modules:  npm install <module>

Install mysql
Create a new hashbot table
Create a table with fields 'songs','users','last_seen'

-----------------------------------------------------------------------
Uncle Bad Touch's Comments:
-----------------------------------------------------------------------
Commands with variable types I used to create the tables in the MySQL DB:

CREATE TABLE IF NOT EXISTS `last_seen` (
  `user_id` varchar(24) COLLATE utf8_unicode_ci NOT NULL,
  `room_id` varchar(24) COLLATE utf8_unicode_ci NOT NULL,
  `timestamp` datetime NOT NULL,
  PRIMARY KEY (`user_id`,`room_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE IF NOT EXISTS `songs` (
  `id` varchar(24) COLLATE utf8_unicode_ci NOT NULL,
  `room_id` varchar(24) COLLATE utf8_unicode_ci NOT NULL,
  `awesomes` int(11) NOT NULL DEFAULT '0',
  `lames` int(11) NOT NULL DEFAULT '0',
  `snags` int(11) NOT NULL DEFAULT '0',
  `playcount` int(11) NOT NULL DEFAULT '0',
  `lastplayed` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `starttime` varchar(13) COLLATE utf8_unicode_ci NOT NULL,
  `currentawesomes` int(11) NOT NULL DEFAULT '0',
  `currentlames` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`,`room_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE IF NOT EXISTS `users` (
  `id` varchar(24) COLLATE utf8_unicode_ci NOT NULL,
  `name` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`id`,`name`),
  FULLTEXT KEY `name` (`name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;