This commit is contained in:
deathbybandaid 2019-09-20 14:43:41 -04:00
parent 107b18d76e
commit a88e008b0f
2 changed files with 25 additions and 1 deletions

View File

@ -40,7 +40,7 @@ class Search():
if apikey:
self.valid_api[search_api]["apikey"] = apikey
self.valid_api[search_api]["comtype"] = "gif_prefix"
self.valid_api[search_api]["comtype"] = "search_prefix"
self.valid_api[search_api]["validcoms"] = [self.valid_api[search_api]["filename"]]
botcommands.register(self.valid_api[search_api])

View File

@ -30,6 +30,30 @@ def search_main(bot, trigger, botcom):
bot.osd(["[Information search for '" + str(searchterm) + "']", str(searchreturn)])
@SpiceBot.prerun('module', "search_prefix")
@sopel.module.commands('(.*)')
def gifapi_triggers(bot, trigger, botcom):
if botcom.dict['com'] not in list(SpiceBot.search.valid_api.keys()):
return
searchterm = spicemanip(botcom.dict['args'], 0) or None
if not searchterm:
SpiceBot.messagelog.messagelog_error(botcom.dict["log_id"], "Not sure what you want me to look for.")
return
searchdict = {
"query": searchterm,
"query_type": botcom.dict["realcom"],
}
searchreturn = SpiceBot.search.search(searchdict)
if not searchreturn:
SpiceBot.messagelog.messagelog_error(botcom.dict["log_id"], 'I cannot find anything about that')
else:
bot.osd(["[" + botcom.dict["realcom"].upper() + " search for '" + str(searchterm) + "']", str(searchreturn)])
@SpiceBot.prerun('module')
@sopel.module.commands("where", "whereis")
def search_where(bot, trigger, botcom):