This commit is contained in:
deathbybandaid 2019-09-17 19:00:45 -04:00
parent 017cc48d95
commit 7a678788db
2 changed files with 12 additions and 4 deletions

View File

@ -36,7 +36,7 @@ def prerun(t_command_type='module', t_command_subtype=None):
# Verify channel and user exist # Verify channel and user exist
verify_channel(trigger) verify_channel(trigger)
verify_user(trigger) verify_user(bot, trigger)
botcom = class_create('botcom') botcom = class_create('botcom')
@ -130,7 +130,7 @@ def prerun_query(t_command_type='module', t_command_subtype=None):
# Verify channel and user exist # Verify channel and user exist
verify_channel(trigger) verify_channel(trigger)
verify_user(trigger) verify_user(bot, trigger)
botcom = class_create('botcom') botcom = class_create('botcom')
@ -189,9 +189,11 @@ def prerun_query(t_command_type='module', t_command_subtype=None):
return actual_decorator return actual_decorator
def verify_user(trigger): def verify_user(bot, trigger):
# Identify # Identify
nick_id = botusers.whois_ident(trigger.nick) nick_id = botusers.whois_ident(trigger.nick)
# check if nick is registered
botusers.whois_send(bot, trigger.nick)
# Verify nick is in the all list # Verify nick is in the all list
botusers.add_to_all(trigger.nick, nick_id) botusers.add_to_all(trigger.nick, nick_id)
# Verify nick is in the all list # Verify nick is in the all list

View File

@ -28,7 +28,7 @@ class BotUsers():
"offline": [], "offline": [],
"away": [], "away": [],
"current": {}, "current": {},
"registered": [], "registered": botdb.get_bot_value('regged_users') or [],
} }
"""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()):
@ -73,6 +73,7 @@ class BotUsers():
def save_user_db(self): def save_user_db(self):
botdb.set_bot_value('users', self.dict["all"]) botdb.set_bot_value('users', self.dict["all"])
botdb.set_bot_value('regged_users', self.dict["registered"])
def add_to_all(self, nick, nick_id=None): def add_to_all(self, nick, nick_id=None):
self.lock.acquire() self.lock.acquire()
@ -102,6 +103,8 @@ class BotUsers():
for user in list(bot.channels[channel].privileges.keys()): for user in list(bot.channels[channel].privileges.keys()):
# Identify # Identify
nick_id = self.whois_ident(user) nick_id = self.whois_ident(user)
# check if nick is registered
self.whois_send(bot, user)
# Verify nick is in the all list # Verify nick is in the all list
self.add_to_all(user, nick_id) self.add_to_all(user, nick_id)
# Verify nick is in the all list # Verify nick is in the all list
@ -151,6 +154,8 @@ class BotUsers():
for user in list(bot.channels[trigger.sender].privileges.keys()): for user in list(bot.channels[trigger.sender].privileges.keys()):
# Identify # Identify
nick_id = self.whois_ident(user) nick_id = self.whois_ident(user)
# check if nick is registered
self.whois_send(bot, user)
# Verify nick is in the all list # Verify nick is in the all list
self.add_to_all(user, nick_id) self.add_to_all(user, nick_id)
# Verify nick is in the all list # Verify nick is in the all list
@ -338,6 +343,7 @@ class BotUsers():
self.whois_send(bot, nick) self.whois_send(bot, nick)
def rpl_whois(self, bot, trigger): def rpl_whois(self, bot, trigger):
bot.say(str(trigger.args[1]), "#deathbybandaid")
if not bot.config.SpiceBot_regnick.regnick: if not bot.config.SpiceBot_regnick.regnick:
return return
nick = trigger.args[1] nick = trigger.args[1]