Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

docstring snopes, don't respond to "<botnick> <command>" (can still d…

…o "<botnick>: <command>", PEP8
  • Loading branch information...
commit bc05053d8a5d72bfa2c9e21528f896c6c29a3998 1 parent 98709ab
@rmmh rmmh authored
View
2  core/main.py
@@ -156,7 +156,7 @@ def main(conn, out):
prefix = r'^(?:[.]|'
command_re = prefix + inp.conn.nick
- command_re += r'[:,]*\s+)(\w+)(?:$|\s+)(.*)'
+ command_re += r'[:,]+\s+)(\w+)(?:$|\s+)(.*)'
m = re.match(command_re, inp.lastparam)
View
3  plugins/seen.py
@@ -26,7 +26,8 @@ def seeninput(paraml, input=None, db=None, bot=None):
def seen(inp, nick='', chan='', db=None, input=None):
".seen <nick> -- Tell when a nickname was last in active in irc"
- if input.conn.nick.lower() == inp.lower(): # user is looking for us, being a smartass
+ if input.conn.nick.lower() == inp.lower():
+ # user is looking for us, being a smartass
return "You need to get your eyes checked."
if inp.lower() == nick.lower():
View
4 plugins/snopes.py
@@ -8,6 +8,8 @@
@hook.command
def snopes(inp):
+ ".snopes <topic> -- searches snopes for an urban legend about <topic>"
+
search_page = http.get_html(search_url, sp_q=inp, sp_c="1")
result_urls = search_page.xpath("//a[@target='_self']/@href")
@@ -23,4 +25,4 @@ def snopes(inp):
claim = re.sub(r"[\s\xa0]+", " ", claim) # compress whitespace
status = re.sub(r"[\s\xa0]+", " ", status)
- return "%s %s %s" % (claim, status, result_urls[0])
+ return "%s %s %s" % (claim, status, result_urls[0])
View
10 plugins/util/http.py
@@ -39,10 +39,10 @@ def get_json(*args, **kwargs):
def open(url, query_params=None, user_agent=user_agent, post_data=None,
get_method=None, cookies=False, **kwargs):
-
+
if query_params is None:
query_params = {}
-
+
query_params.update(kwargs)
url = prepare_url(url, query_params)
@@ -77,10 +77,10 @@ def prepare_url(url, queries):
def to_utf8(s):
- if isinstance(s, str):
- return s
- else:
+ if isinstance(s, unicode):
return s.encode('utf8', 'ignore')
+ else:
+ return str(s)
def quote_plus(s):
Please sign in to comment.
Something went wrong with that request. Please try again.