All pastes #249623 Raw Edit

7 moi

public text v1 · immutable
#249623 ·published 2006-11-15 23:56 UTC
rendered paste body
#!/usr/bin/env python

import random
ia_db = '/home/users/djuls/fenny/data/ia.db'
def f_ia(self, origin, match, args):
   input = args[0]
   for answer in open(ia_db):
      keyword, filename = [ x.strip() for x in line.split("->", 1) ]
      if keyword in text:
         reply = random.choice( open(filename).readlines() ).strip()
         f.close()
         if reply: self.msg(origin.sender, origin.nick + ': ' + reply)
f_ia.rule = r'(.*)'
f_ia.thread = True