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

master
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) msg = 'Can\'t find the etymology for "%s". Try %s' % (word, uri)
self.msg(origin.sender, msg) self.msg(origin.sender, msg)
# @@ Cf. http://swhack.com/logs/2006-01-04#T01-50-22 # @@ 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.thread = True
f_etymology.priority = 'high' f_etymology.priority = 'high'

View File

@ -135,8 +135,12 @@ def f_title(self, origin, match, args):
return unichr(char).encode('utf-8') return unichr(char).encode('utf-8')
title = r_entity.sub(e, title) title = r_entity.sub(e, title)
if not title: if title:
title = '[Title is the empty document, "".]' 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) self.msg(origin.sender, origin.nick + ': ' + title)
else: self.msg(origin.sender, origin.nick + ': No title found') else: self.msg(origin.sender, origin.nick + ': No title found')
f_title.commands = ['title'] f_title.commands = ['title']

View File

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

View File

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

View File

@ -16,20 +16,23 @@ def replaced(phenny, input):
'compare': '.compare has been replaced by .gcs (googlecounts)', 'compare': '.compare has been replaced by .gcs (googlecounts)',
'map': 'the .map command has been removed; ask sbp for details', 'map': 'the .map command has been removed; ask sbp for details',
'acronym': 'the .acronym command has been removed; ask sbp for details', 'acronym': 'the .acronym command has been removed; ask sbp for details',
'img': 'the .img command has been removed; ask sbp for details', # 'img': 'the .img command has been removed; ask sbp for details',
'v': '.v has been replaced by .val', 'v': '.v has been replaced by .val',
'validate': '.validate has been replaced by .validate', 'validate': '.validate has been replaced by .validate',
'thesaurus': ".thesaurus hasn't been ported to my new codebase yet", 'thesaurus': ".thesaurus hasn't been ported to my new codebase yet",
'rates': "moon wanter. moOOoon wanter!", # 'rates': "moon wanter. moOOoon wanter!",
'web': 'the .web command has been removed; ask sbp for details', 'web': 'the .web command has been removed; ask sbp for details',
'origin': ".origin hasn't been ported to my new codebase yet" 'origin': ".origin hasn't been ported to my new codebase yet",
# 'gs': 'sorry, .gs no longer works',
'swhack': 'sorry, .swhack no longer works'
} }
try: response = responses[command] try: response = responses[command]
except KeyError: return except KeyError: return
else: phenny.reply(response) else: phenny.reply(response)
replaced.commands = [ replaced.commands = [
'cp', 'pc', 'unicode', 'compare', 'map', 'acronym', 'img', 'cp', 'pc', 'unicode', 'compare', 'map', 'acronym',
'v', 'validate', 'thesaurus', 'rates', 'web', 'mangle', 'origin' 'v', 'validate', 'thesaurus', 'web', 'mangle', 'origin',
'swhack'
] ]
replaced.priority = 'low' replaced.priority = 'low'

View File

@ -28,7 +28,7 @@ def swhack(phenny, input):
phenny.reply('Sorry, no results found.') phenny.reply('Sorry, no results found.')
u.close() u.close()
swhack.commands = ['swhack'] # swhack.commands = ['swhack']
if __name__ == '__main__': if __name__ == '__main__':
print __doc__.strip() print __doc__.strip()