2016-10-02 20:48:14 +00:00
|
|
|
from common.log import logUtils as log
|
2016-05-18 17:12:46 +00:00
|
|
|
from constants import clientPackets
|
|
|
|
from constants import serverPackets
|
2018-02-14 16:44:37 +00:00
|
|
|
from objects import glob
|
2016-10-02 20:48:14 +00:00
|
|
|
|
2016-04-19 17:40:59 +00:00
|
|
|
|
|
|
|
def handle(userToken, packetData):
|
|
|
|
# get token data
|
|
|
|
username = userToken.username
|
|
|
|
|
|
|
|
# Read packet data
|
|
|
|
packetData = clientPackets.setAwayMessage(packetData)
|
|
|
|
|
|
|
|
# Set token away message
|
2016-11-17 18:13:06 +00:00
|
|
|
userToken.awayMessage = packetData["awayMessage"]
|
2016-04-19 17:40:59 +00:00
|
|
|
|
|
|
|
# Send private message from fokabot
|
|
|
|
if packetData["awayMessage"] == "":
|
|
|
|
fokaMessage = "Your away message has been reset"
|
|
|
|
else:
|
|
|
|
fokaMessage = "Your away message is now: {}".format(packetData["awayMessage"])
|
2018-02-14 16:44:37 +00:00
|
|
|
userToken.enqueue(serverPackets.sendMessage(glob.BOT_NAME, username, fokaMessage))
|
2016-06-04 10:44:54 +00:00
|
|
|
log.info("{} has changed their away message to: {}".format(username, packetData["awayMessage"]))
|