All pastes #1600350 Raw Edit

Someone

public python v1 · immutable
#1600350 ·published 2009-10-07 03:24 UTC
rendered paste body
__module_name__ = "SongbirdSay"__module_version__ = "v1"__module_description__ = "Grab from songbird file and say it"print "\0034 "+__module_name__+" "+__module_version__+" has been loaded\003"import xchat, os, stringfile_to_grab_from = "C:\\test.txt" # use double backslashes pleasedef open_file(word, word_eol, userdata):	lines = []	try:		open_songbird_file = open(file_to_grab_from)		current_line = open_songbird_file.readline()		while current_line != "":			current_line = current_line.replace("\n", "")			if len(lines) < 1:				lines = [current_line]			else:				lines.append(current_line)			current_line = open_songbird_file.readline()		open_songbird_file.close()	except:		print "Something went wrong, maybe the file isn't there?"			for x in lines:		context = xchat.get_context()		chan = context.get_info('channel')		line = "MSG " + chan + " " + x		xchat.command(line)		return xchat.EAT_ALL	def unload_cb(userdata):	print "\0034 "+__module_name__+" "+__module_version__+" has been unloaded\003"xchat.hook_command('song', open_file, help="NO")xchat.hook_unload(unload_cb)