new .search start

This commit is contained in:
deathbybandaid 2019-06-14 09:47:12 -04:00
parent 4a1e8e7d86
commit 961c25be78
4 changed files with 31 additions and 0 deletions

View File

@ -5,6 +5,8 @@ from __future__ import unicode_literals, absolute_import, division, print_functi
import requests
from fake_useragent import UserAgent
# TODO add a cache flush
class Google():

View File

@ -11,6 +11,8 @@ import spicemanip
import sopel_modules.SpiceBot as SpiceBot
# TODO commands sent in privmsg don't need bot.nick
@SpiceBot.events.check_ready([SpiceBot.events.BOT_COMMANDS])
@SpiceBot.prerun.prerun('nickname')

View File

@ -0,0 +1,26 @@
# coding=utf8
from __future__ import unicode_literals, absolute_import, division, print_function
"""
This is the SpiceBot search system.
"""
import sopel
import spicemanip
import sopel_modules.SpiceBot as SpiceBot
@SpiceBot.prerun.prerun('module')
@sopel.module.commands('search', 'find', 'google', 'lookup')
def nickname_comand_commands(bot, trigger):
searchterm = spicemanip.main(trigger.sb['args'], 0) or None
if not searchterm:
bot.osd("Not sure what you want me to look for.")
return
searchreturn = SpiceBot.google.search(searchterm)
if not searchreturn:
bot.osd('I cannot find anything about that')
else:
bot.osd(["[Information search for '" + str(searchterm) + "']", str(searchreturn)])

View File

@ -16,6 +16,7 @@ from .Runtime_Controls import *
from .Messaging import *
from .Docs import *
from .BotPrivs import *
from .Search import *
__author__ = 'Sam Zick'
__email__ = 'sam@deathbybandaid.net'