prizebot fixes

pull/484/head
Mike Lang 2 weeks ago
parent 968e6ec273
commit e794b0cf7d

@ -356,7 +356,7 @@
// Path in host fs for the state file. // Path in host fs for the state file.
// Must exist and be initialized to "{}" // Must exist and be initialized to "{}"
state_path:: "./prizebot_state.json", state_path:: "./prizebot_state.json",
} },
// template for donation data urls // template for donation data urls
donation_url_template:: "https://example.com/DB{}/DB{}.json", donation_url_template:: "https://example.com/DB{}/DB{}.json",

@ -83,10 +83,10 @@ def main(config_file, test=False, all=False, once=False, interval=60):
for type in ('live', 'silent', 'giveaway'): for type in ('live', 'silent', 'giveaway'):
prizes = get_prizes(type) prizes = get_prizes(type)
for prize in prizes: for prize in prizes:
logging.info(f"Got prize: {prize}")
if prize.state == "sold" and (all or state.get(prize.id, "sold") != "sold"): if prize.state == "sold" and (all or state.get(prize.id, "sold") != "sold"):
send_message(client, prize, test=test) send_message(client, prize, test=test)
state[prize.id] = prize.state state[prize.id] = prize.state
print(state)
if not test: if not test:
with open(config['state'], 'w') as f: with open(config['state'], 'w') as f:
f.write(json.dumps(state) + '\n') f.write(json.dumps(state) + '\n')

Loading…
Cancel
Save