From: kaliko Date: Wed, 13 May 2020 13:49:15 +0000 (+0200) Subject: Do not answer messages from unseen X-Git-Tag: 0.1.1~5 X-Git-Url: https://git.kaliko.me/?a=commitdiff_plain;h=07a099b92d103e09a082c5a7887dfd62acb5fb8b;p=sid.git Do not answer messages from unseen The bot only answers to contact it received presence from and to groupchat messages. --- diff --git a/sid/sid.py b/sid/sid.py index d412ac4..a62c7e4 100644 --- a/sid/sid.py +++ b/sid/sid.py @@ -123,9 +123,11 @@ class MUCBot(slixmpp.ClientXMPP): body = msg['body'].strip() if not body.startswith(MUCBot.prefix): return - if msg['from'] not in self.__seen: - self.log.warning('Will not handle message from unseen jid: %s', msg['from']) - #return + self.log.debug(msg['from']) + if msg['from'] not in self.__seen and msg['type'] == 'chat': + self.log.warning('Will not handle direct message' + 'from unseen jid: %s', msg['from']) + return args = body[1:].split() cmd = args.pop(0) if cmd not in self.commands: