mirror of
https://github.com/SpiceBot/SpiceBot.git
synced 2026-11-10 21:50:59 -05:00
new .search start
This commit is contained in:
parent
4a1e8e7d86
commit
961c25be78
@ -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():
|
||||
|
||||
|
||||
@ -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')
|
||||
|
||||
26
sopel_modules/SpiceBot_Core_Commands/Search.py
Normal file
26
sopel_modules/SpiceBot_Core_Commands/Search.py
Normal 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)])
|
||||
@ -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'
|
||||
|
||||
Loading…
Reference in New Issue
Block a user