summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean B. Palmer <http://inamidst.com/sbp/>2008-03-07 21:33:00 +0000
committerSean B. Palmer <http://inamidst.com/sbp/>2008-03-07 21:33:00 +0000
commit989ea13d0211c171ff04df08f69a79f6621f94ba (patch)
tree6ba691e5919839743f46446f27f208dd41de1cf2
parent16ec61f4d657f23d1e2361f86aeece31c74b84c3 (diff)
downloadbot-989ea13d0211c171ff04df08f69a79f6621f94ba.tar.gz
bot-989ea13d0211c171ff04df08f69a79f6621f94ba.tar.bz2
bot-989ea13d0211c171ff04df08f69a79f6621f94ba.zip
Minor fixes, and important .commands fix, to be private only.
-rwxr-xr-xmodules/calc.py2
-rwxr-xr-xmodules/info.py2
-rwxr-xr-xmodules/search.py6
-rwxr-xr-xmodules/wikipedia.py5
-rwxr-xr-xphenny4
5 files changed, 14 insertions, 5 deletions
diff --git a/modules/calc.py b/modules/calc.py
index 6768035..8e7caea 100755
--- a/modules/calc.py
+++ b/modules/calc.py
@@ -29,6 +29,8 @@ subs = [
def calc(phenny, input):
q = input.group(2)
+ if not q:
+ return phenny.say('0?')
query = q[:]
for a, b in subs:
diff --git a/modules/info.py b/modules/info.py
index df6ad69..932ac2f 100755
--- a/modules/info.py
+++ b/modules/info.py
@@ -22,7 +22,7 @@ doc.priority = 'low'
def commands(phenny, input):
# This function only works in private message
- if input.startswith('#'): return
+ if input.sender.startswith('#'): return
names = ', '.join(sorted(phenny.doc.iterkeys()))
phenny.say('Commands I recognise: ' + names + '.')
phenny.say(("For help, do '%s: help example?' where example is the " +
diff --git a/modules/search.py b/modules/search.py
index 06241d4..856d3db 100755
--- a/modules/search.py
+++ b/modules/search.py
@@ -49,6 +49,8 @@ def formatnumber(n):
def g(phenny, input):
query = input.group(2)
+ if not query:
+ return phenny.reply('.g what?')
uri = result(query)
if uri:
phenny.reply(uri)
@@ -58,6 +60,8 @@ g.priority = 'high'
def gc(phenny, input):
query = input.group(2)
+ if not query:
+ return phenny.reply('.gc what?')
num = count(query)
phenny.say(query + ': ' + num)
gc.commands = ['gc']
@@ -83,7 +87,7 @@ def gcs(phenny, input):
results = [(term, n) for (n, term) in reversed(sorted(results))]
reply = ', '.join('%s (%s)' % (t, formatnumber(n)) for (t, n) in results)
phenny.say(reply)
-gcs.commands = ['gcs']
+gcs.commands = ['gcs', 'comp']
if __name__ == '__main__':
print __doc__.strip()
diff --git a/modules/wikipedia.py b/modules/wikipedia.py
index 18a55f6..540ba4a 100755
--- a/modules/wikipedia.py
+++ b/modules/wikipedia.py
@@ -131,12 +131,11 @@ def wikipedia(term, last=False):
def wik(phenny, input):
origterm = input.groups()[1]
+ if not origterm:
+ return phenny.say('Perhaps you meant ".wik Zen"?')
origterm = origterm.encode('utf-8')
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.replace(' ', '_')
diff --git a/phenny b/phenny
index f54cc6c..8b3748a 100755
--- a/phenny
+++ b/phenny
@@ -5,6 +5,10 @@ Copyright 2008, Sean B. Palmer, inamidst.com
Licensed under the Eiffel Forum License 2.
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