mirror of
https://github.com/SpiceBot/SpiceBot.git
synced 2026-11-13 06:59:53 -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 threading
|
||||||
import re
|
import re
|
||||||
|
import time
|
||||||
|
|
||||||
# TODO timestamp for new .seen
|
# TODO timestamp for new .seen
|
||||||
|
|
||||||
@ -29,6 +30,7 @@ class BotUsers():
|
|||||||
"away": [],
|
"away": [],
|
||||||
"current": {},
|
"current": {},
|
||||||
"registered": botdb.get_bot_value('regged_users') or [],
|
"registered": botdb.get_bot_value('regged_users') or [],
|
||||||
|
"notregistered": {},
|
||||||
}
|
}
|
||||||
"""during setup, all users from database are offline until marked online"""
|
"""during setup, all users from database are offline until marked online"""
|
||||||
for user_id in list(self.dict["all"].keys()):
|
for user_id in list(self.dict["all"].keys()):
|
||||||
@ -354,11 +356,17 @@ class BotUsers():
|
|||||||
self.lock.acquire()
|
self.lock.acquire()
|
||||||
if str(nick).lower() not in [x.lower() for x in self.dict["registered"]]:
|
if str(nick).lower() not in [x.lower() for x in self.dict["registered"]]:
|
||||||
self.dict["registered"].append(str(nick))
|
self.dict["registered"].append(str(nick))
|
||||||
|
else:
|
||||||
|
self.dict["notregistered"][str(nick).lower()] = time.time()
|
||||||
self.lock.release()
|
self.lock.release()
|
||||||
|
|
||||||
def whois_send(self, bot, nick):
|
def whois_send(self, bot, nick):
|
||||||
if not bot.config.SpiceBot_regnick.regnick:
|
if not bot.config.SpiceBot_regnick.regnick:
|
||||||
return
|
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"]]:
|
if str(nick).lower() not in [x.lower() for x in self.dict["registered"]]:
|
||||||
bot.write(['WHOIS', str(nick)])
|
bot.write(['WHOIS', str(nick)])
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user