Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 67d1414fc1
Fetching contributors…

Cannot retrieve contributors at this time

35 lines (26 sloc) 0.895 kb
import httplib2
import json
import urllib
from irc import IRCBot, run_bot
class GoogleBot(IRCBot):
def fetch_result(self, query):
sock = httplib2.Http(timeout=1)
headers, response = sock.request(
'' % \
if headers['status'] in (200, '200'):
response = json.loads(response)
return response['responseData']['results'][0]['unescapedUrl']
def find_me(self, nick, message, channel, query):
result = self.fetch_result(query)
if result:
return result
def command_patterns(self):
return ('^find me (?P<query>\S+)', self.find_me),
host = ''
port = 6667
nick = 'googlebot1337'
run_bot(GoogleBot, host, port, nick, ['#botwars'])
Jump to Line
Something went wrong with that request. Please try again.