|
|
@@ -4,6 +4,7 @@ from ownchatbot.owncast_com import send_chat, send_private_chat
|
|
|
from ownchatbot.reward_handlers import run_script, add_to_queue, add_to_vote, add_to_goal, was_goal_reached, goal_reached, is_reward_active, check_vote, all_active_goals, goal_left, was_milestone_reached
|
|
|
from ownchatbot.user_handlers import spend_points, get_users_points, refund_points, get_all_users_with_user_id
|
|
|
import os
|
|
|
+from ownchatbot import followers, donations, subscribers, rgoal, rmilestone
|
|
|
|
|
|
|
|
|
def porps(points): # Pluralize points based on the number of points
|
|
|
@@ -34,6 +35,8 @@ def mas(time_diff): # Convert time difference decimal number to minutes and sec
|
|
|
|
|
|
def do_reward(message, user_id): # Parse the chat command
|
|
|
db = get_db()
|
|
|
+ global rmilestone
|
|
|
+ global rgoal
|
|
|
for user in get_all_users_with_user_id(db, user_id):
|
|
|
username = user[1]
|
|
|
prefix = current_app.config['PREFIX']
|
|
|
@@ -74,8 +77,10 @@ def do_reward(message, user_id): # Parse the chat command
|
|
|
send_chat(f'{username} contributed {porps(contribution)} to the \"{prefix}{reward}\" goal.')
|
|
|
wmr = was_milestone_reached(db, reward)
|
|
|
if wmr:
|
|
|
+ rmilestone = [username, wmr]
|
|
|
send_chat(f'{wmr} milestone reached!')
|
|
|
if was_goal_reached(db, reward):
|
|
|
+ rgoal = [username, reward]
|
|
|
send_chat(f'\"{prefix}{reward}\" target reached! 🎉')
|
|
|
else:
|
|
|
send_private_chat(user_id, f'Couldn\'t contribute to the \"{prefix}{reward}\" goal for {username}, for some highly technical reason.')
|