del when parting, testing values
This commit is contained in:
parent
ddea85dbee
commit
08c67feb1b
9
bot.py
9
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}...")
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user