Keep track of a user's away message, not just whether they're away or not

This commit is contained in:
jesopo 2019-02-22 22:26:50 +00:00
parent 8a0fd009e4
commit 9d72cbca73
2 changed files with 4 additions and 0 deletions

View file

@ -51,10 +51,12 @@ def away(events, event):
message = event["args"].get(0) message = event["args"].get(0)
if message: if message:
user.away = True user.away = True
user.away_message = message
events.on("received.away.on").call(user=user, server=event["server"], events.on("received.away.on").call(user=user, server=event["server"],
message=message) message=message)
else: else:
user.away = False user.away = False
user.away_message = None
events.on("received.away.off").call(user=user, server=event["server"]) events.on("received.away.off").call(user=user, server=event["server"])
def chghost(event): def chghost(event):

View file

@ -23,6 +23,8 @@ class User(IRCObject.Object):
self.identified_account_id = None self.identified_account_id = None
self.identified_account_id_override = None self.identified_account_id_override = None
self.away = False self.away = False
self.away_message = None # type: typing.Optional[str]
self.buffer = IRCBuffer.Buffer(bot, server) self.buffer = IRCBuffer.Buffer(bot, server)
def __repr__(self) -> str: def __repr__(self) -> str: