This commit is contained in:
deathbybandaid 2019-09-19 15:31:15 -04:00
parent c9347b7f54
commit a9cacbd33c
2 changed files with 32 additions and 27 deletions

View File

@ -575,13 +575,44 @@ def trigger_hyphen_arg_handler(bot, trigger, botcom):
directionword = "remove"
if not botcom.dict["dict"][botcom.dict["responsekey"]]["updates_enabled"]:
botmessagelog.messagelog_error(botcom.dict["log_id"], "The " + str(botcom.dict["realcom"]) + " " + str(botcom.dict["responsekey"] or '') + " entry list cannot be updated.")
return False, botcom
return False, botcom
fulltext = spicemanip(botcom.dict['args'], 0)
if not fulltext:
botmessagelog.messagelog_error(botcom.dict["log_id"], "What would you like to " + directionword + " from the " + str(botcom.dict["realcom"]) + " " + str(botcom.dict["responsekey"] or '') + " entry list?")
return False, botcom
if botcom.dict["hyphen_arg"] in ['add']:
if fulltext in botcom.dict["dict"][botcom.dict["responsekey"]]["responses"]:
botmessagelog.messagelog_error(botcom.dict["log_id"], "The following was already in the " + str(botcom.dict["realcom"]) + " " + str(botcom.dict["responsekey"] or '') + " entry list: '" + str(fulltext) + "'")
return False, botcom
botcom.dict["dict"][botcom.dict["responsekey"]]["responses"].append(fulltext)
if botcom.dict["dict"][botcom.dict["responsekey"]]["updates_enabled"] == "shared":
botdb.set_nick_value(str(bot.nick), botcom.dict["dict"]["validcoms"][0] + "_" + str(botcom.dict["responsekey"]), botcom.dict["dict"][botcom.dict["responsekey"]]["responses"])
elif botcom.dict["dict"][botcom.dict["responsekey"]]["updates_enabled"] == "user":
botdb.set_nick_value(str(trigger.nick), botcom.dict["dict"]["validcoms"][0] + "_" + str(botcom.dict["responsekey"]), botcom.dict["dict"][botcom.dict["responsekey"]]["responses"])
botmessagelog.messagelog(botcom.dict["log_id"], "The following was added to the " + str(botcom.dict["realcom"]) + " " + str(botcom.dict["responsekey"] or '') + " entry list: '" + str(fulltext) + "'")
return False, botcom
elif botcom.dict["hyphen_arg"] in ['del', 'remove']:
if fulltext not in botcom.dict["dict"][botcom.dict["responsekey"]]["responses"]:
botmessagelog.messagelog_error(botcom.dict["log_id"], "The following was already not in the " + str(botcom.dict["realcom"]) + " " + str(botcom.dict["responsekey"] or '') + " entry list: '" + str(fulltext) + "'")
return False, botcom
botcom.dict["dict"][botcom.dict["responsekey"]]["responses"].remove(fulltext)
if botcom.dict["dict"][botcom.dict["responsekey"]]["updates_enabled"] == "shared":
botdb.set_nick_value(str(bot.nick), botcom.dict["dict"]["validcoms"][0] + "_" + str(botcom.dict["responsekey"]), botcom.dict["dict"][botcom.dict["responsekey"]]["responses"])
elif botcom.dict["dict"][botcom.dict["responsekey"]]["updates_enabled"] == "user":
botdb.set_nick_value(str(trigger.nick), botcom.dict["dict"]["validcoms"][0] + "_" + str(botcom.dict["responsekey"]), botcom.dict["dict"][botcom.dict["responsekey"]]["responses"])
botmessagelog.messagelog(botcom.dict["log_id"], "The following was removed from the " + str(botcom.dict["realcom"]) + " " + str(botcom.dict["responsekey"] or '') + " entry list: '" + str(fulltext) + "'")
return False, botcom
return False, botcom
elif botcom.dict["hyphen_arg"] in [
'enable', 'disable',
'block', 'unblock',

View File

@ -36,32 +36,6 @@ def bot_dictcom_process(bot, trigger, botcom):
if str(botcom.dict["hyphen_arg"]).lower() in ['add', 'del', 'remove']:
botcom.dict["specified"] = botcom.dict["hyphen_arg"]
fulltext = spicemanip(botcom.dict['args'], 0)
if botcom.dict["specified"] == 'add':
if fulltext in botcom.dict["dict"][botcom.dict["responsekey"]]["responses"]:
return bot.osd("The following was already in the " + str(botcom.dict["realcom"]) + " " + str(botcom.dict["responsekey"] or '') + " entry list: '" + str(fulltext) + "'")
if botcom.dict["dict"][botcom.dict["responsekey"]]["updates_enabled"] == "shared":
SpiceBot.dictcoms.adjust_nick_array(str(bot.nick), 'sayings', botcom.dict["realcom"] + "_" + str(botcom.dict["responsekey"]), fulltext, botcom.dict["specified"])
elif botcom.dict["dict"][botcom.dict["responsekey"]]["updates_enabled"] == "user":
SpiceBot.dictcoms.adjust_nick_array(str(trigger.nick), 'sayings', botcom.dict["realcom"] + "_" + str(botcom.dict["responsekey"]), fulltext, botcom.dict["specified"])
return bot.osd("The following was added to the " + str(botcom.dict["realcom"]) + " " + str(botcom.dict["responsekey"] or '') + " entry list: '" + str(fulltext) + "'")
elif botcom.dict["specified"] in ['del', 'remove']:
if fulltext not in botcom.dict["dict"][botcom.dict["responsekey"]]["responses"]:
return bot.osd("The following was already not in the " + str(botcom.dict["realcom"]) + " " + str(botcom.dict["responsekey"] or '') + " entry list: '" + str(fulltext) + "'")
if botcom.dict["dict"][botcom.dict["responsekey"]]["updates_enabled"] == "shared":
SpiceBot.dictcoms.adjust_nick_array(str(bot.nick), 'sayings', botcom.dict["realcom"] + "_" + str(botcom.dict["responsekey"]), fulltext, botcom.dict["specified"])
elif botcom.dict["dict"][botcom.dict["responsekey"]]["updates_enabled"] == "user":
SpiceBot.dictcoms.adjust_nick_array(str(trigger.nick), 'sayings', botcom.dict["realcom"] + "_" + str(botcom.dict["responsekey"]), fulltext, botcom.dict["specified"])
return bot.osd("The following was removed from the " + str(botcom.dict["realcom"]) + " " + str(botcom.dict["responsekey"] or '') + " entry list: '" + str(fulltext) + "'")
botcom.dict["target"] = False
botcom.dict["success"] = True