.BANCHO. Add logHelper
This commit is contained in:
@@ -6,7 +6,7 @@ from objects import glob
|
||||
from objects import fokabot
|
||||
from constants import exceptions
|
||||
from constants import messageTemplates
|
||||
from time import gmtime, strftime
|
||||
from helpers import generalFunctions
|
||||
|
||||
def handle(userToken, packetData):
|
||||
"""
|
||||
@@ -51,7 +51,7 @@ def handle(userToken, packetData):
|
||||
|
||||
# Log to file
|
||||
with open(".data/chatlog_private.txt", "a") as f:
|
||||
f.write("[{date}] {fro} -> {to}: {message}\n".format(date=strftime("%Y-%m-%d %H:%M:%S", gmtime()), fro=username, to=packetData["to"], message=str(packetData["message"].encode("utf-8"))[2:-1]))
|
||||
f.write("[{date}] {fro} -> {to}: {message}\n".format(date=generalFunctions.getTimestamp(), fro=username, to=packetData["to"], message=str(packetData["message"].encode("utf-8"))[2:-1]))
|
||||
except exceptions.tokenNotFoundException:
|
||||
# Token not found, user disconnected
|
||||
consoleHelper.printColored("[!] {} tried to send a message to {}, but their token couldn't be found".format(username, packetData["to"]), bcolors.RED)
|
||||
|
Reference in New Issue
Block a user