You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
775 B
39 lines
775 B
import json
|
|
import os.path
|
|
import sys
|
|
import traceback
|
|
|
|
from bot_instance import BotInstance
|
|
|
|
|
|
def load_user_config():
|
|
with open("config.json", "r") as config_file:
|
|
config = json.load(config_file)
|
|
return config
|
|
|
|
|
|
def init_bot(config):
|
|
return BotInstance(config)
|
|
|
|
|
|
def execute_bot(config, freq, log_file):
|
|
print("execute bot... %s" % freq)
|
|
bot = init_bot(config)
|
|
bot.block_reports(freq, log_file)
|
|
|
|
|
|
def main():
|
|
with open('log.txt', 'a') as log_file:
|
|
try:
|
|
config = load_user_config()
|
|
execute_bot(config, sys.argv[1], log_file)
|
|
except Exception as e:
|
|
traceback.print_exc(file=log_file)
|
|
sys.exit(1)
|
|
sys.exit(0)
|
|
|
|
|
|
# Run main function
|
|
if __name__ == "__main__":
|
|
main()
|