userpanel.html 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <title>OwnchatBot</title>
  5. <link rel="icon" type="image/x-icon" href="/static/img/favicon.ico">
  6. <link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
  7. </head>
  8. <script src="/static/userpanel.js"></script>
  9. <div class="navbar">
  10. <div class="tab">
  11. <button tabindex="0" class="tablinks" data-tab="ocbinfo" onclick="openTab(event, 'ocbinfo')">OwnchatBot Info</button>
  12. <button tabindex="1" class="tablinks" data-tab="rewards" onclick="openTab(event, 'rewards')">Points and Rewards</button>
  13. <button tabindex="2" class="tablinks" data-tab="queue" onclick="window.location.href='{{ url_for('web_panels.user_queue', activeTab='queue') }}'">Rewards Queue</button>
  14. </div>
  15. <img alt="Ownchat Bot logo, whimsical robot" src="/static/img/ownchatbotwide.png">
  16. </div>
  17. <div id='ocbinfo' class="tabcontent">
  18. <h3>OwnchatBot Info</h3>
  19. <h4>Reward types</h4>
  20. <ul>
  21. <li><u>Redeems</u> are standard stream point redeems. They get added to the queue for the streamer to fulfill.</li>
  22. <li><u>Votes</u> are just that, votes. You vote on them.</li>
  23. <li><u>Goals</u> are rewards that everyone in chat can contribute to. The streamer fulfills the reward when the goal is reached.</li>
  24. <li><u>Milestones</u> are smaller goals inside a goal, to celebrate and/or reward progress toward the larger goal.</li>
  25. </ul>
  26. <hr>
  27. <h4>Chat commands</h4>
  28. <ul>
  29. <li>{{ prefix }}help - Shows the help message.</li>
  30. <li>{{ prefix }}points - Shows your current points.</li>
  31. <li>{{ prefix }}rewards - Shows you the list of active rewards.</li>
  32. </ul>
  33. <hr>
  34. <table>
  35. <thead>
  36. <tr style="border-bottom: none;">
  37. <th></th>
  38. <th></th>
  39. </tr>
  40. </thead>
  41. {% if kofi_settings['donations'] %}
  42. <tr style="border-bottom: none;">
  43. <td rowspan="2"><h4><a href="{{ kofi_settings['kofi_url'] }}/donate" target="new"><img style="height: 25px; width: auto; padding-right: 8px; !important" alt="Coffee Cup Logo" src="/static/img/kofi_symbol.png"></a> Ko-fi</h4></td>
  44. {% if kofi_settings['donations'] %}
  45. {% set d_points_label = 'point' if kofi_settings['donation_points'] == 1 else 'points' %}
  46. <td>You are awarded {{ kofi_settings['donation_points'] }} {{ d_points_label }} for every dollar donated.<br></td>
  47. {% endif %}
  48. </tr>
  49. {% if gb_settings['integration'] %}
  50. <tr>
  51. {% else %}
  52. <tr style="border-bottom: none;">
  53. {% endif %}
  54. {% if kofi_settings['subs'] %}
  55. {% set s_points_label = 'point' if kofi_settings['sub_points'] == 1 else 'points' %}
  56. <td>Subscribers get {{ kofi_settings['sub_points'] }} {{ s_points_label }} every month.<br></td>
  57. {% endif %}
  58. </tr>
  59. {% endif %}
  60. {% if gb_settings['integration'] %}
  61. {% if gb_settings['donations'] %}
  62. <tr style="border-bottom: none;">
  63. <td><h4><a href="{{ gb_settings['gb_url'] }}" target="new"><img style="height: 25px; width: auto; padding-right: 8px; !important" alt="Give Butter Logo" src="/static/img/givebutter.png"></a> GiveButter</h4></td>
  64. {% set d_points_label = 'point' if gb_settings['donation_points'] == 1 else 'points' %}
  65. <td>You are awarded {{ gb_settings['donation_points'] }} {{ d_points_label }} for every dollar donated.<br></td>
  66. </tr>
  67. {% endif %}
  68. {% endif %}
  69. </table>
  70. {% for user in users %}
  71. {% if user[3] %}
  72. <br>
  73. {% else %}
  74. <br><span style="color: orange;"><i>You must be authenticated with Owncast to earn points for donations.</i></span><br>
  75. {% endif %}
  76. <div>
  77. {% if user[3] %}
  78. <br>
  79. OwnchatBot recognizes your Ko-fi and GiveButter accounts by your email address. In order for OwnchatBot to award your donation points, you must supply your email address.<br><br>
  80. {% with messages = get_flashed_messages(with_categories=true) %}
  81. {% if messages %}
  82. {% for category, message in messages %}
  83. {% if category == 'failure' %}
  84. <span style="color: orange;">{{ message }}</span>
  85. {% endif %}
  86. {% if category == 'success' %}
  87. <span style="color: yellow;">{{ message }}</span>
  88. {% endif %}
  89. {% endfor %}
  90. {% endif %}
  91. {% endwith %}
  92. <form id="code" method="POST" action="/set_viewer_email">
  93. <table>
  94. <tr style="border-bottom: none;">
  95. <td><label for="reg_code">Type !reg_mail into the chat, and enter the code it gives you here:</label></td>
  96. <td><input id="reg_code" type="number" name="code" size="6" aria-required="true" required></td>
  97. </tr>
  98. <tr style="border-bottom: none;">
  99. <td><label for="email">Enter your email address:</label></td>
  100. <td><input id="email" type="text" name="new_email" value="{{ user[4] }}" size="40" aria-required="true" aria-label="Enter email address" required></td>
  101. </tr>
  102. </table>
  103. <input id="code" type="hidden" name="instance" value="{{ instance }}">
  104. <input id="code" type="hidden" name="user_name" value="{{ username }}">
  105. <input id="code" type="hidden" name="user_id" value="{{ user[0] }}"> <button class="button button2" type="submit">Save Email</button>
  106. </form><br>
  107. <i>Email addresses are ONLY used for Ko-fi and GiveButter integration. They are not sent to any other individual or company, and will not be used to create or send mailing lists of any kind. Ever.</i>
  108. {% endif %}
  109. </div>
  110. {% endfor %}
  111. <hr>
  112. <h4>Other stuff</h4>
  113. <div>
  114. Version 1.1.10<br>
  115. OwnchatBot can be downloaded from <a href=https://git.deadtom.me/deadtom/OwnchatBot>https://git.deadtom.me/deadtom/OwnchatBot</a>.<br>
  116. If you are thrilled to death with OwnchatBot, and want to throw a little monetary love DeadTOm's way, <a href=https://ko-fi.com/deadtom>he's on Ko-fi</a>.<br>
  117. OwnchatBot © 2025 by <a href=https://www.deadtom.me>DeadTOm</a> is licensed under <a href=https://creativecommons.org/licenses/by-sa/4.0/>Creative Commons Attribution-ShareAlike 4.0 International</a>.
  118. </div>
  119. <br><br>
  120. </div>
  121. <div id='rewards' class="tabcontent">
  122. <body>
  123. <h3>Points and Rewards</h3>
  124. {% for user in users %}
  125. {% set points_label = 'point' if points_award == 1 else 'points' %}
  126. {% set minutes_label = 'minute' if points_interval == 1 else 'minutes' %}
  127. &nbsp;&nbsp;{{ user[1] }}, you currently have {{ user[2] }} {{ points_label }}.<br>
  128. {% endfor %}
  129. {% set points_label = 'point' if points_award == 1 else 'points' %}
  130. {% set minutes_label = 'minute' if points_interval == 1 else 'minutes' %}
  131. &nbsp;&nbsp;You earn {{ points_award }} {{ points_label }} every {{ points_interval }} {{ minutes_label }}.<br>
  132. {% if kofi_integration %}
  133. {% if kofi_settings['donations'] %}
  134. {% set d_points_label = 'point' if donation_points == 1 else 'points' %}
  135. {% set s_points_label = 'point' if sub_points == 1 else 'points' %}
  136. <br>&nbsp;&nbsp;You can also get {{ kofi_settings['donation_points'] }} {{ d_points_label }} for every dollar you donate on Kofi{% if kofi_settings['subs'] %}, and {{ kofi_settings['sub_points'] }} {{ s_points_label }} every month for subscribing to my Kofi page{% endif %}.
  137. {% endif %}
  138. {% endif %}
  139. <h3><u>Active Votes</u></h3>
  140. {% if votes %}
  141. <table>
  142. <thead>
  143. <tr>
  144. <th style="width: 20%;">Name</th>
  145. <th style="width: 40%;">Description</th>
  146. <th style="width: 20%;">Price</th>
  147. <th style="width: 20%;">Current Tally</th>
  148. </tr>
  149. </thead>
  150. <tbody>
  151. {% for vote in votes %}
  152. <tr>
  153. <td> {{ prefix }}{{ vote[0] }} </td>
  154. <td> {{ vote[2] }} </td>
  155. {% set points_label = 'point' if rewards[vote[0]]["price"] == 1 else 'points' %}
  156. <td> {{ rewards[vote[0]]["price"] }} {{ points_label }}</td>
  157. {% set votes_label = 'vote' if vote[1] == 1 else 'votes' %}
  158. <td> {{ vote[1] }} {{ votes_label }}</td>
  159. </tr>
  160. {% endfor %}
  161. </tbody>
  162. </table>
  163. {% else %}
  164. &nbsp;&nbsp;<span style="color: yellow;">There are currently no active votes</span>
  165. <br>
  166. {% endif %}
  167. <h3><u>Active Goals</u></h3>
  168. {% if goals %}
  169. <table>
  170. <thead>
  171. <tr>
  172. <th style="width: 20%;">Name</th>
  173. <th style="width: 40%;">Description</th>
  174. <th style="width: 25%;">Progress</th>
  175. <th></th>
  176. </tr>
  177. </thead>
  178. <tbody>
  179. {% for goal in goals %}
  180. <tr>
  181. <td> {{ prefix }}{{ goal[0] }} </td>
  182. <td> {{ goal[3] }} </td>
  183. {% set progress = goal[1] / goal[2] * 100 %}
  184. <td>
  185. <div class="bar-light-grey bar-tiny bar-round" style="position: relative;">
  186. <div class="bar-round bar-blue" style="text-align: center; width:{{ progress }}%;">{{ '%0.0f'| format(progress| float) }}%
  187. </div>
  188. {% set milestones = rewards[goal[0]]["milestones"] %}
  189. {% for milestone_key, milestone in milestones.items() %}
  190. {% if milestones[milestone_key][0] and milestones[milestone_key][1] %}
  191. {% if milestones[milestone_key][1] < goal[2] %}
  192. {% set milestone_progress = milestones[milestone_key][1] / goal[2] * 100 %}
  193. <div class="milestone-marker" style="position: absolute; left: {{ milestone_progress }}%; transform: translateX(-50%);">
  194. <img alt="Red Flag" src="/static/img/milestone.png" style="width: 16px; height: 16px;" title="{{ milestones[milestone_key][1] }} points. {{ milestones[milestone_key][0] }}">
  195. </div>
  196. {% endif %}
  197. {% endif %}
  198. {% endfor %}
  199. </div>
  200. </td>
  201. {% if goal[1] == goal[2] %}
  202. <td> {{ goal[1] }} / {{ goal[2] }} <img alt="Party horn with confetti" src=/static/img/tada.png style="width: 24px; height: 24px;"></td>
  203. {% else %}
  204. <td> {{ goal[1] }} / {{ goal[2] }} </td>
  205. {% endif %}
  206. </tr>
  207. {% endfor %}
  208. <tr style="border-bottom: none;">
  209. <td></td>
  210. <td></td>
  211. <td style="font-size: small;">
  212. (Mouse over flags for milestone details)
  213. </td>
  214. </tr>
  215. </tbody>
  216. </table>
  217. {% else %}
  218. &nbsp;&nbsp;<span style="color: yellow;">There are currently no active goals</span>
  219. <br>
  220. {% endif %}
  221. <h3><u>Active Rewards</u></h3>
  222. {% if rewards %}
  223. <table>
  224. <thead>
  225. <tr>
  226. <th style="width: 20%;">Name</th>
  227. <th style="width: 40%;">Description</th>
  228. <th>Cool down</th>
  229. <th style="width: 25%;">Price</th>
  230. <th></th>
  231. </tr>
  232. </thead>
  233. <tbody>
  234. {% for reward, reward_info in rewards.items() %}
  235. {% if reward_info["type"] == "redeem" or reward_info["type"] == "special" %}
  236. <tr>
  237. <td>{{ prefix }}{{ reward }}</td>
  238. <td>{{ reward_info["info"] }}</td>
  239. {% if reward_info["cooldown"] > 0 %}
  240. {% set minutes_label = 'minute' if reward_info["cooldown"] == 1 else 'minutes' %}
  241. <td>{{ reward_info["cooldown"] }} {{ minutes_label }}</td>
  242. {% else %}
  243. <td>None</td>
  244. {% endif %}
  245. {% set points_label = 'point' if reward_info["price"] == 1 else 'points' %}
  246. <td>{{ reward_info["price"] }} {{ points_label }}</td>
  247. <td></td>
  248. </tr>
  249. {% endif %}
  250. {% endfor %}
  251. </tbody>
  252. </table>
  253. {% else %}
  254. &nbsp;&nbsp;<span style="color: yellow;">There are currently no active redeems</span>
  255. {% endif %}
  256. <br><br>
  257. </body>
  258. </div>
  259. </html>