forked from HouCoder/tele-aria2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
38 lines (27 loc) · 864 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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from argparse import ArgumentParser
import src.toolkits as toolkits
from src.bot import Bot
def initial_args():
parser = ArgumentParser()
parser.add_argument('-c', '--config',
dest='config',
help='The path of your configuration file.',
required=True
)
return parser.parse_args()
def config_validator(config):
if 'bot-token' not in config:
print('bot-token is required!')
exit(1)
if 'chat-ids' not in config:
print('chat-ids is required!')
exit(1)
def main():
aria2_config = toolkits.config_reader(initial_args().config)
config_validator(aria2_config)
telegram_bot = Bot(aria2_config)
telegram_bot.start()
if __name__ == '__main__':
main()