-
Notifications
You must be signed in to change notification settings - Fork 8
/
cli.py
38 lines (31 loc) · 973 Bytes
/
cli.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
import logging
from config import Config
from forwarder.forwarder import Forwarder
from sys import exit
from datetime import datetime
logging.basicConfig(
filename=Config.LOG_FILE,
filemode="a",
level=logging.INFO,
format="%(asctime)s [%(filename)s:%(lineno)d]|%(levelname)s|%(message)s",
)
logger = logging.getLogger(__name__)
# initial variables
start_time = datetime.now()
logger.info(f"Starting forwarder-app at {start_time}")
print(
"\n---------- ----------- ----------\nTelegram Forwarder App by @Alvhix\n---------- ----------- ----------\n"
)
# build the forwarder object
forwarder = Forwarder(
api_id=Config.API_ID,
api_hash=Config.API_HASH,
rules_path=Config.RULES_PATH,
periodicity_fwd=Config.PERIODICITY,
group_messages=Config.GROUP_MESSAGE,
verbosity=Config.TDJSON_VERBOSITY,
)
# start the forwarder
forwarder.start()
logger.info(f"Stopping forwarder-app: executed for {datetime.now() - start_time}\n")
exit()