Load hooks from file

This commit is contained in:
Guy Van Sanden 2025-01-30 15:47:14 +01:00
parent 20ede6e02a
commit 5af780b3bc
3 changed files with 7 additions and 8 deletions

View File

@ -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:

2
server/src/hooks.yml Normal file
View File

@ -0,0 +1,2 @@
---
2345555XE: "#Bottest"

View File

@ -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))