PEP8 compliance, reduce munging on tagged names
This commit is contained in:
parent
9a9922a3ca
commit
2a11825779
|
@ -120,7 +120,6 @@ def main(conn, out):
|
|||
for func, args in bot.events[inp.command] + bot.events['*']:
|
||||
dispatch(Input(conn, *out), "event", func, args)
|
||||
|
||||
|
||||
if inp.command == 'PRIVMSG':
|
||||
# COMMANDS
|
||||
if inp.chan == inp.nick: # private message, no command prefix
|
||||
|
|
|
@ -28,11 +28,9 @@ def format_plug(plug, kind='', lpad=0, width=40):
|
|||
if kind == 'regex':
|
||||
out += ' ' * (50 - len(out)) + plug[1]['regex']
|
||||
|
||||
|
||||
return out
|
||||
|
||||
|
||||
|
||||
def reload(init=False):
|
||||
changed = False
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ from util import hook
|
|||
api_url = "http://encyclopediadramatica.com/api.php?action=opensearch&search="
|
||||
ed_url = "http://encyclopediadramatica.com/"
|
||||
|
||||
ua_header = ('User-Agent','Skybot/1.0 http://bitbucket.org/Scaevolus/skybot/')
|
||||
ua_header = ('User-Agent', 'Skybot/1.0 http://bitbucket.org/Scaevolus/skybot/')
|
||||
|
||||
|
||||
@hook.command('ed')
|
||||
|
|
|
@ -11,11 +11,12 @@ from util import hook
|
|||
# say('(--[. ]-[ .] /')
|
||||
# say('(_______o__)')
|
||||
|
||||
|
||||
@hook.command
|
||||
@hook.command('gs')
|
||||
def goonsay(inp):
|
||||
".gs/.goonsay <id|add [message]> -- Get's the goonsay.com result for <id> or "
|
||||
"add a new :goonsay: to the database. If no arg it will get a random result."
|
||||
".gs/.goonsay <id|add [message]> -- Get's the goonsay.com result for <id> "
|
||||
" or add a new :goonsay: to the database. With no args, random result."
|
||||
|
||||
url = "http://goonsay.com/api/goonsays"
|
||||
|
||||
|
@ -44,7 +45,8 @@ def goonsay(inp):
|
|||
|
||||
if len(inp):
|
||||
try:
|
||||
req = urllib2.Request('%s/%d/' % (url, int(inp)), None, req_headers)
|
||||
req = urllib2.Request('%s/%d/' % (url, int(inp)), None,
|
||||
req_headers)
|
||||
j = json.loads(urllib2.urlopen(req).read())
|
||||
except urllib2.HTTPError, e:
|
||||
if e.code == 410 or e.code == 404:
|
||||
|
|
|
@ -28,7 +28,6 @@ def mtg(inp):
|
|||
text = re.sub(r'\(.*?\)', '', text) # strip parenthetical explanations
|
||||
text = re.sub(r'\.(\S)', r'. \1', text) # fix spacing
|
||||
|
||||
|
||||
printings = card.find('td/small').text_content()
|
||||
printings = re.search(r'Editions:(.*)Languages:', printings).group(1)
|
||||
printings = re.findall(r'\s*(.+?(?: \([^)]+\))*) \((.*?)\)',
|
||||
|
|
|
@ -108,7 +108,7 @@ def tag(inp, chan='', db=None):
|
|||
if not tags:
|
||||
return get_nicks_by_tag(db, chan, inp)
|
||||
else:
|
||||
return 'tags for "%s": ' % munge(inp, 3) + ', '.join(
|
||||
return 'tags for "%s": ' % munge(inp, 1) + ', '.join(
|
||||
tag[0] for tag in tags)
|
||||
|
||||
|
||||
|
|
|
@ -36,7 +36,8 @@ def tellinput(paraml, input=None, db=None, bot=None):
|
|||
user_from, message, time, chan = tells[0]
|
||||
reltime = timesince.timesince(time)
|
||||
|
||||
reply = "%s said %s ago in %s: %s" % (user_from, reltime, chan, message)
|
||||
reply = "%s said %s ago in %s: %s" % (user_from, reltime, chan,
|
||||
message)
|
||||
if len(tells) > 1:
|
||||
reply += " (+%d more, .showtells to view)" % (len(tells) - 1)
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@ def _hook_add(func, add, name=''):
|
|||
if not hasattr(func, '_thread'): # does function run in its own thread?
|
||||
func._thread = False
|
||||
|
||||
|
||||
def sieve(func):
|
||||
if func.func_code.co_argcount != 5:
|
||||
raise ValueError(
|
||||
|
|
Loading…
Reference in New Issue