-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.py
38 lines (31 loc) · 774 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
import sys
import os
import json
import telegram
# Configuration
setting_file_name = 'config.json'
settings = None # Load here configuration and use as global
def read_configuration_file():
"""
Read configuration file
"""
exist = os.path.isfile(setting_file_name)
if not exist:
print("Error reading config file: %s" % setting_file_name)
sys.exit(1)
else:
global settings
with open(setting_file_name) as data_file:
settings = json.load(data_file)
return
def main():
"""
Main: Print bot info
"""
read_configuration_file()
bot = telegram.Bot(token=settings["token"])
print(bot.get_me())
return
if __name__ == '__main__':
# Entry point
main()