Start of chat command handling

This commit is contained in:
2020-07-23 20:05:13 +03:00
parent ce872ffb63
commit 4f5c790dc1
2 changed files with 24 additions and 0 deletions

View File

@@ -1,5 +1,6 @@
import random
import time
import chatCommands
from flask import Flask, request
from flask_cors import CORS
@@ -12,6 +13,7 @@ cors = CORS(app)
sio = SocketIO(app, cors_allowed_origins='*')
@app.route('/')
def home():
return {'url': '/', 'body': 'test body'}
@@ -36,6 +38,10 @@ def test(user):
@sio.on('public message')
def public_message(kwargs):
kwargs['message'].strip()
if 'message' in kwargs:
if kwargs['message'][0] == '/':
chatCommands.handle_command(kwargs)
print(kwargs)
sio.emit('public message', kwargs)