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.

139 lines
4.7 KiB

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