diff --git a/sopel_modules/SpiceBot/Users.py b/sopel_modules/SpiceBot/Users.py index 545c807..0fc51ea 100644 --- a/sopel_modules/SpiceBot/Users.py +++ b/sopel_modules/SpiceBot/Users.py @@ -12,6 +12,7 @@ from sopel_modules.spicemanip import spicemanip import threading import re +import time # TODO timestamp for new .seen @@ -29,6 +30,7 @@ class BotUsers(): "away": [], "current": {}, "registered": botdb.get_bot_value('regged_users') or [], + "notregistered": {}, } """during setup, all users from database are offline until marked online""" for user_id in list(self.dict["all"].keys()): @@ -354,11 +356,17 @@ class BotUsers(): self.lock.acquire() if str(nick).lower() not in [x.lower() for x in self.dict["registered"]]: self.dict["registered"].append(str(nick)) + else: + self.dict["notregistered"][str(nick).lower()] = time.time() self.lock.release() def whois_send(self, bot, nick): if not bot.config.SpiceBot_regnick.regnick: return + if str(nick).lower() in [x.lower() for x in list(self.dict["notregistered"].keys())]: + timestamp = self.dict["notregistered"][str(nick).lower()] + if time.time() - timestamp < 240: + return if str(nick).lower() not in [x.lower() for x in self.dict["registered"]]: bot.write(['WHOIS', str(nick)])