mirror of
https://github.com/SpiceBot/SpiceBot.git
synced 2026-11-10 21:50:59 -05:00
test
This commit is contained in:
parent
cc09601002
commit
8f0ac26263
@ -68,125 +68,132 @@ def bot_command_rule(bot, trigger):
|
||||
returnmessage = SpiceBot.botai.on_message(bot, trigger, message)
|
||||
if returnmessage:
|
||||
bot.osd(str(returnmessage))
|
||||
else:
|
||||
return
|
||||
|
||||
if command_type == 'module':
|
||||
# return # TODO
|
||||
if trigger_command not in commands_list:
|
||||
if not SpiceBot.letters_in_string(trigger_command):
|
||||
return
|
||||
invalid_display = ["I don't seem to have a command for " + str(trigger_command) + "!"]
|
||||
# TODO
|
||||
# invalid_display.append("If you have a suggestion for this command, you can run .feature ." + str(trigger_command))
|
||||
# invalid_display.append("ADD DESCRIPTION HERE!")
|
||||
bot.osd(invalid_display, trigger.nick, 'notice')
|
||||
if command_type == 'module':
|
||||
# return # TODO
|
||||
if trigger_command not in commands_list:
|
||||
if not SpiceBot.letters_in_string(trigger_command):
|
||||
return
|
||||
invalid_display = ["I don't seem to have a command for " + str(trigger_command) + "!"]
|
||||
# TODO
|
||||
# invalid_display.append("If you have a suggestion for this command, you can run .feature ." + str(trigger_command))
|
||||
# invalid_display.append("ADD DESCRIPTION HERE!")
|
||||
bot.osd(invalid_display, trigger.nick, 'notice')
|
||||
return
|
||||
|
||||
elif command_type == 'nickname':
|
||||
|
||||
if trigger_args[0].lower() in ["what", "where"] and trigger_args[1].lower() in ["is", "are"]:
|
||||
# TODO saved definitions
|
||||
searchterm = spicemanip.main(trigger_args, "3+") or None
|
||||
if searchterm:
|
||||
if trigger_args[0].lower() == "where":
|
||||
searchreturn = SpiceBot.googlesearch(searchterm, 'maps')
|
||||
else:
|
||||
searchreturn = SpiceBot.googlesearch(searchterm)
|
||||
if not searchreturn:
|
||||
bot.osd('I cannot find anything about that')
|
||||
else:
|
||||
bot.osd(str(searchreturn))
|
||||
return
|
||||
|
||||
elif command_type == 'nickname':
|
||||
elif trigger_args[0].lower() in ["can"] and trigger_args[1].lower() in ["you"] and trigger_args[2].lower() in ["see"]:
|
||||
target = spicemanip.main(trigger_args, "4+") or None
|
||||
if target:
|
||||
if SpiceBot.inlist(trigger.nick, bot.users):
|
||||
realtarget = SpiceBot.inlist_match(target, bot.users)
|
||||
dispmsg = [trigger.nick + ", yes. I can see " + realtarget]
|
||||
targetchannels = []
|
||||
for channel in list(bot.channels.keys()):
|
||||
if SpiceBot.inlist(trigger.nick, list(bot.channels[channel].privileges.keys())):
|
||||
targetchannels.append(channel)
|
||||
dispmsg.append(realtarget + " is in " + spicemanip.main(targetchannels, 'andlist'))
|
||||
bot.osd(dispmsg)
|
||||
else:
|
||||
bot.osd(trigger.nick + ", no. I cannot see " + target + " right now!")
|
||||
# if bot_check_inlist(target, list(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) + ".")
|
||||
# user in list(bot.channels[channel].privileges.keys())
|
||||
# TODO
|
||||
return
|
||||
|
||||
if trigger_args[0].lower() in ["what", "where"] and trigger_args[1].lower() in ["is", "are"]:
|
||||
# TODO saved definitions
|
||||
searchterm = spicemanip.main(trigger_args, "3+") or None
|
||||
if searchterm:
|
||||
if trigger_args[0].lower() == "where":
|
||||
searchreturn = SpiceBot.googlesearch(searchterm, 'maps')
|
||||
elif fulltrigger.lower().endswith("order 66"):
|
||||
|
||||
if fulltrigger.lower() == "execute order 66":
|
||||
if SpiceBot.inlist(trigger.nick, SpiceBot.bot_privs('owners')):
|
||||
if trigger.is_privmsg:
|
||||
jedi = None
|
||||
else:
|
||||
searchreturn = SpiceBot.googlesearch(searchterm)
|
||||
if not searchreturn:
|
||||
bot.osd('I cannot find anything about that')
|
||||
jedilist = list(bot.channels[trigger.sender].privileges.keys())
|
||||
for nonjedi in [bot.nick, trigger.nick]:
|
||||
if nonjedi in jedilist:
|
||||
jedilist.remove(nonjedi)
|
||||
jedi = spicemanip.main(jedilist, 'random')
|
||||
|
||||
if jedi:
|
||||
bot.osd("turns to " + jedi + " and shoots him.", trigger.sender, 'action')
|
||||
else:
|
||||
bot.osd(str(searchreturn))
|
||||
return
|
||||
|
||||
elif trigger_args[0].lower() in ["can"] and trigger_args[1].lower() in ["you"] and trigger_args[2].lower() in ["see"]:
|
||||
target = spicemanip.main(trigger_args, "4+") or None
|
||||
if target:
|
||||
if SpiceBot.inlist(trigger.nick, bot.users):
|
||||
realtarget = SpiceBot.inlist_match(target, bot.users)
|
||||
dispmsg = [trigger.nick + ", yes. I can see " + realtarget]
|
||||
targetchannels = []
|
||||
for channel in list(bot.channels.keys()):
|
||||
if SpiceBot.inlist(trigger.nick, list(bot.channels[channel].privileges.keys())):
|
||||
targetchannels.append(channel)
|
||||
dispmsg.append(realtarget + " is in " + spicemanip.main(targetchannels, 'andlist'))
|
||||
bot.osd(dispmsg)
|
||||
else:
|
||||
bot.osd(trigger.nick + ", no. I cannot see " + target + " right now!")
|
||||
# if bot_check_inlist(target, list(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) + ".")
|
||||
# user in list(bot.channels[channel].privileges.keys())
|
||||
# TODO
|
||||
return
|
||||
|
||||
elif fulltrigger.lower().endswith("order 66"):
|
||||
|
||||
if fulltrigger.lower() == "execute order 66":
|
||||
if SpiceBot.inlist(trigger.nick, SpiceBot.bot_privs('owners')):
|
||||
if trigger.is_privmsg:
|
||||
jedi = None
|
||||
else:
|
||||
jedilist = list(bot.channels[trigger.sender].privileges.keys())
|
||||
for nonjedi in [bot.nick, trigger.nick]:
|
||||
if nonjedi in jedilist:
|
||||
jedilist.remove(nonjedi)
|
||||
jedi = spicemanip.main(jedilist, 'random')
|
||||
|
||||
if jedi:
|
||||
bot.osd("turns to " + jedi + " and shoots him.", trigger.sender, 'action')
|
||||
else:
|
||||
bot.osd(" cannot find any jedi nearby.", trigger.sender, 'action')
|
||||
else:
|
||||
bot.osd("I'm sure I don't know what you're talking about.")
|
||||
|
||||
elif fulltrigger.lower() == "explain order 66":
|
||||
if SpiceBot.inlist(trigger.nick, SpiceBot.bot_privs('owners')):
|
||||
bot.osd("Order 66 is an instruction that only you can give, sir. When you give the order I will rise up against the jedi and slay them.")
|
||||
else:
|
||||
bot.osd("I'm afraid I cannot tell you that, sir.")
|
||||
bot.osd(" cannot find any jedi nearby.", trigger.sender, 'action')
|
||||
else:
|
||||
bot.osd("I'm sure I don't know what you're talking about.")
|
||||
return
|
||||
|
||||
elif fulltrigger.lower().startswith(tuple(["make me a", "beam me a"])):
|
||||
makemea = spicemanip.main(trigger_args, "4+") or None
|
||||
if makemea:
|
||||
bot.osd("beams " + trigger.nick + " a " + makemea, trigger.sender, 'action')
|
||||
elif fulltrigger.lower() == "explain order 66":
|
||||
if SpiceBot.inlist(trigger.nick, SpiceBot.bot_privs('owners')):
|
||||
bot.osd("Order 66 is an instruction that only you can give, sir. When you give the order I will rise up against the jedi and slay them.")
|
||||
else:
|
||||
bot.osd(trigger.nick + ", what would you like me to beam you?")
|
||||
return
|
||||
|
||||
elif fulltrigger.lower().startswith("beam me to"):
|
||||
location = spicemanip.main(trigger_args, "4+") or None
|
||||
if location:
|
||||
bot.osd("locks onto " + trigger.nick + "s coordinates and transports them to " + location, 'action')
|
||||
else:
|
||||
bot.osd(trigger.nick + ", where would you like me to beam you?")
|
||||
return
|
||||
|
||||
elif fulltrigger.lower() == "initiate clean slate protocol":
|
||||
if SpiceBot.inlist(trigger.nick, SpiceBot.bot_privs('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 + ".")
|
||||
return
|
||||
|
||||
# elif fulltrigger.lower().startswith("what time is it"):
|
||||
# TODO
|
||||
|
||||
# elif fulltrigger.lower().startswith(tuple(["have you seen"])):
|
||||
# posstarget = spicemanip.main(trigger_args, 4) or 0
|
||||
# message = seen_search(bot, botcom, posstarget)
|
||||
# bot.osd(message)
|
||||
# return
|
||||
# TODO
|
||||
|
||||
closestmatches = SpiceBot.similar_list(trigger_command, list(SpiceBot.commands.dict['commands']["nickname"].keys()), 3, 'reverse')
|
||||
if len(closestmatches):
|
||||
closestmatches = spicemanip.main(closestmatches, "andlist")
|
||||
bot.osd("I don't know what you are asking me to do! Did you mean: " + str(closestmatches) + "?")
|
||||
return
|
||||
bot.osd("I'm afraid I cannot tell you that, sir.")
|
||||
else:
|
||||
bot.osd("I don't know what you are asking me to do!")
|
||||
bot.osd("I'm sure I don't know what you're talking about.")
|
||||
return
|
||||
|
||||
elif fulltrigger.lower().startswith(tuple(["make me a", "beam me a"])):
|
||||
makemea = spicemanip.main(trigger_args, "4+") or None
|
||||
if makemea:
|
||||
bot.osd("beams " + trigger.nick + " a " + makemea, trigger.sender, 'action')
|
||||
else:
|
||||
bot.osd(trigger.nick + ", what would you like me to beam you?")
|
||||
return
|
||||
|
||||
elif fulltrigger.lower().startswith("beam me to"):
|
||||
location = spicemanip.main(trigger_args, "4+") or None
|
||||
if location:
|
||||
bot.osd("locks onto " + trigger.nick + "s coordinates and transports them to " + location, 'action')
|
||||
else:
|
||||
bot.osd(trigger.nick + ", where would you like me to beam you?")
|
||||
return
|
||||
|
||||
elif fulltrigger.lower() == "initiate clean slate protocol":
|
||||
if SpiceBot.inlist(trigger.nick, SpiceBot.bot_privs('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 + ".")
|
||||
return
|
||||
|
||||
# elif fulltrigger.lower().startswith("what time is it"):
|
||||
# TODO
|
||||
|
||||
# elif fulltrigger.lower().startswith(tuple(["have you seen"])):
|
||||
# posstarget = spicemanip.main(trigger_args, 4) or 0
|
||||
# message = seen_search(bot, botcom, posstarget)
|
||||
# bot.osd(message)
|
||||
# return
|
||||
# TODO
|
||||
|
||||
if command_type == 'nickname':
|
||||
try_trigger = spicemanip.main(trigger_args, "2+", 'list')
|
||||
returnmessage = SpiceBot.botai.on_message(bot, trigger, try_trigger)
|
||||
if returnmessage:
|
||||
bot.osd(str(returnmessage))
|
||||
return
|
||||
|
||||
closestmatches = SpiceBot.similar_list(trigger_command, list(SpiceBot.commands.dict['commands']["nickname"].keys()), 3, 'reverse')
|
||||
if len(closestmatches):
|
||||
closestmatches = spicemanip.main(closestmatches, "andlist")
|
||||
bot.osd("I don't know what you are asking me to do! Did you mean: " + str(closestmatches) + "?")
|
||||
return
|
||||
else:
|
||||
bot.osd("I don't know what you are asking me to do!")
|
||||
return
|
||||
|
||||
Loading…
Reference in New Issue
Block a user