mirror of
https://github.com/SpiceBot/SpiceBot.git
synced 2026-11-10 21:50:59 -05:00
4 minute whois timeout
This commit is contained in:
parent
e5363c6c3e
commit
6ab8169d76
@ -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)])
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user