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.

162 lines
5.3 KiB

12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
  1. LoyaltyBot
  2. =========
  3. A TwitchTV viewer reward system
  4. Written in JavaScript and Node
  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. - Betting and voting systems in place
  13. - Double loyalty points for subscribers/loyal viewers
  14. ####Extras
  15. - Moderator commands (currently in development, semi functional)
  16. - Web frontend
  17. - Currency exchange between bots
  18. ####Future Features/Extras
  19. - Free subscriber/paid non-subscriber Jukebox (still in development)
  20. - Stream title updates posted to twitter (still in development)
  21. Basic Setup
  22. -----------
  23. example.js
  24. ````javascript
  25. var loyaltybot = require('./../lib/initialize.js');
  26. loyaltybot.initialize({
  27. // twitch info
  28. twitch : {
  29. channel : 'loyalty',
  30. bot : {name: 'LoyaltyBot', password: 'loyalty!loyalty!loyalty!'},
  31. subscribers : 'https://spreadsheets.google.com/feeds/list/****/od6/public/basic?alt=json'
  32. },
  33. // currency info
  34. currency : {
  35. name : 'Points',
  36. payrate : 15,
  37. host : '127.0.0.1',
  38. user : 'mysql_user',
  39. password : 'mysql_password',
  40. database : 'mysql_database',
  41. website : 'http://www.loyaltypoints.com',
  42. modpowers: true, // NEW
  43. sub_ty_msg: 'SUBHYPE', // NEW
  44. },
  45. web: {
  46. port: 8000,
  47. slogan: 'WEBSITE SLOGAN HERE',
  48. logo: 'logo.jpg',
  49. twitter: 'example',
  50. chatlog: false,
  51. statdir: 'example',
  52. fanart: [
  53. {
  54. url: "https://imageurl.com/image.png",
  55. user: "Author",
  56. user_link: "http://authorurl.com"
  57. },
  58. {
  59. url: "https://imageurl.com/image.png",
  60. user: "Author",
  61. user_link: "http://authorurl.com"
  62. },
  63. ],
  64. },
  65. // optional features
  66. commands: true,
  67. exchanges: {'option_name':8001, 'gdollars':8002},
  68. ignorelist: ['jtv', 'bot_potato', 'moobot']
  69. });
  70. ````
  71. Configuration Options
  72. ---------------------
  73. Twitch
  74. - ````channel````: the channel name (in lower case)
  75. - ````bot.name````: the account name of the bot
  76. - ````bot.password````: the password for the bot
  77. - ````subscribers````: a google doc that contains subscriber names (more info on this later)
  78. Currency
  79. - ````name````: custom name for the loyalty points
  80. - ````payrate````: how often to hand out loyalty points (in minutes)
  81. - ````host````: mysql database hostname/ip
  82. - ````user````: username for the mysql database
  83. - ````password````: password for the mysql database
  84. - ````database````: mysql database name
  85. - ````website````: provides loyalty bot with an offsite location for checking currency. can also be and be an empty ````string````
  86. - ````modpowers````: let moderators use streamer-only commands? (boolean true/false)
  87. - ````sub_ty_msg````: message to print when new subscription is detected
  88. Optional
  89. - ````commands````: enable/disable the ability to use moderator commands. boolean: accepts ````true```` or ````false````
  90. - ````exchanges````: set ports for other bots, allows currency exchange between
  91. - ````gnorelist````: usernames to ignore, remove bot and things like moobot from the hiscore list
  92. Preparing to Setup Your Channel's Bot
  93. -------------------------------------
  94. ####Create a new bot account
  95. 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
  96. you wish, all you need to do is pass the username/password to ````bot.name```` and ````bot.password````
  97. ####Create the subscriber/loyal viewer list on Google Docs
  98. Since TwitchTV does not have subscriber information in their api, LoyaltyBot needs a way to obtain that information.
  99. That's where [Google Docs](http://docs.google.com/) comes in.
  100. In the following order:
  101. - Create a new spreadsheet
  102. - Set cell A1 as the header "Username"
  103. - Subscriber names (must be lower case) will then be in column A starting in cell A2 and below (Fig. 1)
  104. - Set the subscriber list to public and change the type to json (Fig. 2)
  105. Side Notes:
  106. - Even if you do not have a subscription button, you can still add loyal viewers to this list for the double loyalty point benefits.
  107. - Why Google Docs and not the MySQL database? Simplicity. It's easier to manually update a google doc spreadsheet daily
  108. then it is to update a MySQL table.
  109. *Figure 1:*
  110. ![Column Setup](http://i.imgur.com/eyQOwGz.jpg)
  111. *Figure 2:*
  112. ![Create Link](http://i.imgur.com/jDU9xOR.jpg)
  113. ####Setting up MySQL tables
  114. LoyaltyBot stores all of the viewer info and moderator commands in a MySQL database and requires specifc table/field names.
  115. LoyaltyBot takes care of all table creation, however if by some chance you need to manually setup the tables the following
  116. contains information about them:
  117. Viewer
  118. - Table Name: ````viewers````
  119. - Field Names: ````user```` [primary key, not null, varchar], ````points```` [not null, integer]
  120. Commands
  121. - Table Name: ````commands````
  122. - Field Names: ````id```` [primary key, autoincrement, not null, integer], ````command```` [not null, text], ````text```` [not null, longtext], ````auth```` [default: 1, integer]