Minor fixes, and important .commands fix, to be private only.

master
Sean B. Palmer 2008-03-07 21:33:00 +00:00
parent 16ec61f4d6
commit 989ea13d02
5 changed files with 14 additions and 5 deletions

View File

@ -29,6 +29,8 @@ subs = [
def calc(phenny, input): def calc(phenny, input):
q = input.group(2) q = input.group(2)
if not q:
return phenny.say('0?')
query = q[:] query = q[:]
for a, b in subs: for a, b in subs:

View File

@ -22,7 +22,7 @@ doc.priority = 'low'
def commands(phenny, input): def commands(phenny, input):
# This function only works in private message # This function only works in private message
if input.startswith('#'): return if input.sender.startswith('#'): return
names = ', '.join(sorted(phenny.doc.iterkeys())) names = ', '.join(sorted(phenny.doc.iterkeys()))
phenny.say('Commands I recognise: ' + names + '.') phenny.say('Commands I recognise: ' + names + '.')
phenny.say(("For help, do '%s: help example?' where example is the " + phenny.say(("For help, do '%s: help example?' where example is the " +

View File

@ -49,6 +49,8 @@ def formatnumber(n):
def g(phenny, input): def g(phenny, input):
query = input.group(2) query = input.group(2)
if not query:
return phenny.reply('.g what?')
uri = result(query) uri = result(query)
if uri: if uri:
phenny.reply(uri) phenny.reply(uri)
@ -58,6 +60,8 @@ g.priority = 'high'
def gc(phenny, input): def gc(phenny, input):
query = input.group(2) query = input.group(2)
if not query:
return phenny.reply('.gc what?')
num = count(query) num = count(query)
phenny.say(query + ': ' + num) phenny.say(query + ': ' + num)
gc.commands = ['gc'] gc.commands = ['gc']
@ -83,7 +87,7 @@ def gcs(phenny, input):
results = [(term, n) for (n, term) in reversed(sorted(results))] results = [(term, n) for (n, term) in reversed(sorted(results))]
reply = ', '.join('%s (%s)' % (t, formatnumber(n)) for (t, n) in results) reply = ', '.join('%s (%s)' % (t, formatnumber(n)) for (t, n) in results)
phenny.say(reply) phenny.say(reply)
gcs.commands = ['gcs'] gcs.commands = ['gcs', 'comp']
if __name__ == '__main__': if __name__ == '__main__':
print __doc__.strip() print __doc__.strip()

View File

@ -131,12 +131,11 @@ def wikipedia(term, last=False):
def wik(phenny, input): def wik(phenny, input):
origterm = input.groups()[1] origterm = input.groups()[1]
if not origterm:
return phenny.say('Perhaps you meant ".wik Zen"?')
origterm = origterm.encode('utf-8') origterm = origterm.encode('utf-8')
term = urllib.unquote(origterm) term = urllib.unquote(origterm)
if not term:
return phenny.say(origin.sender, 'Maybe you meant ".wik Zen"?')
term = term[0].upper() + term[1:] term = term[0].upper() + term[1:]
term = term.replace(' ', '_') term = term.replace(' ', '_')

4
phenny
View File

@ -5,6 +5,10 @@ Copyright 2008, Sean B. Palmer, inamidst.com
Licensed under the Eiffel Forum License 2. Licensed under the Eiffel Forum License 2.
http://inamidst.com/phenny/ http://inamidst.com/phenny/
Note: DO NOT EDIT THIS FILE.
Run ./phenny, then edit ~/.phenny/default.py
Then run ./phenny again
""" """
import sys, os, imp, optparse import sys, os, imp, optparse