def self_correct(bot, event, irc, args):
match = re.match(r"^s[/](.*)[/](.*)[/]?$", " ".join(args))
if match is not None:
nick = event.source.nick
channel = event.target
for i in bot.userdb[channel][nick]['seen']:
msg = i['message']
output = msg.replace(match.group(1), match.group(2))
if msg == output:
pass
else:
break
irc.reply(event, '<{0}> {1}'.format(nick, output))
log.info('Changing %s to %s', msg, output)
else:
pass
评论列表
文章目录