#!/usr/bin/env python __module_name__ = "ramac" __module_version__ = "1.0" __module_description__ = "silly script substitutes thoreau" import xchat import urllib from random import randrange path_to_walden = "http://www.gutenberg.org/dirs/etext95/waldn10.txt" walden = urllib.urlopen(path_to_walden) hdt_lines = walden.read().split(" ") def on_message(word, word_eol, userdata): if xchat.nickcmp(word[0], "ramac") == 0: buf = '' while buf == '': buf = hdt_lines[randrange(0, len(hdt_lines))].strip() xchat.prnt(buf) return xchat.EAT_XCHAT return xchat.hook_print("Channel Message", on_message) print "script loaded. veuillez arreter le rampement."