Minor fixes, full stop stripping of tell nicknames &c.

This commit is contained in:
Sean B. Palmer
2008-08-09 16:01:20 +01:00
parent 86c2f274d5
commit 31d107c0bd
6 changed files with 22 additions and 11 deletions

View File

@@ -94,7 +94,7 @@ def f_etymology(self, origin, match, args):
msg = 'Can\'t find the etymology for "%s". Try %s' % (word, uri)
self.msg(origin.sender, msg)
# @@ Cf. http://swhack.com/logs/2006-01-04#T01-50-22
f_etymology.rule = (['ety'], r"([A-Za-z0-9' -]+)")
f_etymology.rule = (['ety'], r"([A-Za-z0-9' .-]+)")
f_etymology.thread = True
f_etymology.priority = 'high'

View File

@@ -135,8 +135,12 @@ def f_title(self, origin, match, args):
return unichr(char).encode('utf-8')
title = r_entity.sub(e, title)
if not title:
title = '[Title is the empty document, "".]'
if title:
try: title.decode('iso-8859-1')
except: pass
else: title = title.decode('iso-8859-1').encode('utf-8')
else: title = '[The title is empty.]'
self.msg(origin.sender, origin.nick + ': ' + title)
else: self.msg(origin.sender, origin.nick + ': No title found')
f_title.commands = ['title']

View File

@@ -14,6 +14,9 @@ def f_reload(phenny, input):
if not input.admin: return
name = input.group(2)
if name == phenny.config.owner:
return phenny.reply('What?')
if (not name) or (name == '*'):
phenny.setup()
return phenny.reply('done')

View File

@@ -39,7 +39,8 @@ def dumpReminders(fn, data):
for tellee in data.iterkeys():
for remindon in data[tellee]:
line = '\t'.join((tellee,) + remindon)
f.write(line + '\n')
try: f.write(line + '\n')
except IOError: break
try: f.close()
except IOError: pass
return True
@@ -64,7 +65,7 @@ def f_remind(phenny, input):
tellee = tellee.encode('utf-8')
msg = msg.encode('utf-8')
tellee_original = tellee.rstrip(',:;')
tellee_original = tellee.rstrip('.,:;')
tellee = tellee_original.lower()
if not os.path.exists(phenny.tell_filename):