7 moi
public text v1 · immutable#!/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