From 07a099b92d103e09a082c5a7887dfd62acb5fb8b Mon Sep 17 00:00:00 2001 From: kaliko Date: Wed, 13 May 2020 15:49:15 +0200 Subject: [PATCH] Do not answer messages from unseen The bot only answers to contact it received presence from and to groupchat messages. --- sid/sid.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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: -- 2.39.2