From e3d806337397142bb2820ff5511eb50f0f7f4e11 Mon Sep 17 00:00:00 2001 From: jesopo Date: Wed, 22 May 2019 14:23:38 +0100 Subject: [PATCH] Check if a PRIVMSG/NOTICE is send *from* us before we check if it's sent *to* us - so `user` isn't null when bitbot messages himself. --- modules/line_handler/message.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/modules/line_handler/message.py b/modules/line_handler/message.py index 2f86ac40..4fb507ca 100644 --- a/modules/line_handler/message.py +++ b/modules/line_handler/message.py @@ -68,16 +68,16 @@ def privmsg(events, event): hook.call(user=user, channel=channel, **kwargs) channel.buffer.add_message(user_nickname, message, action, event["tags"], user==None) - elif event["server"].is_own_nickname(target): - hook.call(user=user, **kwargs) - user.buffer.add_message(user_nickname, message, action, - event["tags"], False) elif from_self: # a message we've sent to a user user = event["server"].get_user(target) hook.call(user=user, **kwargs) user.buffer.add_message(user_nickname, message, action, event["tags"], True) + elif event["server"].is_own_nickname(target): + hook.call(user=user, **kwargs) + user.buffer.add_message(user_nickname, message, action, + event["tags"], False) def notice(events, event): from_self = _from_self(event["server"], event["direction"], @@ -122,16 +122,16 @@ def notice(events, event): hook.call(user=user, channel=channel, **kwargs) channel.buffer.add_notice(user_nickname, message, event["tags"], user==None) - elif event["server"].is_own_nickname(target): - hook.call(user=user, **kwargs) - user.buffer.add_notice(user_nickname, message, event["tags"], - False) elif from_self: # a notice we've sent to a user user = event["server"].get_user(target) hook.call(user=user, **kwargs) user.buffer.add_notice(user_nickname, message, event["tags"], True) + elif event["server"].is_own_nickname(target): + hook.call(user=user, **kwargs) + user.buffer.add_notice(user_nickname, message, event["tags"], + False) def tagmsg(events, event): from_self = _from_self(event["server"], event["direction"],