From d5c0aa9e0213c09e8da40afd722d4343aaea28a7 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Sun, 23 Jun 2019 14:27:32 +0300 Subject: [PATCH] Update existing flood limits when editing config --- reactbot/bot.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/reactbot/bot.py b/reactbot/bot.py index a0f17c8..484ab38 100644 --- a/reactbot/bot.py +++ b/reactbot/bot.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . from typing import Type, Tuple, Dict +from itertools import chain import time from attr import dataclass @@ -66,6 +67,12 @@ class ReactBot(Plugin): self.config.parse_data() except ConfigError: self.log.exception("Failed to load config") + for fi in self.user_flood.items(): + fi.max = self.config["antispam.user.max"] + fi.delay = self.config["antispam.user.delay"] + for fi in self.room_flood.items(): + fi.max = self.config["antispam.room.max"] + fi.delay = self.config["antispam.room.delay"] def _make_flood_info(self, for_type: str) -> 'FloodInfo': return FloodInfo(max=self.config[f"antispam.{for_type}.max"],