Compare commits
No commits in common. "384ca03e23c77a0d8200f398c24cf699cd3eed25" and "1abab80da446edd88645cc8282ff57704e15cf8a" have entirely different histories.
384ca03e23
...
1abab80da4
|
@ -329,8 +329,7 @@ REDEEMS={
|
|||
```
|
||||
#### File format
|
||||
`redeems.py` is a config file with just a `REDEEMS` key, that assigns a dictionary of redeems to it.
|
||||
Each dictionary entry is a redeem, and the dictionary keys are strings that decide the chat command for the redeem.
|
||||
The redeem names shouldn't have spaces in them.
|
||||
Each dictionary entry is a redeem, and the dictionary keys are strings that decides the chat command for the redeem.
|
||||
The value is another dictionary that needs to have an entry for `"type"` and
|
||||
an entry for `"price"` for non-milestones or `"goal"` for milestones.
|
||||
Optionally, each redeem can also have `"info"` and `"category"` entries.
|
||||
|
|
|
@ -35,13 +35,6 @@ def create_app(test_config=None):
|
|||
if len(app.config['PREFIX']) != 1:
|
||||
raise RuntimeError("Prefix is >1 character. "
|
||||
"Change your config to set 1-character prefix.")
|
||||
|
||||
# Check for spaces in redeems (they won't work)
|
||||
for redeem, _ in app.config['REDEEMS']:
|
||||
if ' ' in redeem:
|
||||
app.logger.warning(f"Redeem {redeem} has spaces in its name.")
|
||||
app.logger.warning("Redeems with spaces are impossible to redeem.")
|
||||
|
||||
|
||||
# prepare webhooks and redeem dashboard blueprints
|
||||
from . import owncast_webhooks
|
||||
|
|
|
@ -37,6 +37,7 @@ def owncast_webhook():
|
|||
display_name = data["eventData"]["user"]["displayName"]
|
||||
current_app.logger.debug(f'New chat message from {display_name}:')
|
||||
current_app.logger.debug(f'{data["eventData"]["rawBody"]}')
|
||||
current_app.logger.debug(f'{data["eventData"]["body"]}')
|
||||
if data["eventData"]["rawBody"].startswith(f"{prefix}help"):
|
||||
send_help()
|
||||
elif data["eventData"]["rawBody"].startswith(f"{prefix}points"):
|
||||
|
|
|
@ -32,11 +32,9 @@ def handle_redeem(message, user_id):
|
|||
elif not note:
|
||||
send_chat(f"Cannot redeem {redeem}, no amount of points specified.")
|
||||
elif not note.isdigit():
|
||||
send_chat(f"Cannot redeem {redeem}, amount of points is not a positive integer.")
|
||||
send_chat(f"Cannot redeem {redeem}, amount of points is not an integer.")
|
||||
elif int(note) > points:
|
||||
send_chat(f"Can't redeem {redeem}, you're donating more points than you have.")
|
||||
elif int(note) == 0:
|
||||
send_chat(f"Can't donate zero points.")
|
||||
elif add_to_milestone(db, user_id, redeem, int(note)):
|
||||
send_chat(f"Succesfully donated to {redeem} milestone!")
|
||||
if check_apply_milestone_completion(db, redeem):
|
||||
|
|
Loading…
Reference in New Issue