Push latest
This commit is contained in:
parent
5af780b3bc
commit
a23c693848
14
client/package.json
Normal file
14
client/package.json
Normal 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"
|
||||
}
|
||||
}
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user