try it this way

This commit is contained in:
deathbybandaid 2019-09-18 13:30:06 -04:00
parent 1f968d1c7b
commit 5e53e650f3
2 changed files with 29 additions and 8 deletions

View File

@ -285,12 +285,22 @@ def trigger_runstatus_query(bot, trigger, botcom):
botmessagelog.messagelog_error(botcom.dict["log_id"], "The admin switch (-a) is for use by authorized nicks ONLY.")
return False
# Stop here if not registered
# Stop here if not registered or not identified
if bot.config.SpiceBot_regnick.regnick:
# not registered
if str(trigger.nick).lower() not in [x.lower() for x in botusers.dict["registered"]]:
message = "The query command requires you to be registerd with IRC services. Registering may take a few minutes to process with the bot."
message = "The " + str(botcom.dict["comtext"]) + " command requires you to be registered with IRC services. Registering may take a few minutes to process with the bot."
return trigger_cant_run(bot, trigger, botcom, message)
# registered nick, but not identified
else:
message = "None"
# if str(trigger.nick).lower() not in [x.lower() for x in botusers.dict["identified"]]:
# message = "Your nickname appears to be registered with IRC services. However, you have not identified. Identifying may take a few minutes to process with the bot."
# return trigger_cant_run(bot, trigger, botcom, message)
# TODO
# don't run commands that are disabled in channels
if not trigger.is_privmsg:
channel_disabled_list = botcommands.get_commands_disabled(str(trigger.sender))
@ -342,12 +352,22 @@ def trigger_runstatus(bot, trigger, botcom):
botmessagelog.messagelog_error(botcom.dict["log_id"], "The admin switch (-a) is for use by authorized nicks ONLY.")
return False
# Stop here if not registered
# Stop here if not registered or not identified
if bot.config.SpiceBot_regnick.regnick:
# not registered
if str(trigger.nick).lower() not in [x.lower() for x in botusers.dict["registered"]]:
message = "The " + str(botcom.dict["comtext"]) + " command requires you to be registerd with IRC services. Registering may take a few minutes to process with the bot."
message = "The " + str(botcom.dict["comtext"]) + " command requires you to be registered with IRC services. Registering may take a few minutes to process with the bot."
return trigger_cant_run(bot, trigger, botcom, message)
# registered nick, but not identified
else:
message = "None"
# if str(trigger.nick).lower() not in [x.lower() for x in botusers.dict["identified"]]:
# message = "Your nickname appears to be registered with IRC services. However, you have not identified. Identifying may take a few minutes to process with the bot."
# return trigger_cant_run(bot, trigger, botcom, message)
# TODO
# if botcom.dict["hyphen_arg"]:
# return False

View File

@ -30,7 +30,8 @@ class BotUsers():
"away": [],
"current": {},
"registered": botdb.get_bot_value('regged_users') or [],
"notregistered": {},
"register_check": {},
"identified": [],
}
"""during setup, all users from database are offline until marked online"""
for user_id in list(self.dict["all"].keys()):
@ -357,14 +358,14 @@ class BotUsers():
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.dict["register_check"][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 str(nick).lower() in [x.lower() for x in list(self.dict["register_check"].keys())]:
timestamp = self.dict["register_check"][str(nick).lower()]
if time.time() - timestamp < 240:
return
if str(nick).lower() not in [x.lower() for x in self.dict["registered"]]: