diff --git a/database.py b/database.py
index e06e985..f063225 100644
--- a/database.py
+++ b/database.py
@@ -98,7 +98,7 @@ def log_chat_message(data):
"""
message = data["message"]
date = data["date"]
- room_id = int(data["room"])
+ room_id = data["room"]
name = data["name"]
user_id = data.get("user_id")
_DB.execute(
diff --git a/events.py b/events.py
index 97f635f..d3df23e 100644
--- a/events.py
+++ b/events.py
@@ -29,11 +29,17 @@ def message(data):
"""
Sent by a client when the user entered a new message.
"""
- room = data["room"]
-
+ room = int(data["room"])
message = data["message"]
+ name = data["name"]
+ user_id = data.get("user_id")
+
+ data = {}
date = int(time.time())
data["date"] = date
+ data["name"] = name
+ data["user_id"] = user_id
+ data["room"] = room
message = message.strip()
if not message:
@@ -48,27 +54,26 @@ def message(data):
message = "
".join(lines)
message = tools.handle_img(message)
if message.startswith("/dice") or message.startswith("/roll"):
- roll_msg = handle_dice(data)
- message += '