From 5af780b3bc77549eb8fbd820e11390e51efb5942 Mon Sep 17 00:00:00 2001 From: Guy Van Sanden Date: Thu, 30 Jan 2025 15:47:14 +0100 Subject: [PATCH] Load hooks from file --- client/src/tellme.py | 7 ------- server/src/hooks.yml | 2 ++ server/src/tellmesrv.py | 6 +++++- 3 files changed, 7 insertions(+), 8 deletions(-) create mode 100644 server/src/hooks.yml diff --git a/client/src/tellme.py b/client/src/tellme.py index 4541fb3..d30c6d9 100755 --- a/client/src/tellme.py +++ b/client/src/tellme.py @@ -73,13 +73,6 @@ webhook = config['webhook'] message = args.message -notify = None -if args.notify is None: - if config.get('notify') is not None: - notify = config.get('notify') -else: - notify = args.notify - ran = False if args.pid != 0: diff --git a/server/src/hooks.yml b/server/src/hooks.yml new file mode 100644 index 0000000..c66800c --- /dev/null +++ b/server/src/hooks.yml @@ -0,0 +1,2 @@ +--- +2345555XE: "#Bottest" diff --git a/server/src/tellmesrv.py b/server/src/tellmesrv.py index 13499e0..7f1b074 100644 --- a/server/src/tellmesrv.py +++ b/server/src/tellmesrv.py @@ -3,12 +3,16 @@ from flask import Flask, request, jsonify # import asyncio import websocket import json +import yaml import random app = Flask(__name__) hooks = {} -hooks['2345555XE'] = '#Bottest' +with open(r'hooks.yml') as hooksfile: + hooks = yaml.load(hooksfile, Loader=yaml.FullLoader) +print(hooks) +#hooks['2345555XE'] = '#Bottest' def sendmessage(target, message): print("Sendmessage %s called to %s" % (message, target))