diff --git a/bob/__init__.py b/bob/__init__.py index 289c53a..868a3ff 100644 --- a/bob/__init__.py +++ b/bob/__init__.py @@ -1,3 +1,3 @@ -__version__ = "2.2.3 beta" +__version__ = "2.2.4 beta" blue_color = 0x2273E6 red_color = 0xE82E3E diff --git a/cogs/config.py b/cogs/config.py index 68ce98d..8f2d8d9 100644 --- a/cogs/config.py +++ b/cogs/config.py @@ -60,6 +60,16 @@ async def periodic_data_clean_and_save(self): while len(self.question_map.values()) > self.config["question_limit"]: self.question_map.pop(list(self.question_map.keys())[0]) removed += 1 + to_pop = [] + for question_key in self.question_map.keys(): + question = self.question_map[question_key] + if question.author in self.config["blacklist"]: + to_pop.append(question_key) + + for key in to_pop: + self.question_map.pop(key) + + removed += len(to_pop) self.logger.debug("removed %d questions, saving data...", removed) self.save_data() diff --git a/cogs/lar.py b/cogs/lar.py index 171aee0..63ac85e 100644 --- a/cogs/lar.py +++ b/cogs/lar.py @@ -24,6 +24,9 @@ async def learn(self, message: discord.Message): except discord.NotFound: return + if reply.author.id not in self.config.config["optin"]: + return + content = qna.classes.sanitize_question(reply.clean_content) + " " + \ " ".join([attachment.url for attachment in reply.attachments]) if content not in self.config.question_map.keys():