From 08c67feb1b56a5cdadbe48052fc40c699b1356e6 Mon Sep 17 00:00:00 2001 From: = <=> Date: Fri, 4 Apr 2025 03:42:17 +0000 Subject: [PATCH] del when parting, testing values --- bot.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/bot.py b/bot.py index 15151cb..c33e9f6 100644 --- a/bot.py +++ b/bot.py @@ -6,8 +6,9 @@ import re channel_re = re.compile(r"PRIVMSG (#*\w+)") name_re = re.compile(r"^:([^!]*)!") -timeout = 86400 # 24 hours -messages_within_24h = 100 +# timeout = 86400 # 24 hours +timeout = 30 +messages_within_timeout = 5 host = "localhost" port = 6667 helptext = "i am a bot by ~nebula. i try to make it easier for users to discover new and more obscure channels on irc. instructions for use (or to block me from showing messages in your client) are available at https://git.tilde.town/nebula/chatterbot" @@ -50,6 +51,8 @@ class IRCBot(): return self.sendline(f"PART {channel}") self.config["channels"].remove(channel) + del self.config["times"][channel] + del self.config["counts"][channel] self.write_config() def sendline(self, line): @@ -160,7 +163,7 @@ class IRCBot(): continue channel_time = self.check_time(channel) now = time() - if self.counter(channel) > messages_within_24h and now - channel_time > timeout: + if self.counter(channel) > messages_within_timeout and now - channel_time > timeout: # self.send("#tildetown", f"i hear activity in {channel}...") self.send("#bots", f"i hear activity in {channel}...")