remove old/unnecessary checks
This commit is contained in:
parent
26f7706b2d
commit
ed79404530
|
@ -20,45 +20,36 @@ def owncast_webhook():
|
||||||
old_names = data["eventData"]["user"]["previousNames"]
|
old_names = data["eventData"]["user"]["previousNames"]
|
||||||
change_display_name(db, user_id, new_name)
|
change_display_name(db, user_id, new_name)
|
||||||
elif data["type"] == "CHAT":
|
elif data["type"] == "CHAT":
|
||||||
if data["eventData"]["visible"]:
|
user_id = data["eventData"]["user"]["id"]
|
||||||
user_id = data["eventData"]["user"]["id"]
|
display_name = data["eventData"]["user"]["displayName"]
|
||||||
display_name = data["eventData"]["user"]["displayName"]
|
print(f'New chat message from {display_name}:')
|
||||||
print("New chat message:")
|
print(f'{data["eventData"]["body"]}')
|
||||||
print(f'from {display_name}:')
|
if "!help" in data["eventData"]["body"]:
|
||||||
print(f'{data["eventData"]["body"]}')
|
message = """Tlapbot commands:
|
||||||
if "!help" in data["eventData"]["body"]:
|
!points to see your points.
|
||||||
message = """Tlapbot commands:
|
!drink to redeem a pitíčko for 60 points.
|
||||||
!points to see your points.
|
That's it for now."""
|
||||||
!drink to redeem a pitíčko for 60 points.
|
send_chat(message)
|
||||||
That's it for now."""
|
elif "!points" in data["eventData"]["body"]:
|
||||||
send_chat(message)
|
if not user_exists(db, user_id):
|
||||||
elif "!points" in data["eventData"]["body"]:
|
add_user_to_database(db, user_id, display_name)
|
||||||
if not user_exists(db, user_id):
|
points = read_users_points(db, user_id)
|
||||||
add_user_to_database(db, user_id, display_name)
|
message = "{}'s points: {}".format(display_name, points)
|
||||||
points = read_users_points(db, user_id)
|
send_chat(message)
|
||||||
message = "{}'s points: {}".format(display_name, points)
|
elif "!drink" in data["eventData"]["body"]:
|
||||||
send_chat(message)
|
points = read_users_points(db, user_id)
|
||||||
elif "!drink" in data["eventData"]["body"]:
|
if points is not None and points >= 60:
|
||||||
points = read_users_points(db, user_id)
|
if use_points(db, user_id, 60):
|
||||||
if points is not None and points >= 60:
|
add_to_redeem_queue(db, user_id, "drink")
|
||||||
if use_points(db, user_id, 60):
|
send_chat("Pitíčko redeemed for 60 points.")
|
||||||
add_to_redeem_queue(db, user_id, "drink")
|
|
||||||
send_chat("Pitíčko redeemed for 60 points.")
|
|
||||||
else:
|
|
||||||
send_chat("Pitíčko not redeemed because of an error.")
|
|
||||||
else:
|
else:
|
||||||
send_chat("Can't redeem pitíčko, you don't have enough points.")
|
send_chat("Pitíčko not redeemed because of an error.")
|
||||||
elif "!name_update" in data["eventData"]["body"]:
|
else:
|
||||||
# Forces name update in case bot didn't catch the NAME_CHANGE
|
send_chat("Can't redeem pitíčko, you don't have enough points.")
|
||||||
# event. Theoretically only needed when bot was off.
|
elif "!name_update" in data["eventData"]["body"]:
|
||||||
change_display_name(db, user_id, display_name)
|
# Forces name update in case bot didn't catch the NAME_CHANGE
|
||||||
elif "!clear" in data["eventData"]["body"]:
|
# event. Theoretically only needed when bot was off.
|
||||||
clear_redeem_queue(db)
|
change_display_name(db, user_id, display_name)
|
||||||
elif "!queue" in data["eventData"]["body"]:
|
elif "!clear" in data["eventData"]["body"]:
|
||||||
queue = pretty_redeem_queue(db)
|
clear_redeem_queue(db)
|
||||||
print("timestamp | redeem | redeemer")
|
|
||||||
for row in queue:
|
|
||||||
print(row[0], " ", row[1], " ", row[2])
|
|
||||||
# else: # DEBUG: give points for message
|
|
||||||
# give_points_to_chat(db)
|
|
||||||
return data
|
return data
|
Loading…
Reference in New Issue