aboutsummaryrefslogtreecommitdiff
path: root/modules/google.py
diff options
context:
space:
mode:
authorGravatar dngfx2018-08-31 10:51:47 +0100
committerGravatar dngfx2018-08-31 10:51:47 +0100
commit90ce92dc39395444862edfc7946ef7a1195f2464 (patch)
tree6832c146a15879df292d265083bfe5795cbdfa69 /modules/google.py
parentReformat (diff)
signature
Revert "Reformat"
This reverts commit abed9cf
Diffstat (limited to 'modules/google.py')
-rw-r--r--modules/google.py16
1 files changed, 7 insertions, 9 deletions
diff --git a/modules/google.py b/modules/google.py
index f525fc61..b8d5c653 100644
--- a/modules/google.py
+++ b/modules/google.py
@@ -1,31 +1,29 @@
-# --require-config google-api-key
-# --require-config google-search-id
+#--require-config google-api-key
+#--require-config google-search-id
import Utils
URL_GOOGLESEARCH = "https://www.googleapis.com/customsearch/v1"
-
class Module(object):
def __init__(self, bot):
self.bot = bot
bot.events.on("received").on("command").on("google",
- "g").hook(self.google,
- help="Google feeling lucky",
- usage="[search term]")
+ "g").hook(self.google, help="Google feeling lucky",
+ usage="[search term]")
def google(self, event):
phrase = event["args"] or event["buffer"].get()
if phrase:
page = Utils.get_url(URL_GOOGLESEARCH, get_params={
"q": phrase, "key": self.bot.config[
- "google-api-key"], "cx": self.bot.config[
- "google-search-id"], "prettyPrint": "true",
+ "google-api-key"], "cx": self.bot.config[
+ "google-search-id"], "prettyPrint": "true",
"num": 1, "gl": "gb"}, json=True)
if page:
if "items" in page and len(page["items"]):
event["stdout"].write(page["items"][0][
- "link"])
+ "link"])
else:
event["stderr"].write("No results found")
else: