Push latest

This commit is contained in:
Guy Van Sanden 2025-02-04 13:43:24 +01:00
parent 5af780b3bc
commit a23c693848
2 changed files with 19 additions and 7 deletions

14
client/package.json Normal file
View File

@ -0,0 +1,14 @@
{
"name": "TellMe",
"version": "1.3.0",
"description": "TellMe CLI",
"scripts": {
"dev": "webpack-dev-server --inline --hot"
},
"author": "Guy Van Sanden <guy@taurix.net>",
"license": "AGPL",
"dependencies": {
"grunt": "~0.4.5",
"grunt-version": "~1.1.0"
}
}

View File

@ -1,6 +1,5 @@
#!/bin/env python3
from flask import Flask, request, jsonify
# import asyncio
import websocket
import json
import yaml
@ -9,14 +8,11 @@ import random
app = Flask(__name__)
hooks = {}
with open(r'hooks.yml') as hooksfile:
with open(r'/etc/tellme/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))
uri = "ws://localhost:5080"
#message = "#Bottest Hello, world!"
msg = ("%s %s" % (target, message))
@ -28,10 +24,10 @@ def sendmessage(target, message):
json_command = json.dumps(command)
""" Connects to WebSocket server, sends a message, and returns the response """
ws = websocket.create_connection(uri) # Blocking WebSocket connection
# ws = websocket.create_connection(uri) # Blocking WebSocket connection
ws.send(json_command) # Send message to WebSocket
response = ws.recv() # Receive response
ws.close() # Close WebSocket connection
# ws.close() # Close WebSocket connection
print(response)
return response
@ -50,4 +46,6 @@ def webhook_receiver(id):
if __name__ == '__main__':
uri = "ws://localhost:5080"
ws = websocket.create_connection(uri)
app.run(debug=True)