.BANCHO. .FIX. Fix /away command, add support for /away command on IRC

This commit is contained in:
Nyo
2016-11-13 12:23:45 +01:00
parent 3b150d70cd
commit c7c5528588
3 changed files with 33 additions and 10 deletions

View File

@@ -256,6 +256,10 @@ def sendMessage(fro = "", to = "", message = "", token = None, toIRC = True):
# TODO: Make sure the recipient has not disabled PMs for non-friends or he's our friend
# Away check
if recipientToken.awayCheck(userID):
sendMessage(to, fro, "{code}ACTION is away: {message}{code}".format(code=chr(int(1)), message=recipientToken.awayMessage))
# Check message templates (mods/admins only)
if message in messageTemplates.templates and token.admin == True:
sendMessage(fro, to, messageTemplates.templates[message])
@@ -357,4 +361,12 @@ def IRCPartChannel(username, channel):
if not userID:
log.warning("{} doesn't exist".format(username))
return
return partChannel(userID, channel)
return partChannel(userID, channel)
def IRCAway(username, message):
userID = userUtils.getID(username)
if not userID:
log.warning("{} doesn't exist".format(username))
return
glob.tokens.getTokenFromUserID(userID).setAwayMessage(message)
return 305 if message == "" else 306