A Twitch.tv viewer reward and games system.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

137 lines
4.5 KiB

12 years ago
  1. LoyaltyBot
  2. =========
  3. A TwitchTV viewer reward system
  4. Written in Node and JavaScript
  5. Overview
  6. --------
  7. LoyaltyBot is a chat bot that allows you to reward viewers with loyalty points for hanging out on your stream. It's
  8. main purpose is to allow you, the broadcaster, to reward the viewers that are dedicated to watching your stream as
  9. opposed to the viewers that just stop by for a quick giveaway and leave.
  10. ####Features
  11. - Fully functioning auction and raffle systems
  12. - Double loyalty points for subscribers/loyal viewers
  13. ####Extras
  14. - Moderator commands (currently in development, semi functional)
  15. ####Future Features/Extras
  16. - Free subscriber/paid non-subscriber Jukebox (still in development)
  17. - Stream title updates posted to twitter (still in development)
  18. Basic Setup
  19. -----------
  20. example.js
  21. ````javascript
  22. var LoyaltyBot = require('./lib/initialize.js');
  23. LoyaltyBot.initialize({
  24. // twitch info
  25. twitch : {
  26. channel : 'loyalty',
  27. bot : {name: 'LoyaltyBot', password: 'loyalty!loyalty!loyalty!'},
  28. subscribers : 'https://spreadsheets.google.com/feeds/list/****/od6/public/basic?alt=json'
  29. },
  30. // currency system
  31. currency : {
  32. name : 'LoyaltyPoints',
  33. payrate : 15,
  34. host : '127.0.0.1',
  35. user : 'mysql_user',
  36. password : 'mysql_password',
  37. database : 'mysql_database',
  38. website : 'http://www.loyaltypoints.com'
  39. },
  40. // optional
  41. commands: true
  42. });
  43. ````
  44. Configuration Options
  45. ---------------------
  46. Twitch
  47. - ````channel````: the channel name (in lower case)
  48. - ````bot.name````: the account name of the bot
  49. - ````bot.password````: the password for the bot
  50. - ````subscribers````: a google doc that contains subscriber names (more info on this later)
  51. Currency
  52. - ````name````: custom name for the loyalty points
  53. - ````payrate````: how often to hand out loyalty points (in minutes)
  54. - ````host````: mysql database hostname/ip
  55. - ````user````: username for the mysql database
  56. - ````password````: password for the mysql database
  57. - ````database````: mysql database name
  58. - ````website````: provides loyalty bot with an offsite location for checking currency. can also be and be an empty ````string````
  59. Optional
  60. - ````commands````: enable/disable the ability to use moderator commands. boolean: accepts ````true```` or ````false````
  61. Preparing to Setup Your Channel's Bot
  62. -------------------------------------
  63. ####Create a new bot account
  64. In order to use LoyaltyBot's features you will need to create a new [TwitchTV Account](http://www.twitch.tv/signup). You can name it anything
  65. you wish, all you need to do is pass the username/password to ````bot.name```` and ````bot.password````
  66. ####Create the subscriber/loyal viewer list on Google Docs
  67. Since TwitchTV does not have subscriber information in their api, LoyaltyBot needs a way to obtain that information.
  68. That's where [Google Docs](http://docs.google.com/) comes in.
  69. In the following order:
  70. - Create a new spreadsheet
  71. - Set cell A1 as the header "Username"
  72. - Subscriber names (must be lower case) will then be in column A starting in cell A2 and below (Fig. 1)
  73. - Set the subscriber list to public and change the type to json (Fig. 2)
  74. Side Notes:
  75. - Even if you do not have a subscription button, you can still add loyal viewers to this list for the double loyalty point benefits.
  76. - Why Google Docs and not the MySQL database? Simplicity. It's easier to manually update a google doc spreadsheet daily
  77. then it is to update a MySQL table.
  78. *Figure 1:*
  79. ![Column Setup](http://i.imgur.com/eyQOwGz.jpg)
  80. *Figure 2:*
  81. ![Create Link](http://i.imgur.com/jDU9xOR.jpg)
  82. ####Setting up MySQL tables
  83. LoyaltyBot stores all of the viewer info and moderator commands in a MySQL database and requires specifc table/field names.
  84. LoyaltyBot takes care of all table creation, however if by some chance you need to manually setup the tables the following
  85. contains information about them:
  86. Viewer
  87. - Table Name: ````viewers````
  88. - Field Names: ````user```` [primary key, not null, varchar], ````points```` [not null, integer]
  89. Commands
  90. - Table Name: ````commands````
  91. - Field Names: ````id```` [primary key, autoincrement, not null, integer], ````command```` [not null, text], ````text```` [not null, longtext], ````auth```` [default: 1, integer]
  92. LoyaltyBot In Action
  93. --------------------
  94. ArchonBot - [ArchonTheWizard](http://www.twitch.tv/archonthewizard)
  95. BingBongBot - [CDXLIV](http://www.twitch.tv/cdxliv)
  96. If you're using LoyaltyBot send me a [twitch message](http://www.twitch.tv/message/compose?to=rvca18) so I can add you to this list!