Test threading lock
This commit is contained in:
parent
139a7fc7d3
commit
4801b74405
@ -1,5 +1,5 @@
|
|||||||
TellMe (1.3.0)
|
TellMe Server (2.0.0b2)
|
||||||
* Add support for mentions (-n)
|
* Add logging
|
||||||
|
|
||||||
TellMe (1.2.0)
|
TellMe Server (2.0.0b1)
|
||||||
* Feature complete version
|
* First standalone bot with SimpleX support
|
||||||
|
302
package-lock.json
generated
302
package-lock.json
generated
@ -1,302 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "TellMe",
|
|
||||||
"version": "1.0.1",
|
|
||||||
"lockfileVersion": 1,
|
|
||||||
"requires": true,
|
|
||||||
"dependencies": {
|
|
||||||
"abbrev": {
|
|
||||||
"version": "1.1.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",
|
|
||||||
"integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q=="
|
|
||||||
},
|
|
||||||
"argparse": {
|
|
||||||
"version": "0.1.16",
|
|
||||||
"resolved": "https://registry.npmjs.org/argparse/-/argparse-0.1.16.tgz",
|
|
||||||
"integrity": "sha1-z9AeD7uj1srtBJ+9dY1A9lGW9Xw=",
|
|
||||||
"requires": {
|
|
||||||
"underscore": "~1.7.0",
|
|
||||||
"underscore.string": "~2.4.0"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"underscore.string": {
|
|
||||||
"version": "2.4.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-2.4.0.tgz",
|
|
||||||
"integrity": "sha1-jN2PusTi0uoefi6Al8QvRCKA+Fs="
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"async": {
|
|
||||||
"version": "0.1.22",
|
|
||||||
"resolved": "https://registry.npmjs.org/async/-/async-0.1.22.tgz",
|
|
||||||
"integrity": "sha1-D8GqoIig4+8Ovi2IMbqw3PiEUGE="
|
|
||||||
},
|
|
||||||
"coffee-script": {
|
|
||||||
"version": "1.3.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/coffee-script/-/coffee-script-1.3.3.tgz",
|
|
||||||
"integrity": "sha1-FQ1rTLUiiUNp7+1qIQHCC8f0pPQ="
|
|
||||||
},
|
|
||||||
"colors": {
|
|
||||||
"version": "0.6.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/colors/-/colors-0.6.2.tgz",
|
|
||||||
"integrity": "sha1-JCP+ZnisDF2uiFLl0OW+CMmXq8w="
|
|
||||||
},
|
|
||||||
"dateformat": {
|
|
||||||
"version": "1.0.2-1.2.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/dateformat/-/dateformat-1.0.2-1.2.3.tgz",
|
|
||||||
"integrity": "sha1-sCIMAt6YYXQztyhRz0fePfLNvuk="
|
|
||||||
},
|
|
||||||
"esprima": {
|
|
||||||
"version": "1.0.4",
|
|
||||||
"resolved": "https://registry.npmjs.org/esprima/-/esprima-1.0.4.tgz",
|
|
||||||
"integrity": "sha1-n1V+CPw7TSbs6d00+Pv0drYlha0="
|
|
||||||
},
|
|
||||||
"eventemitter2": {
|
|
||||||
"version": "0.4.14",
|
|
||||||
"resolved": "https://registry.npmjs.org/eventemitter2/-/eventemitter2-0.4.14.tgz",
|
|
||||||
"integrity": "sha1-j2G3XN4BKy6esoTUVFWDtWQ7Yas="
|
|
||||||
},
|
|
||||||
"exit": {
|
|
||||||
"version": "0.1.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz",
|
|
||||||
"integrity": "sha1-BjJjj42HfMghB9MKD/8aF8uhzQw="
|
|
||||||
},
|
|
||||||
"findup-sync": {
|
|
||||||
"version": "0.1.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-0.1.3.tgz",
|
|
||||||
"integrity": "sha1-fz56l7gjksZTvwZYm9hRkOk8NoM=",
|
|
||||||
"requires": {
|
|
||||||
"glob": "~3.2.9",
|
|
||||||
"lodash": "~2.4.1"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"glob": {
|
|
||||||
"version": "3.2.11",
|
|
||||||
"resolved": "https://registry.npmjs.org/glob/-/glob-3.2.11.tgz",
|
|
||||||
"integrity": "sha1-Spc/Y1uRkPcV0QmH1cAP0oFevj0=",
|
|
||||||
"requires": {
|
|
||||||
"inherits": "2",
|
|
||||||
"minimatch": "0.3"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"lodash": {
|
|
||||||
"version": "2.4.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-2.4.2.tgz",
|
|
||||||
"integrity": "sha1-+t2DS5aDBz2hebPq5tnA0VBT9z4="
|
|
||||||
},
|
|
||||||
"minimatch": {
|
|
||||||
"version": "0.3.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.3.0.tgz",
|
|
||||||
"integrity": "sha1-J12O2qxPG7MyZHIInnlJyDlGmd0=",
|
|
||||||
"requires": {
|
|
||||||
"lru-cache": "2",
|
|
||||||
"sigmund": "~1.0.0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"getobject": {
|
|
||||||
"version": "0.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/getobject/-/getobject-0.1.0.tgz",
|
|
||||||
"integrity": "sha1-BHpEl4n6Fg0Bj1SG7ZEyC27HiFw="
|
|
||||||
},
|
|
||||||
"glob": {
|
|
||||||
"version": "3.1.21",
|
|
||||||
"resolved": "https://registry.npmjs.org/glob/-/glob-3.1.21.tgz",
|
|
||||||
"integrity": "sha1-0p4KBV3qUTj00H7UDomC6DwgZs0=",
|
|
||||||
"requires": {
|
|
||||||
"graceful-fs": "~1.2.0",
|
|
||||||
"inherits": "1",
|
|
||||||
"minimatch": "~0.2.11"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"inherits": {
|
|
||||||
"version": "1.0.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-1.0.2.tgz",
|
|
||||||
"integrity": "sha1-ykMJ2t7mtUzAuNJH6NfHoJdb3Js="
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"graceful-fs": {
|
|
||||||
"version": "1.2.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-1.2.3.tgz",
|
|
||||||
"integrity": "sha1-FaSAaldUfLLS2/J/QuiajDRRs2Q="
|
|
||||||
},
|
|
||||||
"grunt": {
|
|
||||||
"version": "0.4.5",
|
|
||||||
"resolved": "https://registry.npmjs.org/grunt/-/grunt-0.4.5.tgz",
|
|
||||||
"integrity": "sha1-VpN81RlDJK3/bSB2MYMqnWuk5/A=",
|
|
||||||
"requires": {
|
|
||||||
"async": "~0.1.22",
|
|
||||||
"coffee-script": "~1.3.3",
|
|
||||||
"colors": "~0.6.2",
|
|
||||||
"dateformat": "1.0.2-1.2.3",
|
|
||||||
"eventemitter2": "~0.4.13",
|
|
||||||
"exit": "~0.1.1",
|
|
||||||
"findup-sync": "~0.1.2",
|
|
||||||
"getobject": "~0.1.0",
|
|
||||||
"glob": "~3.1.21",
|
|
||||||
"grunt-legacy-log": "~0.1.0",
|
|
||||||
"grunt-legacy-util": "~0.2.0",
|
|
||||||
"hooker": "~0.2.3",
|
|
||||||
"iconv-lite": "~0.2.11",
|
|
||||||
"js-yaml": "~2.0.5",
|
|
||||||
"lodash": "~0.9.2",
|
|
||||||
"minimatch": "~0.2.12",
|
|
||||||
"nopt": "~1.0.10",
|
|
||||||
"rimraf": "~2.2.8",
|
|
||||||
"underscore.string": "~2.2.1",
|
|
||||||
"which": "~1.0.5"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"grunt-legacy-log": {
|
|
||||||
"version": "0.1.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/grunt-legacy-log/-/grunt-legacy-log-0.1.3.tgz",
|
|
||||||
"integrity": "sha1-7ClCboAwIa9ZAp+H0vnNczWgVTE=",
|
|
||||||
"requires": {
|
|
||||||
"colors": "~0.6.2",
|
|
||||||
"grunt-legacy-log-utils": "~0.1.1",
|
|
||||||
"hooker": "~0.2.3",
|
|
||||||
"lodash": "~2.4.1",
|
|
||||||
"underscore.string": "~2.3.3"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"lodash": {
|
|
||||||
"version": "2.4.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-2.4.2.tgz",
|
|
||||||
"integrity": "sha1-+t2DS5aDBz2hebPq5tnA0VBT9z4="
|
|
||||||
},
|
|
||||||
"underscore.string": {
|
|
||||||
"version": "2.3.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-2.3.3.tgz",
|
|
||||||
"integrity": "sha1-ccCL9rQosRM/N+ePo6Icgvcymw0="
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"grunt-legacy-log-utils": {
|
|
||||||
"version": "0.1.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/grunt-legacy-log-utils/-/grunt-legacy-log-utils-0.1.1.tgz",
|
|
||||||
"integrity": "sha1-wHBrndkGThFvNvI/5OawSGcsD34=",
|
|
||||||
"requires": {
|
|
||||||
"colors": "~0.6.2",
|
|
||||||
"lodash": "~2.4.1",
|
|
||||||
"underscore.string": "~2.3.3"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"lodash": {
|
|
||||||
"version": "2.4.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-2.4.2.tgz",
|
|
||||||
"integrity": "sha1-+t2DS5aDBz2hebPq5tnA0VBT9z4="
|
|
||||||
},
|
|
||||||
"underscore.string": {
|
|
||||||
"version": "2.3.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-2.3.3.tgz",
|
|
||||||
"integrity": "sha1-ccCL9rQosRM/N+ePo6Icgvcymw0="
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"grunt-legacy-util": {
|
|
||||||
"version": "0.2.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/grunt-legacy-util/-/grunt-legacy-util-0.2.0.tgz",
|
|
||||||
"integrity": "sha1-kzJIhNv343qf98Am3/RR2UqeVUs=",
|
|
||||||
"requires": {
|
|
||||||
"async": "~0.1.22",
|
|
||||||
"exit": "~0.1.1",
|
|
||||||
"getobject": "~0.1.0",
|
|
||||||
"hooker": "~0.2.3",
|
|
||||||
"lodash": "~0.9.2",
|
|
||||||
"underscore.string": "~2.2.1",
|
|
||||||
"which": "~1.0.5"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"grunt-version": {
|
|
||||||
"version": "1.1.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/grunt-version/-/grunt-version-1.1.1.tgz",
|
|
||||||
"integrity": "sha1-C58oAhLKPITKhEGmiK0aB6R05vM=",
|
|
||||||
"requires": {
|
|
||||||
"grunt": "0.4.5 - 1",
|
|
||||||
"semver": "^4.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"hooker": {
|
|
||||||
"version": "0.2.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/hooker/-/hooker-0.2.3.tgz",
|
|
||||||
"integrity": "sha1-uDT3I8xKJCqmWWNFnfbZhMXT2Vk="
|
|
||||||
},
|
|
||||||
"iconv-lite": {
|
|
||||||
"version": "0.2.11",
|
|
||||||
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.2.11.tgz",
|
|
||||||
"integrity": "sha1-HOYKOleGSiktEyH/RgnKS7llrcg="
|
|
||||||
},
|
|
||||||
"inherits": {
|
|
||||||
"version": "2.0.4",
|
|
||||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
|
||||||
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
|
|
||||||
},
|
|
||||||
"js-yaml": {
|
|
||||||
"version": "2.0.5",
|
|
||||||
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-2.0.5.tgz",
|
|
||||||
"integrity": "sha1-olrmUJmZ6X3yeMZxnaEb0Gh3Q6g=",
|
|
||||||
"requires": {
|
|
||||||
"argparse": "~ 0.1.11",
|
|
||||||
"esprima": "~ 1.0.2"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"lodash": {
|
|
||||||
"version": "0.9.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-0.9.2.tgz",
|
|
||||||
"integrity": "sha1-jzSZxSRdNG1oLlsNO0B2fgnxqSw="
|
|
||||||
},
|
|
||||||
"lru-cache": {
|
|
||||||
"version": "2.7.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-2.7.3.tgz",
|
|
||||||
"integrity": "sha1-bUUk6LlV+V1PW1iFHOId1y+06VI="
|
|
||||||
},
|
|
||||||
"minimatch": {
|
|
||||||
"version": "0.2.14",
|
|
||||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.2.14.tgz",
|
|
||||||
"integrity": "sha1-x054BXT2PG+aCQ6Q775u9TpqdWo=",
|
|
||||||
"requires": {
|
|
||||||
"lru-cache": "2",
|
|
||||||
"sigmund": "~1.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nopt": {
|
|
||||||
"version": "1.0.10",
|
|
||||||
"resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz",
|
|
||||||
"integrity": "sha1-bd0hvSoxQXuScn3Vhfim83YI6+4=",
|
|
||||||
"requires": {
|
|
||||||
"abbrev": "1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"rimraf": {
|
|
||||||
"version": "2.2.8",
|
|
||||||
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.2.8.tgz",
|
|
||||||
"integrity": "sha1-5Dm+Kq7jJzIZUnMPmaiSnk/FBYI="
|
|
||||||
},
|
|
||||||
"semver": {
|
|
||||||
"version": "4.3.6",
|
|
||||||
"resolved": "https://registry.npmjs.org/semver/-/semver-4.3.6.tgz",
|
|
||||||
"integrity": "sha1-MAvG4OhjdPe6YQaLWx7NV/xlMto="
|
|
||||||
},
|
|
||||||
"sigmund": {
|
|
||||||
"version": "1.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz",
|
|
||||||
"integrity": "sha1-P/IfGYytIXX587eBhT/ZTQ0ZtZA="
|
|
||||||
},
|
|
||||||
"underscore": {
|
|
||||||
"version": "1.7.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/underscore/-/underscore-1.7.0.tgz",
|
|
||||||
"integrity": "sha1-a7rwh3UA02vjTsqlhODbn+8DUgk="
|
|
||||||
},
|
|
||||||
"underscore.string": {
|
|
||||||
"version": "2.2.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-2.2.1.tgz",
|
|
||||||
"integrity": "sha1-18D6KvXVoaZ/QlPa7pgTLnM/Dxk="
|
|
||||||
},
|
|
||||||
"which": {
|
|
||||||
"version": "1.0.9",
|
|
||||||
"resolved": "https://registry.npmjs.org/which/-/which-1.0.9.tgz",
|
|
||||||
"integrity": "sha1-RgwdoPgQED0DIam2M6+eV15kSG8="
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -4,12 +4,13 @@ import websocket
|
|||||||
import json
|
import json
|
||||||
import yaml
|
import yaml
|
||||||
import random
|
import random
|
||||||
|
import threading
|
||||||
|
|
||||||
__version__ = "2.0.0b1"
|
__version__ = "2.0.0b2"
|
||||||
versionstring='Taurix TellMe server v' + __version__
|
versionstring='Taurix TellMe server v' + __version__
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
# socketio = SocketIO(app, async_mode='gevent')
|
lock = threading.Lock()
|
||||||
|
|
||||||
hooks = {}
|
hooks = {}
|
||||||
with open(r'/etc/tellme/hooks.yml') as hooksfile:
|
with open(r'/etc/tellme/hooks.yml') as hooksfile:
|
||||||
@ -17,25 +18,25 @@ with open(r'/etc/tellme/hooks.yml') as hooksfile:
|
|||||||
|
|
||||||
def sendmessage(target, message):
|
def sendmessage(target, message):
|
||||||
print("Sendmessage %s called to %s" % (message, target))
|
print("Sendmessage %s called to %s" % (message, target))
|
||||||
#message = "#Bottest Hello, world!"
|
with lock:
|
||||||
msg = ("%s %s" % (target, message))
|
msg = ("%s %s" % (target, message))
|
||||||
|
|
||||||
# Create a unique correlation ID
|
# Create a unique correlation ID
|
||||||
command = {
|
command = {
|
||||||
"corrId": f"id{random.randint(0, 999999)}",
|
"corrId": f"id{random.randint(0, 999999)}",
|
||||||
"cmd": msg,
|
"cmd": msg,
|
||||||
}
|
}
|
||||||
json_command = json.dumps(command)
|
json_command = json.dumps(command)
|
||||||
|
|
||||||
""" Connects to WebSocket server, sends a message, and returns the response """
|
""" Connects to WebSocket server, sends a message, and returns the response """
|
||||||
uri = "ws://localhost:5080"
|
uri = "ws://localhost:5080"
|
||||||
ws = websocket.create_connection(uri) # Blocking WebSocket connection
|
ws = websocket.create_connection(uri) # Blocking WebSocket connection
|
||||||
ws.send(json_command) # Send message to WebSocket
|
ws.send(json_command) # Send message to WebSocket
|
||||||
response = ws.recv() # Receive response
|
response = ws.recv() # Receive response
|
||||||
# ws.close() # Close WebSocket connection
|
# ws.close() # Close WebSocket connection
|
||||||
# print(response)
|
# print(response)
|
||||||
ws.close()
|
ws.close()
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@app.route("/webhook/<id>", methods=['POST'])
|
@app.route("/webhook/<id>", methods=['POST'])
|
||||||
def webhook_receiver(id):
|
def webhook_receiver(id):
|
||||||
|
Loading…
Reference in New Issue
Block a user