-
Notifications
You must be signed in to change notification settings - Fork 3
/
__main__.py
38 lines (32 loc) · 997 Bytes
/
__main__.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
29
30
31
32
33
34
35
36
37
38
"""
__main__.py
Reads out settings and CLI params and runs bot with them
"""
import json
from src_constants import CELESTE_GAMES
from celeste_bot import CelesteLeaderboardBot
from data_models import Credentials
from dacite import from_dict
from argparse import ArgumentParser, Namespace
# argparse
parser: ArgumentParser = ArgumentParser(
description="Celeste speedrun.com bot to reject faulty submissions",
allow_abbrev=True,
)
parser.add_argument(
"-c",
"--credentials",
type=str,
help="path to credentials.json file",
default="./credentials.json",
)
parser.add_argument(
"-t", "--timer", type=int, help="interval between polls", default=60
)
args: Namespace = parser.parse_args()
# read out credentials.json dict and parse to class
with open(args.credentials) as file:
creds_d: dict = json.loads(file.read())
creds = from_dict(data_class=Credentials, data=creds_d)
# create and start bot
CelesteLeaderboardBot(creds, CELESTE_GAMES, args.timer).start()