-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmonitor_fixed_trophies.py
28 lines (21 loc) · 988 Bytes
/
monitor_fixed_trophies.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from src.achievement_fixes import list_slugs_with_fixed_achievements
from src.discord_utils import post_slugs_to_discord
from src.json_utils import load_json, load_json_failsafe
from src.time_utils import (
get_fname_for_the_most_recent_of_past_days,
get_fname_for_today,
get_fname_for_yesterday,
)
from src.webhook_utils import WEBHOOK_KEYWORD_FIXED_TROPHY
from src.git_utils import daily_data_has_just_been_fetched
def main() -> None:
if daily_data_has_just_been_fetched():
try:
data_yesterday = load_json(fname=get_fname_for_yesterday())
except FileNotFoundError:
data_yesterday = load_json_failsafe(fname=get_fname_for_the_most_recent_of_past_days())
data_today = load_json(fname=get_fname_for_today())
game_slugs = list_slugs_with_fixed_achievements(data_yesterday, data_today)
post_slugs_to_discord(game_slugs, webhook_keyword=WEBHOOK_KEYWORD_FIXED_TROPHY)
if __name__ == '__main__':
main()