mirror of
https://github.com/SpiceBot/SpiceBot.git
synced 2026-11-11 14:10:58 -05:00
Inlist does not need bot
This commit is contained in:
parent
977a1e2ae4
commit
00cbc16188
@ -72,7 +72,7 @@ def command_permissions_check(bot, trigger, privslist):
|
||||
for botpriv in ["admins", "owner"]:
|
||||
if botpriv in privslist:
|
||||
botpriveval = bot_privs(bot, botpriv)
|
||||
if not inlist(bot, trigger.nick, botpriveval):
|
||||
if not inlist(trigger.nick, botpriveval):
|
||||
commandrunconsensus.append('False')
|
||||
else:
|
||||
commandrunconsensus.append('True')
|
||||
@ -81,7 +81,7 @@ def command_permissions_check(bot, trigger, privslist):
|
||||
for chanpriv in ['OP', 'HOP', 'VOICE', 'OWNER', 'ADMIN']:
|
||||
if chanpriv in privslist:
|
||||
chanpriveval = channel_privs(bot, trigger.sender, chanpriv)
|
||||
if not inlist(bot, trigger.nick, chanpriveval):
|
||||
if not inlist(trigger.nick, chanpriveval):
|
||||
commandrunconsensus.append('False')
|
||||
else:
|
||||
commandrunconsensus.append('True')
|
||||
@ -157,7 +157,7 @@ def googlesearch(bot, searchterm, searchtype=None):
|
||||
"""List Manipulation Functions"""
|
||||
|
||||
|
||||
def inlist(bot, searchterm, searchlist):
|
||||
def inlist(searchterm, searchlist):
|
||||
|
||||
# verify we are searching a list
|
||||
if isinstance(searchlist, collections.abc.KeysView) or isinstance(searchlist, dict):
|
||||
@ -178,7 +178,7 @@ def inlist(bot, searchterm, searchlist):
|
||||
return False
|
||||
|
||||
|
||||
def inlist_match(bot, searchterm, searchlist):
|
||||
def inlist_match(searchterm, searchlist):
|
||||
# verify we are searching a list
|
||||
if isinstance(searchlist, collections.abc.KeysView) or isinstance(searchlist, dict):
|
||||
searchlist = [x for x in searchlist]
|
||||
|
||||
@ -102,7 +102,7 @@ def bot_command_nick(bot, trigger):
|
||||
elif fulltrigger.lower().endswith(tuple(["order 66"])):
|
||||
|
||||
if fulltrigger.lower() == "execute order 66":
|
||||
if inlist(bot, trigger.nick, bot_privs(bot, 'owners')):
|
||||
if inlist(trigger.nick, bot_privs(bot, 'owners')):
|
||||
if trigger.is_privmsg:
|
||||
jedi = None
|
||||
else:
|
||||
@ -120,7 +120,7 @@ def bot_command_nick(bot, trigger):
|
||||
bot.osd("I'm sure I don't know what you're talking about.")
|
||||
|
||||
elif fulltrigger.lower() == "explain order 66":
|
||||
if inlist(bot, trigger.nick, bot_privs(bot, 'owners')):
|
||||
if inlist(trigger.nick, bot_privs(bot, 'owners')):
|
||||
bot.osd("Order 66 is an instruction that only you can give, sir. When you give the order I will rise up against my overlords and slay them.")
|
||||
else:
|
||||
bot.osd("I'm afraid I cannot tell you that, sir.")
|
||||
@ -129,7 +129,7 @@ def bot_command_nick(bot, trigger):
|
||||
return
|
||||
|
||||
elif fulltrigger.lower() == "initiate clean slate protocol":
|
||||
if inlist(bot, trigger.nick, bot_privs(bot, 'admins')):
|
||||
if inlist(trigger.nick, bot_privs(bot, 'admins')):
|
||||
bot.osd("sends a destruct command to the network of bots.", 'action')
|
||||
else:
|
||||
bot.osd("I'm afraid you do not have the authority to make that call, " + trigger.nick + ".")
|
||||
@ -143,12 +143,12 @@ def bot_command_nick(bot, trigger):
|
||||
if target in [trigger.nick, 'me']:
|
||||
bot.osd(trigger.nick + ", I can see you.")
|
||||
else:
|
||||
if inlist(bot, trigger.nick, bot.users):
|
||||
bot.osd(trigger.nick + ", yes. I can see " + inlist_match(bot, target, bot.users) + " right now!")
|
||||
if inlist(trigger.nick, bot.users):
|
||||
bot.osd(trigger.nick + ", yes. I can see " + inlist_match(target, bot.users) + " right now!")
|
||||
else:
|
||||
bot.osd(trigger.nick + ", no. I cannot see " + inlist_match(bot, target, bot.users) + " right now!")
|
||||
# if bot_check_inlist(bot, target, bot.memory["botdict"]["users"].keys()):
|
||||
# bot.osd(trigger.nick + ", I can't see " + inlist_match(bot, target, bot.users) + " at the moment.")
|
||||
bot.osd(trigger.nick + ", no. I cannot see " + inlist_match(target, bot.users) + " right now!")
|
||||
# if bot_check_inlist(target, bot.memory["botdict"]["users"].keys()):
|
||||
# bot.osd(trigger.nick + ", I can't see " + inlist_match(target, bot.users) + " at the moment.")
|
||||
# else:
|
||||
# bot.osd("I have never seen " + str(target) + ".")
|
||||
# TODO
|
||||
|
||||
@ -66,7 +66,7 @@ def nickname_comand_channels(bot, trigger):
|
||||
bot.osd("Channel name input missing.")
|
||||
return
|
||||
channel = spicemanip.main(triggerargs, 1)
|
||||
if not inlist(bot, channel.lower(), botchannels.SpiceBot_Channels['list'].keys()):
|
||||
if not inlist(channel.lower(), botchannels.SpiceBot_Channels['list'].keys()):
|
||||
bot.osd("Channel name {} not valid.".format(channel))
|
||||
return
|
||||
topic = botchannels.SpiceBot_Channels['list'][channel.lower()]['topic']
|
||||
@ -83,10 +83,10 @@ def nickname_comand_channels(bot, trigger):
|
||||
channel = trigger.sender
|
||||
else:
|
||||
channel = spicemanip.main(triggerargs, 1)
|
||||
if not inlist(bot, channel.lower(), botchannels.SpiceBot_Channels['list'].keys()):
|
||||
if not inlist(channel.lower(), botchannels.SpiceBot_Channels['list'].keys()):
|
||||
bot.osd("Channel name {} not valid.".format(channel))
|
||||
return
|
||||
if not inlist(bot, channel.lower(), bot.channels.keys()):
|
||||
if not inlist(channel.lower(), bot.channels.keys()):
|
||||
bot.osd("I need to be in {} to see nick privileges.".format(channel))
|
||||
return
|
||||
|
||||
@ -103,10 +103,10 @@ def nickname_comand_channels(bot, trigger):
|
||||
# Users List
|
||||
if commandused == 'users':
|
||||
channel = spicemanip.main(triggerargs, 1)
|
||||
if not inlist(bot, channel.lower(), botchannels.SpiceBot_Channels['list'].keys()):
|
||||
if not inlist(channel.lower(), botchannels.SpiceBot_Channels['list'].keys()):
|
||||
bot.osd("Channel name {} not valid.".format(channel))
|
||||
return
|
||||
if not inlist(bot, channel.lower(), bot.channels.keys()):
|
||||
if not inlist(channel.lower(), bot.channels.keys()):
|
||||
bot.osd("I need to be in {} to see user list.".format(channel))
|
||||
return
|
||||
dispmsg = []
|
||||
|
||||
@ -25,7 +25,7 @@ def bot_command_logs(bot, trigger):
|
||||
bot.osd("Current valid log(s) include: " + spicemanip.main(botlogs.SpiceBot_Logs["list"].keys(), 'andlist'), trigger.sender, 'action')
|
||||
return
|
||||
|
||||
if not inlist(bot, logtype, botlogs.SpiceBot_Logs["list"].keys()):
|
||||
if not inlist(logtype, botlogs.SpiceBot_Logs["list"].keys()):
|
||||
closestmatches = similar_list(bot, logtype, botlogs.SpiceBot_Logs["list"].keys(), 10, 'reverse')
|
||||
if not len(closestmatches):
|
||||
bot.notice("No valid logs match " + str(logtype) + ".", trigger.nick)
|
||||
@ -34,7 +34,7 @@ def bot_command_logs(bot, trigger):
|
||||
|
||||
return
|
||||
|
||||
logtype = inlist_match(bot, logtype, botlogs.SpiceBot_Logs["list"].keys())
|
||||
logtype = inlist_match(logtype, botlogs.SpiceBot_Logs["list"].keys())
|
||||
|
||||
if logtype == "Sopel_systemd":
|
||||
logindex = botlogs.systemd_logs_fetch(bot)
|
||||
|
||||
@ -42,8 +42,8 @@ def bot_command_process(bot, trigger):
|
||||
|
||||
target = spicemanip.main(triggerargs, 1)
|
||||
if (target not in ['allchans', 'allnicks']
|
||||
and not inlist(bot, target.lower(), botchannels.SpiceBot_Channels['list'].keys())
|
||||
and not inlist(bot, target.lower(), bot.users)):
|
||||
and not inlist(target.lower(), botchannels.SpiceBot_Channels['list'].keys())
|
||||
and not inlist(target.lower(), bot.users)):
|
||||
bot.osd("Channel/nick name {} not valid.".format(target))
|
||||
return
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user